Version Description
Download this release
Release Info
Developer | cgastrell |
Plugin | Crowdsignal Forms |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.1.0
- README.TXT +17 -1
- build/editor.asset.php +1 -1
- build/editor.css +1 -1
- build/editor.js +35 -24
- build/poll.asset.php +1 -1
- build/poll.css +1 -1
- build/poll.js +27 -16
- changelog.txt +31 -14
- crowdsignal-forms.php +2 -2
- includes/admin/class-admin-hooks.php +47 -130
- includes/admin/class-crowdsignal-forms-settings.php +1 -1
- includes/admin/class-crowdsignal-forms-setup.php +1 -1
- includes/frontend/blocks/class-crowdsignal-forms-poll-block.php +30 -4
- includes/frontend/class-crowdsignal-forms-block.php +20 -0
- includes/frontend/class-crowdsignal-forms-blocks-assets.php +13 -13
- includes/frontend/class-crowdsignal-forms-blocks.php +17 -5
- includes/gateways/class-post-poll-meta-gateway.php +25 -1
- includes/models/class-poll-settings.php +2 -0
- includes/models/class-poll.php +3 -1
- includes/rest-api/controllers/class-polls-controller.php +27 -5
- includes/synchronization/class-comment-sync-entity.php +202 -0
- includes/synchronization/class-poll-block-synchronizer.php +204 -0
- includes/synchronization/class-post-sync-entity.php +162 -0
- includes/synchronization/class-synchronizable-entity.php +88 -0
- languages/crowdsignal-forms.pot +8 -8
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: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -66,6 +66,22 @@ Compare our [simple and affordable plans](https://crowdsignal.com/pricing/) or t
|
|
66 |
4. Use the poll block inside of other blocks
|
67 |
|
68 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
= 1.0 =
|
71 |
* Update default sidebar status
|
4 |
Requires at least: 5.0
|
5 |
Requires PHP: 5.6.20
|
6 |
Tested up to: 5.4.2
|
7 |
+
Stable tag: 1.1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
66 |
4. Use the poll block inside of other blocks
|
67 |
|
68 |
== Changelog ==
|
69 |
+
= 1.1.0 =
|
70 |
+
* Implement a poll width setting
|
71 |
+
* fix method used when updating poll ids in post meta
|
72 |
+
* Fix archiving of poll blocks in comments
|
73 |
+
* Address the comments from the p2tenberg compatibility pr
|
74 |
+
* P2tenberg: Get The Edit Bar To Display in p2tenberg
|
75 |
+
* keep button placeholder on focus of button answers for a less jarring editing experience
|
76 |
+
* P2tenberg compatibility
|
77 |
+
* Change radio/checkbox fill colour to text colour
|
78 |
+
* Add release preparation script
|
79 |
+
* Add Button Answer Type (with actual buttons)
|
80 |
+
* Add a link for crowdsignal.com In Sidebar for an Unpublished Poll
|
81 |
+
* remove ios styling from submit button
|
82 |
+
* Move asset definitions to the `block` class to simplify adding new blocks
|
83 |
+
* update branches that travis will build
|
84 |
+
* Add wp-editor dependency
|
85 |
|
86 |
= 1.0 =
|
87 |
* Update default sidebar status
|
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-compose', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-polyfill'), 'version' => 'c8107726e8fe144ace54a5d46c8575d9');
|
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}.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}
|
1 |
+
#editor .editor-styles-wrapper .crowdsignal-forms-poll{margin-left:0;margin-right:0}#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="full"] .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"] .crowdsignal-forms-poll__content,#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="full"] .crowdsignal-forms-poll__content{padding:80px}}#editor .editor-styles-wrapper .crowdsignal-forms-poll__answer{cursor:text}#editor .editor-styles-wrapper .crowdsignal-forms-poll__answer:hover,#editor .editor-styles-wrapper .crowdsignal-forms-poll__answer.is-focused{color:inherit}#editor .editor-styles-wrapper .wp-block-button .crowdsignal-forms-poll__submit-button.wp-block-button__link{cursor:text}.crowdsignal-forms-poll__resize-wrapper{margin-left:auto;margin-right:auto}.crowdsignal-forms__redirect-url input[type="text"]{width:100%}.crowdsignal-forms__redirect-url__suggestions{width:260px}.crowdsignal-forms__row{display:flex;flex-direction:row}.crowdsignal-forms__row .crowdsignal-forms__small-text-input input[type="text"]{width:40px}.crowdsignal-forms__row .crowdsignal-forms__small-text-input input[type="number"]{width:50px}.crowdsignal-forms__reset-width-button{margin-left:auto;margin-top:25px}.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}.crowdsignal-forms-poll__edit-bar .crowdsignal-forms-poll__edit-bar-message{padding-inline-end:24px}.crowdsignal-forms-poll__edit-bar button.crowdsignal-forms-poll__edit-bar-button{border:2px solid #d82e20;border-radius:4px;color:#d82e20;background:transparent;padding:8px 16px;cursor:pointer}.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}.crowdsignal-forms__connect-to-crowdsignal-header{display:flex;flex-direction:row;align-items:center}.crowdsignal-forms__connect-to-crowdsignal-body{font-size:13px;margin-top:24px;margin-bottom:16px}.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}.crowdsignal-forms-poll{border-color:var(--crowdsignal-forms-border-color);border-style:solid;border-width:var(--crowdsignal-forms-border-width);margin-left:auto;margin-right:auto;margin-top:5px;position:relative;text-align:left}.entry-content .alignfull.crowdsignal-poll-wrapper .crowdsignal-forms-poll{border-left-width:0;border-right-width:0}.crowdsignal-forms-poll h3.crowdsignal-forms-poll__question{margin:0 0 28px}.crowdsignal-forms-poll h3.crowdsignal-forms-poll__question:first-child{margin-top:0}.crowdsignal-forms-poll p.crowdsignal-forms-poll__note{font-style:italic;margin:0 0 32px}.crowdsignal-forms-poll .crowdsignal-forms-poll__content{padding:40px 24px 16px 24px}.crowdsignal-forms-poll .crowdsignal-forms-poll__content .crowdsignal-forms-poll__question{font-family:var(--crowdsignal-forms-question-font-family)}.crowdsignal-forms-poll .crowdsignal-forms-poll__content .crowdsignal-forms-poll__answer-label,.crowdsignal-forms-poll .crowdsignal-forms-poll__content .crowdsignal-forms-poll__answer-results-answer,.crowdsignal-forms-poll .crowdsignal-forms-poll__content .crowdsignal-forms-poll__note{font-family:var(--crowdsignal-forms-body-font-family)}.entry-content .alignfull.crowdsignal-poll-wrapper .crowdsignal-forms-poll .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 .crowdsignal-forms-poll .crowdsignal-forms-poll__content,.alignfull.crowdsignal-poll-wrapper .crowdsignal-forms-poll .crowdsignal-forms-poll__content{padding:80px}}.crowdsignal-forms-poll.is-closed .crowdsignal-forms-poll__form{opacity:0.5}.crowdsignal-forms-poll.is-hidden{opacity:0.5}.crowdsignal-forms-poll.has-text-color{color:var(--crowdsignal-forms-text-color)}.crowdsignal-forms-poll.has-bg-color{background-color:var(--crowdsignal-forms-bg-color)}.crowdsignal-forms-poll.has-border-radius{border-radius:var(--crowdsignal-forms-border-radius);overflow:hidden}.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)}.crowdsignal-forms-poll .is-transparent{opacity:0;pointer-events:none}.crowdsignal-forms-poll__block-button .crowdsignal-forms-poll__submit-button{-webkit-appearance:initial}.crowdsignal-forms-poll__block-button .crowdsignal-forms-poll__submit-button:disabled{opacity:0.7}.crowdsignal-forms-poll.has-submit-button-bg-color .crowdsignal-forms-poll__block-button .crowdsignal-forms-poll__submit-button.wp-block-button__link{background-color:var(--crowdsignal-forms-submit-button-bg-color)}.crowdsignal-forms-poll.has-submit-button-text-color .crowdsignal-forms-poll__block-button .crowdsignal-forms-poll__submit-button.wp-block-button__link{color:var(--crowdsignal-forms-submit-button-text-color)}.crowdsignal-forms-poll__options.is-button{display:flex;flex-direction:column;flex-wrap:wrap}.crowdsignal-forms-poll__options.is-button.is-inline-button-alignment{flex-direction:row}.crowdsignal-forms-poll__answer{cursor:pointer;display:flex;font-size:inherit;font-weight:600;margin:0;padding:0 2px;position:relative}.crowdsignal-forms-poll__answer.is-button{margin-inline-end:20px;margin-block-end:20px;max-width:100%}.crowdsignal-forms-poll__answer.is-button .wp-block-button.crowdsignal-forms-poll__block-button,.crowdsignal-forms-poll__answer.is-button .crowdsignal-forms-poll__submit-button{max-width:100%}.crowdsignal-forms-poll__answer.is-button .crowdsignal-forms-poll__submit-button{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.crowdsignal-forms-poll__answer:not(.is-button){margin-block-end:16px}.crowdsignal-forms-poll__answer:hover,.crowdsignal-forms-poll__answer.is-focused{color:var(--crowdsignal-forms-submit-button-bg-color)}.has-voted .crowdsignal-forms-poll__answer{opacity:0.5}input[type="checkbox"].crowdsignal-forms-poll__input,input[type="radio"].crowdsignal-forms-poll__input{height:0;opacity:0;position:absolute;width:0}.crowdsignal-forms-poll__check{display:inline-block;height:1em;margin:0 10px 0 0;position:relative;width:1em}.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%}.crowdsignal-forms-poll__answer.is-multiple-choice .crowdsignal-forms-poll__check::before{border-radius:3px}.crowdsignal-forms-poll__answer.is-multiple-choice.is-selected .crowdsignal-forms-poll__check::before{border-color:var(--crowdsignal-forms-text-color);background-color:var(--crowdsignal-forms-text-color)}.crowdsignal-forms-poll__answer.is-selected:not(.is-multiple-choice) .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-text-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%}.crowdsignal-forms-poll__answer.is-selected.is-multiple-choice .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.crowdsignal-forms-poll__answer-label-wrapper{flex:1;word-break:break-word}div.crowdsignal-forms-poll__answer-label-wrapper span.crowdsignal-forms-poll__answer-label{line-height:1;vertical-align:top}div.crowdsignal-forms-poll__answer-label-wrapper span.crowdsignal-forms-poll__answer-label span::after{vertical-align:top}.crowdsignal-forms-poll__button{border:0;padding:0}.crowdsignal-forms-poll__actions .wp-block-button,.crowdsignal-forms-poll__options .wp-block-button{margin:0}.crowdsignal-forms-poll__actions{display:flex;justify-content:flex-end}.editor-styles-wrapper .crowdsignal-forms-poll .crowdsignal-forms-poll__actions .wp-block-button.crowdsignal-forms-poll__block-button,.editor-styles-wrapper .crowdsignal-forms-poll .crowdsignal-forms-poll__options .wp-block-button.crowdsignal-forms-poll__block-button{margin:0}.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 .crowdsignal-forms-poll__closed-banner{font-style:italic}.crowdsignal-forms-poll__error{color:red}.crowdsignal-forms-poll__results-list{margin:0 0 1em;position:relative}.crowdsignal-forms-poll__answer-results{display:flex;flex-direction:column;margin:0 0 16px;width:100%}.crowdsignal-forms-poll__answer-results:last-child{margin:0}.crowdsignal-forms-poll__answer-results-labels{align-items:flex-end;display:flex;margin:0 0 8px;width:100%;word-break:break-word}.crowdsignal-forms-poll__answer-results-answer{flex:1;font-size:1em;font-weight:600}.crowdsignal-forms-poll__answer-results-votes{font-size:0.75em;line-height:2}.crowdsignal-forms-poll__answer-results-percent{font-weight:600;line-height:1.6}.crowdsignal-forms-poll__answer-results-votes,.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}.crowdsignal-forms-poll__answer-results.is-error .crowdsignal-forms-poll__answer-results-votes,.crowdsignal-forms-poll__answer-results.is-error .crowdsignal-forms-poll__answer-results-percent{display:none}.crowdsignal-forms-poll__answer-results.is-loading .crowdsignal-forms-poll__answer-results-votes,.crowdsignal-forms-poll__answer-results.is-loading .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}.crowdsignal-forms-poll__answer-results.is-loading .crowdsignal-forms-poll__answer-results-votes:last-child,.crowdsignal-forms-poll__answer-results.is-loading .crowdsignal-forms-poll__answer-results-percent:last-child{width:40px}.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%}.crowdsignal-forms-poll__answer-results.is-loading .crowdsignal-forms-poll__answer-results-progress-track{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse}.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}.crowdsignal-forms-poll__answer-results.is-error .crowdsignal-forms-poll__answer-results-progress-bar{width:0}.crowdsignal-forms-poll__answer-results.is-loading .crowdsignal-forms-poll__answer-results-progress-bar{background-color:var(--crowdsignal-forms-text-color);width:25%}.crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+1) .crowdsignal-forms-poll__answer-results-progress-bar{width:40%}.crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+2) .crowdsignal-forms-poll__answer-results-progress-bar{width:75%}.crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+3) .crowdsignal-forms-poll__answer-results-progress-bar{width:50%}.crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+4) .crowdsignal-forms-poll__answer-results-progress-bar{width:60%}.crowdsignal-forms-poll__results-footer{display:flex;flex-direction:column;justify-content:space-between;width:100%;font-size:0.9em}.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}.crowdsignal-forms-poll__results.is-loading .crowdsignal-forms-poll__results-total{color:transparent}.crowdsignal-forms-poll__results.is-loading .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}.crowdsignal-forms-poll__footer-branding{display:flex;justify-content:space-between;align-items:center;width:100%}.crowdsignal-forms-poll__footer-branding img.crowdsignal-forms-poll__footer-branding-logo{width:50px;height:50px;margin-left:0;margin-right:0}.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}.crowdsignal-forms-poll__footer-cs-link:not(:hover){color:var(--crowdsignal-forms-text-color);opacity:0.4}.has-default-thankyou .crowdsignal-forms-poll__footer-cs-link{color:#333}.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}.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 .crowdsignal-forms-poll__submit-message-container{background-color:#fff}.crowdsignal-forms-poll__submit-message{position:relative}.crowdsignal-forms-poll__submit-message button.crowdsignal-forms-poll__dismiss-submit-message{position:absolute;right:0;top:0;background-color:transparent;color:#000;text-decoration:none;border:none}.crowdsignal-forms-poll__submit-message button.crowdsignal-forms-poll__dismiss-submit-message:hover{background:inherit}.crowdsignal-forms-poll__submit-message-footer{position:absolute;bottom:0;left:0;padding:16px 24px;width:100%;background-color:inherit}.crowdsignal-forms-poll__thank-you-cs-sticker{right:25px;top:66px}.crowdsignal-forms-poll__thank-you-sticker{right:132px;top:12px}.crowdsignal-forms-poll__thank-you-cs-sticker,.crowdsignal-forms-poll__thank-you-sticker{filter:drop-shadow(0 1px 2px rgba(0,0,0,0.2));width:100px;height:100px;position:absolute}.crowdsignal-forms-poll__custom-message-check{color:var(--crowdsignal-forms-text-color);padding-left:24px;padding-top:24px}.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
@@ -94,7 +94,7 @@
|
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
96 |
"use strict";
|
97 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/**\n * Internal dependencies\n */\n\n\n/*\n * Note: Any changes made to the attributes definition need to be duplicated in\n * Crowdsignal_Forms\\Frontend\\Blocks\\Crowdsignal_Forms_Poll_Block::attributes()\n * inside includes/frontend/blocks/class-crowdsignal-forms-poll-block.php.\n */\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n pollId: {\n type: 'string',\n default: null\n },\n isMultipleChoice: {\n type: 'boolean',\n default: false\n },\n title: {\n type: 'string',\n default: null\n },\n question: {\n type: 'string',\n default: ''\n },\n note: {\n type: 'string',\n default: ''\n },\n answers: {\n type: 'array',\n default: [{}, {}, {}],\n items: {\n type: 'object',\n properties: {\n answerId: {\n type: 'string',\n default: null\n },\n text: {\n type: 'string',\n default: ''\n }\n }\n }\n },\n submitButtonLabel: {\n type: 'string',\n default: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_1__[\"__\"])('Submit')\n },\n submitButtonTextColor: {\n type: 'string'\n },\n submitButtonBackgroundColor: {\n type: 'string'\n },\n confirmMessageType: {\n type: 'string',\n default: _constants__WEBPACK_IMPORTED_MODULE_0__[\"ConfirmMessageType\"].RESULTS\n },\n customConfirmMessage: {\n type: 'string'\n },\n redirectAddress: {\n type: 'string'\n },\n textColor: {\n type: 'string'\n },\n backgroundColor: {\n type: 'string'\n },\n borderColor: {\n type: 'string'\n },\n borderWidth: {\n type: 'number',\n default: 2\n },\n borderRadius: {\n type: 'number',\n default: 0\n },\n hasBoxShadow: {\n type: 'boolean',\n default: false\n },\n fontFamily: {\n type: 'string',\n default: _constants__WEBPACK_IMPORTED_MODULE_0__[\"FontFamilyType\"].THEME_DEFAULT\n },\n hasOneResponsePerComputer: {\n type: 'boolean',\n default: false\n },\n randomizeAnswers: {\n type: 'boolean',\n default: false\n },\n align: {\n type: 'string',\n
|
98 |
|
99 |
/***/ }),
|
100 |
|
@@ -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 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: \"
|
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, 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 |
|
@@ -130,7 +130,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
130 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
131 |
|
132 |
"use strict";
|
133 |
-
eval("__webpack_require__.r(__webpack_exports__);\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 _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/block-editor */ \"@wordpress/block-editor\");\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__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 lib_i18n__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\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_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\n/**\n * WordPress dependencies\n */\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar EditAnswer = function EditAnswer(_ref) {\n var answer = _ref.answer,\n index = _ref.index,\n isMultipleChoice = _ref.isMultipleChoice,\n onChange = _ref.onChange,\n onDelete = _ref.onDelete,\n onNewAnswer = _ref.onNewAnswer,\n disabled = _ref.disabled;\n\n var handleChangeText = function handleChangeText(text) {\n return onChange(index, _objectSpread({}, answer, {\n text: text\n }));\n };\n\n var handleDelete = function handleDelete() {\n return onDelete(index);\n };\n\n var handleSplit = function handleSplit() {\n return onNewAnswer(index + 1);\n };\n\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('
|
134 |
|
135 |
/***/ }),
|
136 |
|
@@ -142,7 +142,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab
|
|
142 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
143 |
|
144 |
"use strict";
|
145 |
-
eval("__webpack_require__.r(__webpack_exports__);\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 _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var
|
146 |
|
147 |
/***/ }),
|
148 |
|
@@ -154,7 +154,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab
|
|
154 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
155 |
|
156 |
"use strict";
|
157 |
-
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 lib_i18n__WEBPACK_IMPORTED_MODULE_2__ = __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\nvar EditBar = function EditBar(_ref) {\n var onEditClick = _ref.onEditClick;\n\n var handleEditClick = function handleEditClick() {\n onEditClick();\n };\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"
|
158 |
|
159 |
/***/ }),
|
160 |
|
@@ -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\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,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 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,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__[\"__\"])('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 |
|
@@ -202,7 +202,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
202 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
203 |
|
204 |
"use strict";
|
205 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var
|
206 |
|
207 |
/***/ }),
|
208 |
|
@@ -210,11 +210,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab
|
|
210 |
/*!*********************************************!*\
|
211 |
!*** ./client/blocks/poll/subscriptions.js ***!
|
212 |
\*********************************************/
|
213 |
-
/*! exports provided: startSubscriptions */
|
214 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
215 |
|
216 |
"use strict";
|
217 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startSubscriptions\", function() { return startSubscriptions; });\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 _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ \"@wordpress/data\");\n/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ \"@wordpress/api-fetch\");\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);\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 * WordPress dependencies\n */\n\n\n\n\nvar isPollBlock = function isPollBlock(block) {\n return block.name === 'crowdsignal-forms/poll';\n};\n\nvar subsStarted = false;\nvar startSubscriptions = function startSubscriptions() {\n if (subsStarted) {\n return;\n }\n\n subsStarted = true;\n\n var
|
218 |
|
219 |
/***/ }),
|
220 |
|
@@ -226,7 +226,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
226 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
227 |
|
228 |
"use strict";
|
229 |
-
eval("__webpack_require__.r(__webpack_exports__);\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 _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__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 _wordpress_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/components */ \"@wordpress/components\");\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var components_icon_checklist_multiple_choice__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! components/icon/checklist-multiple-choice */ \"./client/components/icon/checklist-multiple-choice.js\");\n/* harmony import */ var components_icon_checklist_single_choice__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! components/icon/checklist-single-choice */ \"./client/components/icon/checklist-single-choice.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\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_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/**\n * WordPress dependencies\n */\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\nvar multipleChoiceControls = [{\n icon: components_icon_checklist_single_choice__WEBPACK_IMPORTED_MODULE_7__[\"default\"],\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Choose one answer'),\n value: false\n}, {\n icon: components_icon_checklist_multiple_choice__WEBPACK_IMPORTED_MODULE_6__[\"default\"],\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Choose multiple answers'),\n value: true\n}];\n\nvar PollToolbar = function PollToolbar(_ref) {\n var attributes = _ref.attributes,\n setAttributes = _ref.setAttributes;\n var multipleChoiceToolbar = Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"map\"])(multipleChoiceControls, function (button) {\n return _objectSpread({}, button, {\n isActive: button.value === attributes.isMultipleChoice,\n onClick: function onClick() {\n
|
230 |
|
231 |
/***/ }),
|
232 |
|
@@ -234,11 +234,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab
|
|
234 |
/*!************************************!*\
|
235 |
!*** ./client/blocks/poll/util.js ***!
|
236 |
\************************************/
|
237 |
-
/*! exports provided: addAnswer, getFontFamilyFromType, getStyleVars, extractRGBColorProperties, hexToRGB, getBlockCssClasses, isPollClosed,
|
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 |
|
@@ -286,7 +286,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
286 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
287 |
|
288 |
"use strict";
|
289 |
-
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 prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * External dependencies\n */\n\n\n\n/**\n * WordPress dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar PollAnswerResults = function PollAnswerResults(_ref) {\n var error = _ref.error,\n loading = _ref.loading,\n text = _ref.text,\n totalVotes = _ref.totalVotes,\n votes = _ref.votes;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('
|
290 |
|
291 |
/***/ }),
|
292 |
|
@@ -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 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 }, '
|
302 |
|
303 |
/***/ }),
|
304 |
|
@@ -310,7 +310,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
310 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
311 |
|
312 |
"use strict";
|
313 |
-
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\n\n/**\n * External dependencies\n */\n\n\nvar ErrorBanner = function ErrorBanner(_ref) {\n var children = _ref.children;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"
|
314 |
|
315 |
/***/ }),
|
316 |
|
@@ -322,7 +322,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
322 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
323 |
|
324 |
"use strict";
|
325 |
-
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 lib_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * Internal dependencies\n */\n\n\nvar FooterBranding = function FooterBranding(_ref) {\n var showLogo = _ref.showLogo;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"
|
326 |
|
327 |
/***/ }),
|
328 |
|
@@ -334,7 +334,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
334 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
335 |
|
336 |
"use strict";
|
337 |
-
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 prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var data_hooks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! data/hooks */ \"./client/data/hooks/index.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _answer_results__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./answer-results */ \"./client/components/poll/answer-results.js\");\n/* harmony import */ var _footer_branding__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./footer-branding */ \"./client/components/poll/footer-branding.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./util */ \"./client/components/poll/util.js\");\n\n\n/**\n * External dependencies\n */\n\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\nvar PollResults = function PollResults(_ref) {\n var answers = _ref.answers,\n pollIdFromApi = _ref.pollIdFromApi,\n setErrorMessage = _ref.setErrorMessage,\n hideBranding = _ref.hideBranding;\n\n var _usePollResults = Object(data_hooks__WEBPACK_IMPORTED_MODULE_5__[\"usePollResults\"])(pollIdFromApi),\n error = _usePollResults.error,\n loading = _usePollResults.loading,\n results = _usePollResults.results;\n\n Object(react__WEBPACK_IMPORTED_MODULE_1__[\"useEffect\"])(function () {\n setErrorMessage(error ? Object(lib_i18n__WEBPACK_IMPORTED_MODULE_6__[\"__\"])(\"Unfortunately, we're having some trouble retrieving \" + \"the results for this poll at this time.\") : '');\n }, [error]);\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('
|
338 |
|
339 |
/***/ }),
|
340 |
|
@@ -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 h3Node = node.querySelector('h3');\n var wideContentNode = node.querySelector('.alignwide');\n
|
350 |
|
351 |
/***/ }),
|
352 |
|
@@ -378,11 +378,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
378 |
/*!********************************************************!*\
|
379 |
!*** ./client/components/with-fallback-styles/util.js ***!
|
380 |
\********************************************************/
|
381 |
-
/*! exports provided: getBackgroundColor */
|
382 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
383 |
|
384 |
"use strict";
|
385 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBackgroundColor\", function() { return getBackgroundColor; });\n/**\n * Traverses the parent chain of the given node to get a 'best guess' of\n * what the background color is if the provided node has a transparent background.\n * Algorithm for traversing parent chain \"borrowed\" from\n * https://github.com/WordPress/gutenberg/blob/0c6e369/packages/block-editor/src/components/colors/use-colors.js#L201-L216\n *\n * @param {Element} backgroundColorNode The element to check for background color\n * @return {string} The background colour of the node\n */\nvar getBackgroundColor = function getBackgroundColor(backgroundColorNode) {\n var backgroundColor = window.getComputedStyle(backgroundColorNode).backgroundColor;\n\n while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === window.Node.ELEMENT_NODE) {\n backgroundColorNode = backgroundColorNode.parentNode;\n backgroundColor = window.getComputedStyle(backgroundColorNode).backgroundColor;\n }\n\n return backgroundColor;\n};\n\n//# sourceURL=webpack:///./client/components/with-fallback-styles/util.js?");
|
386 |
|
387 |
/***/ }),
|
388 |
|
@@ -1036,6 +1036,17 @@ eval("(function() { module.exports = this[\"wp\"][\"components\"]; }());\n\n//#
|
|
1036 |
|
1037 |
/***/ }),
|
1038 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1039 |
/***/ "@wordpress/data":
|
1040 |
/*!***************************************!*\
|
1041 |
!*** external {"this":["wp","data"]} ***!
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
96 |
"use strict";
|
97 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/**\n * Internal dependencies\n */\n\n\n/*\n * Note: Any changes made to the attributes definition need to be duplicated in\n * Crowdsignal_Forms\\Frontend\\Blocks\\Crowdsignal_Forms_Poll_Block::attributes()\n * inside includes/frontend/blocks/class-crowdsignal-forms-poll-block.php.\n */\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n pollId: {\n type: 'string',\n default: null\n },\n isMultipleChoice: {\n type: 'boolean',\n default: false\n },\n title: {\n type: 'string',\n default: null\n },\n question: {\n type: 'string',\n default: ''\n },\n note: {\n type: 'string',\n default: ''\n },\n answers: {\n type: 'array',\n default: [{}, {}, {}],\n items: {\n type: 'object',\n properties: {\n answerId: {\n type: 'string',\n default: null\n },\n text: {\n type: 'string',\n default: ''\n }\n }\n }\n },\n submitButtonLabel: {\n type: 'string',\n default: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_1__[\"__\"])('Submit')\n },\n submitButtonTextColor: {\n type: 'string'\n },\n submitButtonBackgroundColor: {\n type: 'string'\n },\n confirmMessageType: {\n type: 'string',\n default: _constants__WEBPACK_IMPORTED_MODULE_0__[\"ConfirmMessageType\"].RESULTS\n },\n customConfirmMessage: {\n type: 'string'\n },\n redirectAddress: {\n type: 'string'\n },\n textColor: {\n type: 'string'\n },\n backgroundColor: {\n type: 'string'\n },\n borderColor: {\n type: 'string'\n },\n borderWidth: {\n type: 'number',\n default: 2\n },\n borderRadius: {\n type: 'number',\n default: 0\n },\n hasBoxShadow: {\n type: 'boolean',\n default: false\n },\n fontFamily: {\n type: 'string',\n default: _constants__WEBPACK_IMPORTED_MODULE_0__[\"FontFamilyType\"].THEME_DEFAULT\n },\n hasOneResponsePerComputer: {\n type: 'boolean',\n default: false\n },\n randomizeAnswers: {\n type: 'boolean',\n default: false\n },\n align: {\n type: 'string'\n },\n width: {\n type: 'number',\n default: 100\n },\n pollStatus: {\n type: 'string',\n default: _constants__WEBPACK_IMPORTED_MODULE_0__[\"PollStatus\"].OPEN\n },\n closedPollState: {\n type: 'string',\n default: _constants__WEBPACK_IMPORTED_MODULE_0__[\"ClosedPollState\"].SHOW_RESULTS\n },\n closedAfterDateTime: {\n type: 'string',\n default: null\n },\n hideBranding: {\n type: 'boolean',\n default: false\n },\n buttonAlignment: {\n type: 'string',\n default: _constants__WEBPACK_IMPORTED_MODULE_0__[\"ButtonAlignment\"].LIST\n }\n});\n\n//# sourceURL=webpack:///./client/blocks/poll/attributes.js?");
|
98 |
|
99 |
/***/ }),
|
100 |
|
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: \"crowdsignal-forms__connect-to-crowdsignal\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(\"div\", {\n className: \"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: \"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: \"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, AnswerStyle, ButtonAlignment */
|
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 export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnswerStyle\", function() { return AnswerStyle; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ButtonAlignment\", function() { return ButtonAlignment; });\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});\nvar AnswerStyle = Object.freeze({\n RADIO: 'radio',\n BUTTON: 'button'\n});\nvar ButtonAlignment = Object.freeze({\n LIST: 'list',\n INLINE: 'inline'\n});\n\n//# sourceURL=webpack:///./client/blocks/poll/constants.js?");
|
122 |
|
123 |
/***/ }),
|
124 |
|
130 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
131 |
|
132 |
"use strict";
|
133 |
+
eval("__webpack_require__.r(__webpack_exports__);\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 _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/block-editor */ \"@wordpress/block-editor\");\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__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 lib_i18n__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\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_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\n/**\n * WordPress dependencies\n */\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\nvar EditAnswer = function EditAnswer(_ref) {\n var answer = _ref.answer,\n answerStyle = _ref.answerStyle,\n index = _ref.index,\n isMultipleChoice = _ref.isMultipleChoice,\n onChange = _ref.onChange,\n onDelete = _ref.onDelete,\n onNewAnswer = _ref.onNewAnswer,\n disabled = _ref.disabled;\n\n var handleChangeText = function handleChangeText(text) {\n return onChange(index, _objectSpread({}, answer, {\n text: text\n }));\n };\n\n var handleDelete = function handleDelete() {\n return onDelete(index);\n };\n\n var handleSplit = function handleSplit() {\n return onNewAnswer(index + 1);\n };\n\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('crowdsignal-forms-poll__answer', {\n 'is-multiple-choice': isMultipleChoice,\n 'is-button': _constants__WEBPACK_IMPORTED_MODULE_8__[\"AnswerStyle\"].BUTTON === answerStyle\n });\n\n var renderRadioAnswers = function renderRadioAnswers() {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"span\", {\n className: \"crowdsignal-forms-poll__check\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__answer-label-wrapper\"\n }, !disabled ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__[\"RichText\"], {\n className: \"crowdsignal-forms-poll__answer-label\",\n tagName: \"span\",\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Enter an answer'),\n multiline: false,\n preserveWhiteSpace: false,\n onChange: handleChangeText,\n onSplit: handleSplit,\n onReplace: lodash__WEBPACK_IMPORTED_MODULE_4__[\"noop\"],\n onRemove: handleDelete,\n value: answer.text,\n allowedFormats: [],\n withoutInteractiveFormatting: true\n }) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"span\", {\n className: \"crowdsignal-forms-poll__answer-label\"\n }, answer.text ? Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__[\"decodeEntities\"])(answer.text) : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Enter an answer'))));\n };\n\n var renderButtonAnswers = function renderButtonAnswers() {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"div\", {\n className: \"wp-block-button crowdsignal-forms-poll__block-button\"\n }, !disabled ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__[\"RichText\"], {\n className: \"wp-block-button__link crowdsignal-forms-poll__submit-button\",\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Enter an answer'),\n multiline: false,\n preserveWhiteSpace: false,\n onChange: handleChangeText,\n onSplit: handleSplit,\n onReplace: lodash__WEBPACK_IMPORTED_MODULE_4__[\"noop\"],\n onRemove: handleDelete,\n value: answer.text,\n allowedFormats: [],\n withoutInteractiveFormatting: true,\n keepPlaceholderOnFocus: true\n }) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"div\", {\n className: \"wp-block-button__link crowdsignal-forms-poll__submit-button\"\n }, answer.text ? Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__[\"decodeEntities\"])(answer.text) : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Enter an answer')));\n };\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"div\", {\n className: classes\n }, _constants__WEBPACK_IMPORTED_MODULE_8__[\"AnswerStyle\"].RADIO === answerStyle && renderRadioAnswers(), _constants__WEBPACK_IMPORTED_MODULE_8__[\"AnswerStyle\"].BUTTON === answerStyle && renderButtonAnswers());\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (EditAnswer);\n\n//# sourceURL=webpack:///./client/blocks/poll/edit-answer.js?");
|
134 |
|
135 |
/***/ }),
|
136 |
|
142 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
143 |
|
144 |
"use strict";
|
145 |
+
eval("__webpack_require__.r(__webpack_exports__);\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 _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/block-editor */ \"@wordpress/block-editor\");\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _edit_answer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./edit-answer */ \"./client/blocks/poll/edit-answer.js\");\n/* harmony import */ var components_poll_util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! components/poll/util */ \"./client/components/poll/util.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n\n\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\nvar shiftAnswerFocus = function shiftAnswerFocus(wrapper, index) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"tap\"])(wrapper.querySelectorAll('[role=textbox]')[index], function (answer) {\n return answer && answer.focus();\n });\n};\n\nvar EditAnswers = function EditAnswers(_ref) {\n var attributes = _ref.attributes,\n isSelected = _ref.isSelected,\n setAttributes = _ref.setAttributes,\n disabled = _ref.disabled,\n answerStyle = _ref.answerStyle,\n buttonAlignment = _ref.buttonAlignment;\n var answersContainer = Object(react__WEBPACK_IMPORTED_MODULE_2__[\"useRef\"])();\n\n var handleChangeSubmitButtonLabel = function handleChangeSubmitButtonLabel(submitButtonLabel) {\n return setAttributes({\n submitButtonLabel: submitButtonLabel\n });\n };\n\n var handleChangeAnswer = function handleChangeAnswer(index, answer) {\n return setAttributes({\n answers: Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"tap\"])(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(attributes.answers), function (answers) {\n answers[index] = answer;\n })\n });\n };\n\n var handleDeleteAnswer = function handleDeleteAnswer(index) {\n shiftAnswerFocus(answersContainer.current, Math.max(index - 1, 0));\n setAttributes({\n answers: Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"filter\"])(attributes.answers, function (answer) {\n return attributes.answers.length <= 2 || answer !== attributes.answers[index];\n })\n });\n };\n\n var handleNewAnswer = function handleNewAnswer(insertAt) {\n if (insertAt < attributes.answers.length) {\n setAttributes({\n answers: [].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"slice\"])(attributes.answers, 0, insertAt)), [{}], _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"slice\"])(attributes.answers, insertAt, attributes.answers.length)))\n });\n }\n\n shiftAnswerFocus(answersContainer.current, Math.min(insertAt, attributes.answers.length));\n }; // Only show empty answers when the poll block is selected and not disabled\n\n\n var shouldShowAnswer = function shouldShowAnswer(answer) {\n return isSelected && !disabled || !Object(components_poll_util__WEBPACK_IMPORTED_MODULE_7__[\"isAnswerEmpty\"])(answer);\n }; // Rendering n + 1 answers vs a separate placeholder\n // prevents the text field from loosing focus when you start typing a new answer.\n\n\n var editableAnswers = isSelected && Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"last\"])(attributes.answers).text ? [].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(attributes.answers), [{}]) : attributes.answers;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_4___default()({\n 'is-button': _constants__WEBPACK_IMPORTED_MODULE_8__[\"AnswerStyle\"].BUTTON === answerStyle,\n 'is-inline-button-alignment': _constants__WEBPACK_IMPORTED_MODULE_8__[\"ButtonAlignment\"].INLINE === buttonAlignment\n }, 'crowdsignal-forms-poll__options');\n var showSubmitButton = _constants__WEBPACK_IMPORTED_MODULE_8__[\"AnswerStyle\"].RADIO === answerStyle;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"div\", {\n ref: answersContainer,\n className: classes\n }, Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"map\"])(editableAnswers, function (answer, index) {\n return shouldShowAnswer(answer) && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(_edit_answer__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n key: \"poll-answer-\".concat(index),\n answer: answer,\n answerStyle: answerStyle,\n index: index,\n isMultipleChoice: attributes.isMultipleChoice,\n onChange: handleChangeAnswer,\n onDelete: handleDeleteAnswer,\n onNewAnswer: handleNewAnswer,\n disabled: disabled\n });\n })), showSubmitButton && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__actions\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"div\", {\n className: \"wp-block-button crowdsignal-forms-poll__block-button\"\n }, !disabled ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__[\"RichText\"], {\n className: \"wp-block-button__link crowdsignal-forms-poll__submit-button\",\n onChange: handleChangeSubmitButtonLabel,\n value: attributes.submitButtonLabel,\n allowedFormats: []\n }) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"div\", {\n className: \"wp-block-button__link crowdsignal-forms-poll__submit-button\"\n }, attributes.submitButtonLabel))));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (EditAnswers);\n\n//# sourceURL=webpack:///./client/blocks/poll/edit-answers.js?");
|
146 |
|
147 |
/***/ }),
|
148 |
|
154 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
155 |
|
156 |
"use strict";
|
157 |
+
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 lib_i18n__WEBPACK_IMPORTED_MODULE_2__ = __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\nvar EditBar = function EditBar(_ref) {\n var onEditClick = _ref.onEditClick;\n\n var handleEditClick = function handleEditClick() {\n onEditClick();\n };\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__edit-bar\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__edit-bar-message\"\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Warning! This poll is published. Deleting or reordering answers may cause the loss of existing responses.')), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"button\", {\n className: \"crowdsignal-forms-poll__edit-bar-button\",\n onClick: handleEditClick\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Edit')));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (EditBar);\n\n//# sourceURL=webpack:///./client/blocks/poll/edit-bar.js?");
|
158 |
|
159 |
/***/ }),
|
160 |
|
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_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ \"@wordpress/components\");\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/data */ \"@wordpress/data\");\n/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__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 _wordpress_compose__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @wordpress/compose */ \"@wordpress/compose\");\n/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var components_poll_closed_banner__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! components/poll/closed-banner */ \"./client/components/poll/closed-banner.js\");\n/* harmony import */ var components_poll_styles__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! components/poll/styles */ \"./client/components/poll/styles.js\");\n/* harmony import */ var components_poll_results__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! components/poll/results */ \"./client/components/poll/results.js\");\n/* harmony import */ var components_poll_util__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! components/poll/util */ \"./client/components/poll/util.js\");\n/* harmony import */ var components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! components/with-fallback-styles */ \"./client/components/with-fallback-styles/index.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var _edit_answers__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./edit-answers */ \"./client/blocks/poll/edit-answers.js\");\n/* harmony import */ var _sidebar__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./sidebar */ \"./client/blocks/poll/sidebar.js\");\n/* harmony import */ var _toolbar__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./toolbar */ \"./client/blocks/poll/toolbar.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./util */ \"./client/blocks/poll/util.js\");\n/* harmony import */ var components_poll_error_banner__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! components/poll/error-banner */ \"./client/components/poll/error-banner.js\");\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/index.js\");\n/* harmony import */ var _edit_bar__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./edit-bar */ \"./client/blocks/poll/edit-bar.js\");\n/* harmony import */ var _subscriptions__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./subscriptions */ \"./client/blocks/poll/subscriptions.js\");\n/* harmony import */ var _connect_to_crowdsignal__WEBPACK_IMPORTED_MODULE_26__ = __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\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_25__[\"startSubscriptions\"])();\n\nvar isP2tenberg = function isP2tenberg() {\n return 'p2tenberg' in window;\n};\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_23__[\"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_23__[\"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 addPollClientId = props.addPollClientId,\n removePollClientId = props.removePollClientId;\n Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useEffect\"])(function () {\n if (isP2tenberg()) {\n Object(_subscriptions__WEBPACK_IMPORTED_MODULE_25__[\"startPolling\"])();\n }\n\n if (attributes.pollId) {\n addPollClientId(attributes.pollId);\n }\n\n return function () {\n if (attributes.pollId) {\n removePollClientId(attributes.pollId);\n }\n };\n }, []); // duplicate & same page copy/paste detector/cleaner-upper\n\n Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useEffect\"])(function () {\n if (Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"isEmpty\"])(attributes.pollId)) {\n return;\n }\n\n if (!window.csPolls) {\n window.csPolls = {};\n }\n\n if (!window.csPolls[attributes.pollId]) {\n window.csPolls[attributes.pollId] = [props.clientId];\n } else if (window.csPolls[attributes.pollId].indexOf(props.clientId) > -1) {// clientid already known, ignore.\n } else {\n var answers = Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"map\"])(attributes.answers, function (answer) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"omit\"])(answer, ['answerId']);\n });\n setAttributes({\n pollId: null,\n answers: answers\n });\n }\n }, [attributes.pollId]);\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 pollIsPublished = !Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"isEmpty\"])(pollDataFromApi);\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 handleResize = function handleResize(event, handle, element) {\n if (handle !== 'right' && handle !== 'left') {\n return;\n }\n\n setAttributes({\n width: Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"round\"])(element.offsetWidth / element.parentNode.offsetWidth * 100)\n });\n };\n\n var isResizable = isSelected && attributes.align !== 'full';\n var blockWidth = attributes.align !== 'full' ? \"\".concat(attributes.width, \"%\") : 'auto';\n var isClosed = Object(_util__WEBPACK_IMPORTED_MODULE_21__[\"isPollClosed\"])(attributes.pollStatus, attributes.closedAfterDateTime);\n var showNote = attributes.note || isSelected && isPollEditable;\n var showResults = isClosed && _constants__WEBPACK_IMPORTED_MODULE_17__[\"ClosedPollState\"].SHOW_RESULTS === attributes.closedPollState;\n var isHidden = isClosed && _constants__WEBPACK_IMPORTED_MODULE_17__[\"ClosedPollState\"].HIDDEN === attributes.closedPollState;\n var hideBranding = true; // hide branding in editor for now\n\n Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useEffect\"])(function () {\n return setIsPollEditable(!pollIsPublished);\n }, [isSelected]);\n Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useEffect\"])(function () {\n if (isSelected) {\n Object(_util__WEBPACK_IMPORTED_MODULE_21__[\"toggleButtonStyleAvailability\"])(!attributes.isMultipleChoice);\n }\n }, [attributes.isMultipleChoice, isSelected]);\n var showEditBar = isSelected && pollIsPublished && !isPollEditable;\n var answerStyle = Object(_util__WEBPACK_IMPORTED_MODULE_21__[\"getAnswerStyle\"])(attributes, className);\n\n if (attributes.fontFamily) {\n Object(components_poll_util__WEBPACK_IMPORTED_MODULE_14__[\"loadCustomFont\"])(attributes.fontFamily);\n }\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_connect_to_crowdsignal__WEBPACK_IMPORTED_MODULE_26__[\"default\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_toolbar__WEBPACK_IMPORTED_MODULE_20__[\"default\"], props), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_sidebar__WEBPACK_IMPORTED_MODULE_19__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, props, {\n viewResultsUrl: viewResultsUrl\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__[\"ResizableBox\"], {\n className: \"crowdsignal-forms-poll__resize-wrapper\",\n size: {\n height: 'auto',\n width: blockWidth\n },\n minWidth: \"25%\",\n maxWidth: \"100%\",\n enable: {\n left: true,\n right: true\n },\n onResizeStop: handleResize,\n showHandle: isResizable,\n resizeRatio: 2\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: Object(_util__WEBPACK_IMPORTED_MODULE_21__[\"getBlockCssClasses\"])(attributes, className, {\n 'is-selected-in-editor': isSelected,\n 'is-closed': isClosed,\n 'is-hidden': isHidden\n }, 'crowdsignal-forms-poll'),\n style: Object(_util__WEBPACK_IMPORTED_MODULE_21__[\"getStyleVars\"])(attributes, fallbackStyles)\n }, showEditBar && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_edit_bar__WEBPACK_IMPORTED_MODULE_24__[\"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_22__[\"default\"], null, errorMessage), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"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: \"crowdsignal-forms-poll__question\",\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_16__[\"__\"])('Enter your question'),\n onChange: handleChangeQuestion,\n value: attributes.question,\n allowedFormats: []\n }) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"h3\", {\n className: \"crowdsignal-forms-poll__question\"\n }, attributes.question ? Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_9__[\"decodeEntities\"])(attributes.question) : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_16__[\"__\"])('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: \"crowdsignal-forms-poll__note\",\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_16__[\"__\"])('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: \"crowdsignal-forms-poll__note\"\n }, attributes.note ? Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_9__[\"decodeEntities\"])(attributes.note) : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_16__[\"__\"])('Add a note (optional)'))), !showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_edit_answers__WEBPACK_IMPORTED_MODULE_18__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, props, {\n setAttributes: setAttributes,\n disabled: !isPollEditable,\n answerStyle: answerStyle,\n buttonAlignment: attributes.buttonAlignment\n })), showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(components_poll_results__WEBPACK_IMPORTED_MODULE_13__[\"default\"], {\n answers: Object(components_poll_util__WEBPACK_IMPORTED_MODULE_14__[\"addApiAnswerIds\"])(Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"filter\"])(attributes.answers, function (answer) {\n return !Object(components_poll_util__WEBPACK_IMPORTED_MODULE_14__[\"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_11__[\"default\"], {\n isPollHidden: isHidden,\n isPollClosed: isClosed\n }), renderStyleProbe())));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_10__[\"compose\"])([Object(components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_15__[\"withFallbackStyles\"])(components_poll_styles__WEBPACK_IMPORTED_MODULE_12__[\"PollStyles\"], components_poll_styles__WEBPACK_IMPORTED_MODULE_12__[\"getPollStyles\"]), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_8__[\"withSelect\"])(function (select, ownProps) {\n var _select = select('crowdsignal-forms/polls'),\n getPollDataByClientId = _select.getPollDataByClientId,\n shouldTryFetchingPollData = _select.shouldTryFetchingPollData,\n isFetchingPollData = _select.isFetchingPollData;\n\n var attributes = ownProps.attributes;\n var pollDataFromApi = attributes.pollId ? getPollDataByClientId(attributes.pollId) : null;\n return {\n pollDataFromApi: pollDataFromApi,\n getPollDataByClientId: getPollDataByClientId,\n shouldTryFetchingPollData: shouldTryFetchingPollData,\n isFetchingPollData: isFetchingPollData\n };\n}), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_8__[\"withDispatch\"])(function (dispatch) {\n var _dispatch = dispatch('crowdsignal-forms/polls'),\n setTryFetchPollData = _dispatch.setTryFetchPollData,\n setPollApiDataForClientId = _dispatch.setPollApiDataForClientId,\n setIsFetchingPollData = _dispatch.setIsFetchingPollData,\n addPollClientId = _dispatch.addPollClientId,\n removePollClientId = _dispatch.removePollClientId;\n\n return {\n setTryFetchPollData: setTryFetchPollData,\n setPollApiDataForClientId: setPollApiDataForClientId,\n setIsFetchingPollData: setIsFetchingPollData,\n addPollClientId: addPollClientId,\n removePollClientId: removePollClientId\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 styles: [{\n name: 'default',\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Default'),\n isDefault: true\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 _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ \"@wordpress/components\");\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ \"@wordpress/block-editor\");\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./util */ \"./client/blocks/poll/util.js\");\n\n\n/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\n\n\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\nvar SideBar = function SideBar(_ref) {\n var _attributes$title;\n\n var attributes = _ref.attributes,\n className = _ref.className,\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_4__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_6__[\"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_4__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_6__[\"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_4__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_6__[\"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_6__[\"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_4__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_6__[\"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 handleChangeButtonAlignment = function handleChangeButtonAlignment(buttonAlignment) {\n return setAttributes({\n buttonAlignment: buttonAlignment\n });\n };\n\n var handleChangeWidth = function handleChangeWidth(width) {\n return setAttributes({\n width: parseInt(width, 10)\n });\n };\n\n var handleResetWidth = function handleResetWidth() {\n return setAttributes({\n width: 100\n });\n };\n\n var resultsLinkEnabled = '' !== viewResultsUrl;\n var answerStyle = Object(_util__WEBPACK_IMPORTED_MODULE_8__[\"getAnswerStyle\"])(attributes, className);\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__[\"InspectorControls\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Results'),\n initialOpen: true\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null, resultsLinkEnabled ? Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Manage results on ') : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Publish this post to enable results on '), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"ExternalLink\"], {\n href: resultsLinkEnabled ? viewResultsUrl : 'https://www.crowdsignal.com'\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_2__[\"Button\"], {\n href: viewResultsUrl,\n isSecondary: true,\n target: \"_blank\",\n disabled: !resultsLinkEnabled\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('View results'))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"TextControl\"], {\n value: Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_5__[\"decodeEntities\"])((_attributes$title = attributes.title) !== null && _attributes$title !== void 0 ? _attributes$title : attributes.question),\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Title of the poll block'),\n onChange: handleChangeTitle\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Confirmation message'),\n initialOpen: false\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"SelectControl\"], {\n value: attributes.confirmMessageType,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('On submission'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Show results'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"ConfirmMessageType\"].RESULTS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Show \"Thank You\" message'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"ConfirmMessageType\"].THANK_YOU\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Show a custom text message'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"ConfirmMessageType\"].CUSTOM_TEXT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Redirect to another webpage'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"ConfirmMessageType\"].REDIRECT\n }],\n onChange: handleChangeConfirmMessageType\n }), _constants__WEBPACK_IMPORTED_MODULE_6__[\"ConfirmMessageType\"].CUSTOM_TEXT === attributes.confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"TextareaControl\"], {\n value: attributes.customConfirmMessage,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Message text'),\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Thanks for voting!'),\n onChange: handleChangeCustomConfirmMessage\n }), _constants__WEBPACK_IMPORTED_MODULE_6__[\"ConfirmMessageType\"].REDIRECT === attributes.confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__[\"URLInput\"], {\n className: \"crowdsignal-forms__redirect-url\",\n value: attributes.redirectAddress,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Redirect address'),\n onChange: handleChangeRedirectAddress\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Poll status'),\n initialOpen: false\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"SelectControl\"], {\n value: attributes.pollStatus,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Currently'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Open'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"PollStatus\"].OPEN\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Closed after'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"PollStatus\"].CLOSED_AFTER\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Closed'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"PollStatus\"].CLOSED\n }],\n onChange: handleChangePollStatus\n }), _constants__WEBPACK_IMPORTED_MODULE_6__[\"PollStatus\"].CLOSED_AFTER === attributes.pollStatus && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"TimePicker\"], {\n currentTime: attributes.closedAfterDateTime,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Close poll on'),\n onChange: handleChangeCloseAfterDateTime,\n is12Hour: true\n }), _constants__WEBPACK_IMPORTED_MODULE_6__[\"PollStatus\"].OPEN !== attributes.pollStatus && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"SelectControl\"], {\n value: attributes.closedPollState,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('When poll is closed'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Show results'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"ClosedPollState\"].SHOW_RESULTS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Show poll with \"Closed\" banner'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"ClosedPollState\"].SHOW_CLOSED_BANNER\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Hide poll'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"ClosedPollState\"].HIDDEN\n }],\n onChange: handleChangeClosedPollState\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__[\"PanelColorSettings\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Block styling'),\n initialOpen: false,\n colorSettings: [{\n value: attributes.textColor,\n onChange: handleChangeTextColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Text color')\n }, {\n value: attributes.backgroundColor,\n onChange: handleChangeBackgroundColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Background color')\n }, {\n value: attributes.borderColor,\n onChange: handleChangeBorderColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Border color')\n }]\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__[\"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_2__[\"SelectControl\"], {\n value: attributes.fontFamily,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Choose font'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Default theme font'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].THEME_DEFAULT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Alegreya Sans'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].ALEGREYA_SANS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Arial'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].ARIAL\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Cabin'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].CABIN\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Chivo'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].CHIVO\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Courier'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].COURIER\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Fira Sans'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].FIRA_SANS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Georgia'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].GEORGIA\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Impact'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].IMPACT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Josefin Sans'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].JOSEFIN_SANS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Lato'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].LATO\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Libre Franklin'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].LIBRE_FRANKLIN\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Lucida'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].LUCIDA\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Montserrat'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].MONTSERRAT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Nunito'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].NUNITO\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Open Sans'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].OPEN_SANS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Oswald'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].OSWALD\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Overpass'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].OVERPASS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Palatino'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].PALATINO\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Poppins'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].POPPINS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Raleway'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].RALEWAY\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Roboto'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].ROBOTO\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Rubik'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].RUBIK\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Tahoma'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].TAHOMA\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Times New Roman'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].TIMES_NEW_ROMAN\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Trebuchet'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].TREBUCHET\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Verdana'),\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"FontFamilyType\"].VERDANA\n }],\n onChange: handleChangeFontFamily\n }), attributes.align !== 'full' && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms__row\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"TextControl\"], {\n type: \"number\",\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Width (%)'),\n value: attributes.width,\n onChange: handleChangeWidth\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"Button\"], {\n isSmall: true,\n className: \"crowdsignal-forms__reset-width-button\",\n onClick: handleResetWidth\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Reset'))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms__row\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"TextControl\"], {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Border thickness'),\n value: attributes.borderWidth,\n onChange: handleChangeBorderWidth,\n type: \"number\",\n className: \"crowdsignal-forms__small-text-input\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"TextControl\"], {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Corner radius'),\n value: attributes.borderRadius,\n onChange: handleChangeBorderRadius,\n type: \"number\",\n className: \"crowdsignal-forms__small-text-input\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"ToggleControl\"], {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Drop shadow'),\n checked: attributes.hasBoxShadow,\n onChange: handleChangeHasBoxShadow\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__[\"PanelColorSettings\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Button styling'),\n initialOpen: false,\n colorSettings: [{\n value: attributes.submitButtonTextColor,\n onChange: handleChangeSubmitButtonTextColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Text color')\n }, {\n value: attributes.submitButtonBackgroundColor,\n onChange: handleChangeSubmitButtonBackgroundColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Background color')\n }]\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__[\"ContrastChecker\"], {\n textColor: attributes.submitButtonTextColor,\n backgroundColor: attributes.submitButtonBackgroundColor,\n fallbackBackgroundColor: fallbackSubmitButtonBackgroundColor,\n fallbackTextColor: fallbackSubmitButtonTextColor\n }), _constants__WEBPACK_IMPORTED_MODULE_6__[\"AnswerStyle\"].BUTTON === answerStyle && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"SelectControl\"], {\n value: attributes.buttonAlignment,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Alignment'),\n options: [{\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"ButtonAlignment\"].LIST,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('List')\n }, {\n value: _constants__WEBPACK_IMPORTED_MODULE_6__[\"ButtonAlignment\"].INLINE,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Inline')\n }],\n onChange: handleChangeButtonAlignment\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Answer settings'),\n initialOpen: true\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"CheckboxControl\"], {\n checked: attributes.hasOneResponsePerComputer,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('One response per computer'),\n onChange: handleChangeHasOneResponsePerComputer\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__[\"CheckboxControl\"], {\n checked: attributes.randomizeAnswers,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('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 |
|
202 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
203 |
|
204 |
"use strict";
|
205 |
+
eval("__webpack_require__.r(__webpack_exports__);\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 _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 _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/data */ \"@wordpress/data\");\n/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);\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 * wordpress dependencies\n */\n\n\n/**\n * Module Constants\n */\n\nvar MODULE_KEY = 'crowdsignal-forms/polls';\nvar SET_TRY_FETCH = 'SET_TRY_FETCH';\nvar IS_FETCHING = 'IS_FETCHING';\nvar SET_POLL = 'SET_POLL';\nvar ADD_POLL_CLIENT_ID = 'ADD_POLL_CLIENT_ID';\nvar REMOVE_POLL_CLIENT_ID = 'REMOVE_POLL_CLIENT_ID';\nvar DEFAULT_STATE = {\n tryFetch: false,\n isFetching: false,\n pollsByClientId: {},\n pollClientIds: []\n};\nvar actions = {\n setTryFetchPollData: function setTryFetchPollData(tryFetch) {\n return {\n type: SET_TRY_FETCH,\n tryFetch: tryFetch\n };\n },\n setIsFetchingPollData: function setIsFetchingPollData(isFetching) {\n return {\n type: IS_FETCHING,\n isFetching: isFetching\n };\n },\n setPollApiDataForClientId: function setPollApiDataForClientId(clientId, pollData) {\n return {\n type: SET_POLL,\n clientId: clientId,\n pollData: pollData\n };\n },\n addPollClientId: function addPollClientId(clientId) {\n return {\n type: ADD_POLL_CLIENT_ID,\n clientId: clientId\n };\n },\n removePollClientId: function removePollClientId(clientId) {\n return {\n type: REMOVE_POLL_CLIENT_ID,\n clientId: clientId\n };\n }\n};\nvar store = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__[\"registerStore\"])(MODULE_KEY, {\n reducer: function reducer() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_STATE;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n\n switch (action.type) {\n case SET_TRY_FETCH:\n return _objectSpread({}, state, {\n tryFetch: !!action.tryFetch\n });\n\n case IS_FETCHING:\n return _objectSpread({}, state, {\n isFetching: !!action.isFetching\n });\n\n case SET_POLL:\n return _objectSpread({}, state, {\n pollsByClientId: _objectSpread({}, state.pollsByClientId, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default()({}, action.clientId, action.pollData))\n });\n\n case ADD_POLL_CLIENT_ID:\n return _objectSpread({}, state, {\n pollClientIds: state.pollClientIds.indexOf(action.clientId) < 0 ? [].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(state.pollClientIds), [action.clientId]) : state.pollClientIds\n });\n\n case REMOVE_POLL_CLIENT_ID:\n return _objectSpread({}, state, {\n pollClientIds: Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"filter\"])(state.pollClientIds, function (clientId) {\n return clientId !== action.clientId;\n })\n });\n\n default:\n return state;\n }\n },\n actions: actions,\n selectors: {\n shouldTryFetchingPollData: function shouldTryFetchingPollData(state) {\n return !!state.tryFetch;\n },\n getPollDataByClientId: function getPollDataByClientId(state, clientId) {\n return state.pollsByClientId[clientId] || null;\n },\n getPollClientIds: function getPollClientIds(state) {\n return state.pollClientIds;\n },\n isFetchingPollData: function isFetchingPollData(state) {\n return !!state.isFetching;\n }\n },\n controls: {},\n resolvers: {}\n});\n/* harmony default export */ __webpack_exports__[\"default\"] = (store);\n\n//# sourceURL=webpack:///./client/blocks/poll/store.js?");
|
206 |
|
207 |
/***/ }),
|
208 |
|
210 |
/*!*********************************************!*\
|
211 |
!*** ./client/blocks/poll/subscriptions.js ***!
|
212 |
\*********************************************/
|
213 |
+
/*! exports provided: startPolling, startSubscriptions */
|
214 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
215 |
|
216 |
"use strict";
|
217 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startPolling\", function() { return startPolling; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startSubscriptions\", function() { return startSubscriptions; });\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 _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ \"@wordpress/data\");\n/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ \"@wordpress/api-fetch\");\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);\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 * WordPress dependencies\n */\n\n\n\n\nvar isPollBlock = function isPollBlock(block) {\n return block.name === 'crowdsignal-forms/poll';\n};\n\nvar subsStarted = false;\nvar pollingStarted = false;\nvar startPolling = function startPolling() {\n if (pollingStarted) {\n return;\n }\n\n pollingStarted = true;\n var lastInterval = null;\n\n var scheduleNextTick = function scheduleNextTick() {\n if (null !== lastInterval) {\n clearTimeout(lastInterval);\n }\n\n lastInterval = setTimeout(function () {\n return tick();\n }, 1000 + Math.random() * 1000);\n };\n\n var tick = function tick() {\n var _select = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__[\"select\"])('crowdsignal-forms/polls'),\n getPollClientIds = _select.getPollClientIds,\n getPollDataByClientId = _select.getPollDataByClientId,\n shouldTryFetchingPollData = _select.shouldTryFetchingPollData,\n isFetchingPollData = _select.isFetchingPollData;\n\n var pollsWithNoApiData = Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"filter\"])(getPollClientIds(), function (clientId) {\n return null === getPollDataByClientId(clientId);\n });\n\n if (pollsWithNoApiData.length < 1) {\n return scheduleNextTick();\n }\n\n var _dispatch = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__[\"dispatch\"])('crowdsignal-forms/polls'),\n setTryFetchPollData = _dispatch.setTryFetchPollData,\n setPollApiDataForClientId = _dispatch.setPollApiDataForClientId,\n setIsFetchingPollData = _dispatch.setIsFetchingPollData;\n\n if (!shouldTryFetchingPollData()) {\n setTryFetchPollData(true);\n } else if (!isFetchingPollData()) {\n setIsFetchingPollData(true);\n Promise.all(Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"map\"])(pollsWithNoApiData, function (clientId) {\n return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({\n path: \"/crowdsignal-forms/v1/polls/\".concat(clientId, \"?cached=1\"),\n method: 'GET'\n }).then(function (response) {\n return setPollApiDataForClientId(clientId, _objectSpread({}, response, {\n viewResultsUrl: \"https://app.crowdsignal.com/polls/\".concat(response.id, \"/results\")\n }));\n }, function () {\n return setPollApiDataForClientId(clientId, null);\n });\n })).finally(function () {\n return setIsFetchingPollData(false);\n });\n }\n\n return scheduleNextTick();\n };\n\n tick();\n};\nvar startSubscriptions = function startSubscriptions() {\n if (subsStarted) {\n return;\n }\n\n subsStarted = true;\n\n var _select2 = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__[\"select\"])('core/editor'),\n isEditedPostDirty = _select2.isEditedPostDirty,\n isEditedPostNew = _select2.isEditedPostNew,\n isSavingPost = _select2.isSavingPost,\n isCleanNewPost = _select2.isCleanNewPost,\n getCurrentPostId = _select2.getCurrentPostId;\n\n var _dispatch2 = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__[\"dispatch\"])('crowdsignal-forms/polls'),\n setTryFetchPollData = _dispatch2.setTryFetchPollData,\n setPollApiDataForClientId = _dispatch2.setPollApiDataForClientId,\n setIsFetchingPollData = _dispatch2.setIsFetchingPollData;\n\n var _select3 = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__[\"select\"])('crowdsignal-forms/polls'),\n shouldTryFetchingPollData = _select3.shouldTryFetchingPollData,\n getPollDataByClientId = _select3.getPollDataByClientId,\n isFetchingPollData = _select3.isFetchingPollData;\n\n Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__[\"subscribe\"])(function () {\n var pollBlocks = Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"filter\"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__[\"select\"])('core/block-editor').getBlocks(), isPollBlock);\n\n if (pollBlocks.length < 1) {\n return;\n }\n\n if (isFetchingPollData()) {\n return;\n }\n\n if (isCleanNewPost() || isEditedPostNew() || isSavingPost() || isEditedPostDirty()) {\n return;\n }\n\n var postId = getCurrentPostId();\n\n if (!postId) {\n return;\n }\n\n var pollsThatAreNotFetched = Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"filter\"])(pollBlocks, function (_ref) {\n var attributes = _ref.attributes;\n return attributes.pollId && null === getPollDataByClientId(attributes.pollId);\n });\n\n if (pollsThatAreNotFetched.length < 1) {\n return;\n }\n\n if (!shouldTryFetchingPollData()) {\n setTryFetchPollData(true);\n } else if (!isFetchingPollData()) {\n setIsFetchingPollData(true);\n Promise.all(Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"map\"])(pollsThatAreNotFetched, function (pollBlock) {\n var pollId = pollBlock.attributes.pollId;\n return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({\n path: \"/crowdsignal-forms/v1/polls/\".concat(pollId, \"?cached=1\"),\n method: 'GET'\n }).then(function (response) {\n return setPollApiDataForClientId(pollId, _objectSpread({}, response, {\n viewResultsUrl: \"https://app.crowdsignal.com/polls/\".concat(response.id, \"/results\")\n }));\n }, function () {\n return setPollApiDataForClientId(pollId, null);\n });\n })).finally(function () {\n return setIsFetchingPollData(false);\n });\n }\n });\n};\n\n//# sourceURL=webpack:///./client/blocks/poll/subscriptions.js?");
|
218 |
|
219 |
/***/ }),
|
220 |
|
226 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
227 |
|
228 |
"use strict";
|
229 |
+
eval("__webpack_require__.r(__webpack_exports__);\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 _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__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 _wordpress_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/components */ \"@wordpress/components\");\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var components_icon_checklist_multiple_choice__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! components/icon/checklist-multiple-choice */ \"./client/components/icon/checklist-multiple-choice.js\");\n/* harmony import */ var components_icon_checklist_single_choice__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! components/icon/checklist-single-choice */ \"./client/components/icon/checklist-single-choice.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./util */ \"./client/blocks/poll/util.js\");\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_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/**\n * WordPress dependencies\n */\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\nvar multipleChoiceControls = [{\n icon: components_icon_checklist_single_choice__WEBPACK_IMPORTED_MODULE_7__[\"default\"],\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Choose one answer'),\n value: false\n}, {\n icon: components_icon_checklist_multiple_choice__WEBPACK_IMPORTED_MODULE_6__[\"default\"],\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Choose multiple answers'),\n value: true\n}];\n\nvar PollToolbar = function PollToolbar(_ref) {\n var attributes = _ref.attributes,\n setAttributes = _ref.setAttributes;\n var multipleChoiceToolbar = Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"map\"])(multipleChoiceControls, function (button) {\n return _objectSpread({}, button, {\n isActive: button.value === attributes.isMultipleChoice,\n onClick: function onClick() {\n setAttributes({\n isMultipleChoice: button.value\n });\n Object(_util__WEBPACK_IMPORTED_MODULE_9__[\"toggleButtonStyleAvailability\"])(button.value);\n }\n });\n });\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"BlockControls\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__[\"Toolbar\"], {\n controls: multipleChoiceToolbar\n }));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (PollToolbar);\n\n//# sourceURL=webpack:///./client/blocks/poll/toolbar.js?");
|
230 |
|
231 |
/***/ }),
|
232 |
|
234 |
/*!************************************!*\
|
235 |
!*** ./client/blocks/poll/util.js ***!
|
236 |
\************************************/
|
237 |
+
/*! exports provided: addAnswer, getFontFamilyFromType, getStyleVars, extractRGBColorProperties, hexToRGB, getBlockCssClasses, isPollClosed, getAnswerStyle, toggleButtonStyleAvailability */
|
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__, \"getAnswerStyle\", function() { return getAnswerStyle; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"toggleButtonStyleAvailability\", function() { return toggleButtonStyleAvailability; });\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 _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/blocks */ \"@wordpress/blocks\");\n/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_5__ = __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 * Internal dependencies\n */\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_4__[\"FontFamilyType\"], type)) {\n return null;\n }\n\n return _constants__WEBPACK_IMPORTED_MODULE_4__[\"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_4__[\"PollStatus\"].CLOSED === pollStatus) {\n return true;\n }\n\n if (_constants__WEBPACK_IMPORTED_MODULE_4__[\"PollStatus\"].CLOSED_AFTER === pollStatus) {\n var closedAfterDateTime = new Date(closedAfterDateTimeUTC);\n return closedAfterDateTime < currentDateTime;\n }\n\n return false;\n};\n/**\n * Returns the type of answer controls that should be rendered given the current state of the block.\n *\n * @param {*} attributes the poll's attributes.\n * @param {string} className the css class string Gutenberg is passing into the block.\n */\n\nvar getAnswerStyle = function getAnswerStyle(attributes, className) {\n if (attributes.isMultipleChoice) {\n return _constants__WEBPACK_IMPORTED_MODULE_4__[\"AnswerStyle\"].RADIO;\n }\n\n if (!Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"isEmpty\"])(className) && className.indexOf('is-style-buttons') > -1) {\n return _constants__WEBPACK_IMPORTED_MODULE_4__[\"AnswerStyle\"].BUTTON;\n }\n\n return _constants__WEBPACK_IMPORTED_MODULE_4__[\"AnswerStyle\"].RADIO;\n};\n/**\n * Registers or de-registers the `buttons` block style.\n *\n * @param {boolean} enable True if button style should be available, false if not.\n */\n\nvar toggleButtonStyleAvailability = function toggleButtonStyleAvailability(enable) {\n if (enable) {\n Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__[\"registerBlockStyle\"])('crowdsignal-forms/poll', {\n name: 'buttons',\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_5__[\"__\"])('Buttons')\n });\n } else {\n Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__[\"unregisterBlockStyle\"])('crowdsignal-forms/poll', 'buttons');\n }\n};\n\n//# sourceURL=webpack:///./client/blocks/poll/util.js?");
|
242 |
|
243 |
/***/ }),
|
244 |
|
286 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
287 |
|
288 |
"use strict";
|
289 |
+
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 prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * External dependencies\n */\n\n\n\n/**\n * WordPress dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar PollAnswerResults = function PollAnswerResults(_ref) {\n var error = _ref.error,\n loading = _ref.loading,\n text = _ref.text,\n totalVotes = _ref.totalVotes,\n votes = _ref.votes;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('crowdsignal-forms-poll__answer-results', {\n 'is-error': error,\n 'is-loading': loading\n });\n var showResults = !loading && !error;\n var answerShare = 0 === totalVotes ? 0 : votes * 100 / totalVotes;\n var progressBarStyles = {\n width: \"\".concat(parseInt(answerShare, 10), \"%\")\n };\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: classes\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__answer-results-labels\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"crowdsignal-forms-poll__answer-results-answer\"\n }, Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__[\"decodeEntities\"])(text)), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"crowdsignal-forms-poll__answer-results-votes\"\n }, showResults && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_5__[\"sprintf\"])( // translators: %s: Number of votes.\n Object(lib_i18n__WEBPACK_IMPORTED_MODULE_5__[\"_n\"])('%s vote', '%s votes', votes), votes.toLocaleString())), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"crowdsignal-forms-poll__answer-results-percent\"\n }, showResults && \"\".concat(answerShare.toFixed(2), \"%\"))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__answer-results-progress-track\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__answer-results-progress-bar\",\n style: progressBarStyles\n })));\n};\n\nPollAnswerResults.propTypes = {\n loading: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,\n text: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string.isRequired,\n totalVotes: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,\n votes: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (PollAnswerResults);\n\n//# sourceURL=webpack:///./client/components/poll/answer-results.js?");
|
290 |
|
291 |
/***/ }),
|
292 |
|
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 }, '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 |
|
310 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
311 |
|
312 |
"use strict";
|
313 |
+
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\n\n/**\n * External dependencies\n */\n\n\nvar ErrorBanner = function ErrorBanner(_ref) {\n var children = _ref.children;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__error-banner\"\n }, children);\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (ErrorBanner);\n\n//# sourceURL=webpack:///./client/components/poll/error-banner.js?");
|
314 |
|
315 |
/***/ }),
|
316 |
|
322 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
323 |
|
324 |
"use strict";
|
325 |
+
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 lib_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * Internal dependencies\n */\n\n\nvar FooterBranding = function FooterBranding(_ref) {\n var showLogo = _ref.showLogo;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__footer-branding\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"a\", {\n className: \"crowdsignal-forms-poll__footer-cs-link\",\n href: \"https://crowdsignal.com\",\n target: \"_blank\",\n rel: \"noopener noreferrer\"\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_1__[\"__\"])('Create your own poll with Crowdsignal')), showLogo && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"img\", {\n className: \"crowdsignal-forms-poll__footer-branding-logo\",\n src: \"https://app.crowdsignal.com/images/svg/cs-logo-dots.svg\",\n alt: \"Crowdsignal sticker\"\n }));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (FooterBranding);\n\n//# sourceURL=webpack:///./client/components/poll/footer-branding.js?");
|
326 |
|
327 |
/***/ }),
|
328 |
|
334 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
335 |
|
336 |
"use strict";
|
337 |
+
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 prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var data_hooks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! data/hooks */ \"./client/data/hooks/index.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _answer_results__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./answer-results */ \"./client/components/poll/answer-results.js\");\n/* harmony import */ var _footer_branding__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./footer-branding */ \"./client/components/poll/footer-branding.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./util */ \"./client/components/poll/util.js\");\n\n\n/**\n * External dependencies\n */\n\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\nvar PollResults = function PollResults(_ref) {\n var answers = _ref.answers,\n pollIdFromApi = _ref.pollIdFromApi,\n setErrorMessage = _ref.setErrorMessage,\n hideBranding = _ref.hideBranding;\n\n var _usePollResults = Object(data_hooks__WEBPACK_IMPORTED_MODULE_5__[\"usePollResults\"])(pollIdFromApi),\n error = _usePollResults.error,\n loading = _usePollResults.loading,\n results = _usePollResults.results;\n\n Object(react__WEBPACK_IMPORTED_MODULE_1__[\"useEffect\"])(function () {\n setErrorMessage(error ? Object(lib_i18n__WEBPACK_IMPORTED_MODULE_6__[\"__\"])(\"Unfortunately, we're having some trouble retrieving \" + \"the results for this poll at this time.\") : '');\n }, [error]);\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('crowdsignal-forms-poll__results', {\n 'is-error': !!error,\n 'is-loading': loading\n });\n var total = Object(lodash__WEBPACK_IMPORTED_MODULE_4__[\"sum\"])(Object(lodash__WEBPACK_IMPORTED_MODULE_4__[\"values\"])(results));\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: classes\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__results-list\"\n }, Object(lodash__WEBPACK_IMPORTED_MODULE_4__[\"map\"])(answers, function (answer) {\n var _results$answer$answe;\n\n return !Object(_util__WEBPACK_IMPORTED_MODULE_9__[\"isAnswerEmpty\"])(answer) && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_answer_results__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n key: answer.answerId,\n error: !!error,\n loading: loading,\n text: answer.text,\n totalVotes: total,\n votes: results ? (_results$answer$answe = results[answer.answerIdFromApi]) !== null && _results$answer$answe !== void 0 ? _results$answer$answe : 0 : 0\n });\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__results-footer\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"crowdsignal-forms-poll__results-total\"\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_6__[\"sprintf\"])( // translators: %s: Number of votes\n Object(lib_i18n__WEBPACK_IMPORTED_MODULE_6__[\"_n\"])('%s total vote', '%s total votes', total), total ? total.toLocaleString() : 0)), !hideBranding && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_footer_branding__WEBPACK_IMPORTED_MODULE_8__[\"default\"], null)));\n};\n\nPollResults.propTypes = {\n pollIdFromApi: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,\n answers: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.shape({\n answerId: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string.isRequired,\n answerIdFromApi: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,\n text: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string\n })).isRequired,\n setErrorMessage: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.func.isRequired,\n hideBranding: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (PollResults);\n\n//# sourceURL=webpack:///./client/components/poll/results.js?");
|
338 |
|
339 |
/***/ }),
|
340 |
|
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 var accentColor = Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(buttonNode);\n var surfaceColor = Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(textNode);\n var textColor = window.getComputedStyle(textNode).color; // Ensure that we don't end up with the same color for surface and accent.\n // Falls back to button border color, then text color.\n\n if (accentColor === surfaceColor) {\n var borderColor = Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBorderColor\"])(buttonNode);\n accentColor = borderColor ? borderColor : textColor;\n }\n\n return {\n accent: accentColor,\n surface: surfaceColor,\n text: textColor,\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 |
|
378 |
/*!********************************************************!*\
|
379 |
!*** ./client/components/with-fallback-styles/util.js ***!
|
380 |
\********************************************************/
|
381 |
+
/*! exports provided: getBackgroundColor, getBorderColor */
|
382 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
383 |
|
384 |
"use strict";
|
385 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBackgroundColor\", function() { return getBackgroundColor; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBorderColor\", function() { return getBorderColor; });\n/**\n * Traverses the parent chain of the given node to get a 'best guess' of\n * what the background color is if the provided node has a transparent background.\n * Algorithm for traversing parent chain \"borrowed\" from\n * https://github.com/WordPress/gutenberg/blob/0c6e369/packages/block-editor/src/components/colors/use-colors.js#L201-L216\n *\n * @param {Element} backgroundColorNode The element to check for background color\n * @return {string} The background colour of the node\n */\nvar getBackgroundColor = function getBackgroundColor(backgroundColorNode) {\n var backgroundColor = window.getComputedStyle(backgroundColorNode).backgroundColor;\n\n while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === window.Node.ELEMENT_NODE) {\n backgroundColorNode = backgroundColorNode.parentNode;\n backgroundColor = window.getComputedStyle(backgroundColorNode).backgroundColor;\n }\n\n return backgroundColor;\n};\n/**\n * Gets the border color for a node, if it appears valid.\n * If we get '0px' for the width, then we likely don't have a border and return null.\n * We use 'borderBlockStartWidth' because of FF: https://bugzilla.mozilla.org/show_bug.cgi?id=137688\n *\n * @param {Element} borderNode The element to check for a border color\n * @return {string|null} The border colour value of null if invalid\n */\n\nvar getBorderColor = function getBorderColor(borderNode) {\n var borderWidth = window.getComputedStyle(borderNode).borderBlockStartWidth;\n return borderWidth !== '0px' ? window.getComputedStyle(borderNode).borderBlockStartColor : null;\n};\n\n//# sourceURL=webpack:///./client/components/with-fallback-styles/util.js?");
|
386 |
|
387 |
/***/ }),
|
388 |
|
1036 |
|
1037 |
/***/ }),
|
1038 |
|
1039 |
+
/***/ "@wordpress/compose":
|
1040 |
+
/*!******************************************!*\
|
1041 |
+
!*** external {"this":["wp","compose"]} ***!
|
1042 |
+
\******************************************/
|
1043 |
+
/*! no static exports found */
|
1044 |
+
/***/ (function(module, exports) {
|
1045 |
+
|
1046 |
+
eval("(function() { module.exports = this[\"wp\"][\"compose\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22compose%22%5D%7D?");
|
1047 |
+
|
1048 |
+
/***/ }),
|
1049 |
+
|
1050 |
/***/ "@wordpress/data":
|
1051 |
/*!***************************************!*\
|
1052 |
!*** external {"this":["wp","data"]} ***!
|
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-blocks', 'wp-components', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-polyfill'), 'version' => 'b8afb64afe844cebb83d69b53e577f43');
|
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}}.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}
|
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}.crowdsignal-forms-poll{border-color:var(--crowdsignal-forms-border-color);border-style:solid;border-width:var(--crowdsignal-forms-border-width);margin-left:auto;margin-right:auto;margin-top:5px;position:relative;text-align:left}.entry-content .alignfull.crowdsignal-poll-wrapper .crowdsignal-forms-poll{border-left-width:0;border-right-width:0}.crowdsignal-forms-poll h3.crowdsignal-forms-poll__question{margin:0 0 28px}.crowdsignal-forms-poll h3.crowdsignal-forms-poll__question:first-child{margin-top:0}.crowdsignal-forms-poll p.crowdsignal-forms-poll__note{font-style:italic;margin:0 0 32px}.crowdsignal-forms-poll .crowdsignal-forms-poll__content{padding:40px 24px 16px 24px}.crowdsignal-forms-poll .crowdsignal-forms-poll__content .crowdsignal-forms-poll__question{font-family:var(--crowdsignal-forms-question-font-family)}.crowdsignal-forms-poll .crowdsignal-forms-poll__content .crowdsignal-forms-poll__answer-label,.crowdsignal-forms-poll .crowdsignal-forms-poll__content .crowdsignal-forms-poll__answer-results-answer,.crowdsignal-forms-poll .crowdsignal-forms-poll__content .crowdsignal-forms-poll__note{font-family:var(--crowdsignal-forms-body-font-family)}.entry-content .alignfull.crowdsignal-poll-wrapper .crowdsignal-forms-poll .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 .crowdsignal-forms-poll .crowdsignal-forms-poll__content,.alignfull.crowdsignal-poll-wrapper .crowdsignal-forms-poll .crowdsignal-forms-poll__content{padding:80px}}.crowdsignal-forms-poll.is-closed .crowdsignal-forms-poll__form{opacity:0.5}.crowdsignal-forms-poll.is-hidden{opacity:0.5}.crowdsignal-forms-poll.has-text-color{color:var(--crowdsignal-forms-text-color)}.crowdsignal-forms-poll.has-bg-color{background-color:var(--crowdsignal-forms-bg-color)}.crowdsignal-forms-poll.has-border-radius{border-radius:var(--crowdsignal-forms-border-radius);overflow:hidden}.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)}.crowdsignal-forms-poll .is-transparent{opacity:0;pointer-events:none}.crowdsignal-forms-poll__block-button .crowdsignal-forms-poll__submit-button{-webkit-appearance:initial}.crowdsignal-forms-poll__block-button .crowdsignal-forms-poll__submit-button:disabled{opacity:0.7}.crowdsignal-forms-poll.has-submit-button-bg-color .crowdsignal-forms-poll__block-button .crowdsignal-forms-poll__submit-button.wp-block-button__link{background-color:var(--crowdsignal-forms-submit-button-bg-color)}.crowdsignal-forms-poll.has-submit-button-text-color .crowdsignal-forms-poll__block-button .crowdsignal-forms-poll__submit-button.wp-block-button__link{color:var(--crowdsignal-forms-submit-button-text-color)}.crowdsignal-forms-poll__options.is-button{display:flex;flex-direction:column;flex-wrap:wrap}.crowdsignal-forms-poll__options.is-button.is-inline-button-alignment{flex-direction:row}.crowdsignal-forms-poll__answer{cursor:pointer;display:flex;font-size:inherit;font-weight:600;margin:0;padding:0 2px;position:relative}.crowdsignal-forms-poll__answer.is-button{margin-inline-end:20px;margin-block-end:20px;max-width:100%}.crowdsignal-forms-poll__answer.is-button .wp-block-button.crowdsignal-forms-poll__block-button,.crowdsignal-forms-poll__answer.is-button .crowdsignal-forms-poll__submit-button{max-width:100%}.crowdsignal-forms-poll__answer.is-button .crowdsignal-forms-poll__submit-button{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.crowdsignal-forms-poll__answer:not(.is-button){margin-block-end:16px}.crowdsignal-forms-poll__answer:hover,.crowdsignal-forms-poll__answer.is-focused{color:var(--crowdsignal-forms-submit-button-bg-color)}.has-voted .crowdsignal-forms-poll__answer{opacity:0.5}input[type="checkbox"].crowdsignal-forms-poll__input,input[type="radio"].crowdsignal-forms-poll__input{height:0;opacity:0;position:absolute;width:0}.crowdsignal-forms-poll__check{display:inline-block;height:1em;margin:0 10px 0 0;position:relative;width:1em}.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%}.crowdsignal-forms-poll__answer.is-multiple-choice .crowdsignal-forms-poll__check::before{border-radius:3px}.crowdsignal-forms-poll__answer.is-multiple-choice.is-selected .crowdsignal-forms-poll__check::before{border-color:var(--crowdsignal-forms-text-color);background-color:var(--crowdsignal-forms-text-color)}.crowdsignal-forms-poll__answer.is-selected:not(.is-multiple-choice) .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-text-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%}.crowdsignal-forms-poll__answer.is-selected.is-multiple-choice .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.crowdsignal-forms-poll__answer-label-wrapper{flex:1;word-break:break-word}div.crowdsignal-forms-poll__answer-label-wrapper span.crowdsignal-forms-poll__answer-label{line-height:1;vertical-align:top}div.crowdsignal-forms-poll__answer-label-wrapper span.crowdsignal-forms-poll__answer-label span::after{vertical-align:top}.crowdsignal-forms-poll__button{border:0;padding:0}.crowdsignal-forms-poll__actions .wp-block-button,.crowdsignal-forms-poll__options .wp-block-button{margin:0}.crowdsignal-forms-poll__actions{display:flex;justify-content:flex-end}.editor-styles-wrapper .crowdsignal-forms-poll .crowdsignal-forms-poll__actions .wp-block-button.crowdsignal-forms-poll__block-button,.editor-styles-wrapper .crowdsignal-forms-poll .crowdsignal-forms-poll__options .wp-block-button.crowdsignal-forms-poll__block-button{margin:0}.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 .crowdsignal-forms-poll__closed-banner{font-style:italic}.crowdsignal-forms-poll__error{color:red}.crowdsignal-forms-poll__results-list{margin:0 0 1em;position:relative}.crowdsignal-forms-poll__answer-results{display:flex;flex-direction:column;margin:0 0 16px;width:100%}.crowdsignal-forms-poll__answer-results:last-child{margin:0}.crowdsignal-forms-poll__answer-results-labels{align-items:flex-end;display:flex;margin:0 0 8px;width:100%;word-break:break-word}.crowdsignal-forms-poll__answer-results-answer{flex:1;font-size:1em;font-weight:600}.crowdsignal-forms-poll__answer-results-votes{font-size:0.75em;line-height:2}.crowdsignal-forms-poll__answer-results-percent{font-weight:600;line-height:1.6}.crowdsignal-forms-poll__answer-results-votes,.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}.crowdsignal-forms-poll__answer-results.is-error .crowdsignal-forms-poll__answer-results-votes,.crowdsignal-forms-poll__answer-results.is-error .crowdsignal-forms-poll__answer-results-percent{display:none}.crowdsignal-forms-poll__answer-results.is-loading .crowdsignal-forms-poll__answer-results-votes,.crowdsignal-forms-poll__answer-results.is-loading .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}.crowdsignal-forms-poll__answer-results.is-loading .crowdsignal-forms-poll__answer-results-votes:last-child,.crowdsignal-forms-poll__answer-results.is-loading .crowdsignal-forms-poll__answer-results-percent:last-child{width:40px}.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%}.crowdsignal-forms-poll__answer-results.is-loading .crowdsignal-forms-poll__answer-results-progress-track{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse}.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}.crowdsignal-forms-poll__answer-results.is-error .crowdsignal-forms-poll__answer-results-progress-bar{width:0}.crowdsignal-forms-poll__answer-results.is-loading .crowdsignal-forms-poll__answer-results-progress-bar{background-color:var(--crowdsignal-forms-text-color);width:25%}.crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+1) .crowdsignal-forms-poll__answer-results-progress-bar{width:40%}.crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+2) .crowdsignal-forms-poll__answer-results-progress-bar{width:75%}.crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+3) .crowdsignal-forms-poll__answer-results-progress-bar{width:50%}.crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+4) .crowdsignal-forms-poll__answer-results-progress-bar{width:60%}.crowdsignal-forms-poll__results-footer{display:flex;flex-direction:column;justify-content:space-between;width:100%;font-size:0.9em}.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}.crowdsignal-forms-poll__results.is-loading .crowdsignal-forms-poll__results-total{color:transparent}.crowdsignal-forms-poll__results.is-loading .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}.crowdsignal-forms-poll__footer-branding{display:flex;justify-content:space-between;align-items:center;width:100%}.crowdsignal-forms-poll__footer-branding img.crowdsignal-forms-poll__footer-branding-logo{width:50px;height:50px;margin-left:0;margin-right:0}.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}.crowdsignal-forms-poll__footer-cs-link:not(:hover){color:var(--crowdsignal-forms-text-color);opacity:0.4}.has-default-thankyou .crowdsignal-forms-poll__footer-cs-link{color:#333}.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}.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 .crowdsignal-forms-poll__submit-message-container{background-color:#fff}.crowdsignal-forms-poll__submit-message{position:relative}.crowdsignal-forms-poll__submit-message button.crowdsignal-forms-poll__dismiss-submit-message{position:absolute;right:0;top:0;background-color:transparent;color:#000;text-decoration:none;border:none}.crowdsignal-forms-poll__submit-message button.crowdsignal-forms-poll__dismiss-submit-message:hover{background:inherit}.crowdsignal-forms-poll__submit-message-footer{position:absolute;bottom:0;left:0;padding:16px 24px;width:100%;background-color:inherit}.crowdsignal-forms-poll__thank-you-cs-sticker{right:25px;top:66px}.crowdsignal-forms-poll__thank-you-sticker{right:132px;top:12px}.crowdsignal-forms-poll__thank-you-cs-sticker,.crowdsignal-forms-poll__thank-you-sticker{filter:drop-shadow(0 1px 2px rgba(0,0,0,0.2));width:100px;height:100px;position:absolute}.crowdsignal-forms-poll__custom-message-check{color:var(--crowdsignal-forms-text-color);padding-left:24px;padding-top:24px}.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, 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 |
|
@@ -102,11 +102,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
102 |
/*!************************************!*\
|
103 |
!*** ./client/blocks/poll/util.js ***!
|
104 |
\************************************/
|
105 |
-
/*! exports provided: addAnswer, getFontFamilyFromType, getStyleVars, extractRGBColorProperties, hexToRGB, getBlockCssClasses, isPollClosed,
|
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 |
|
@@ -154,7 +154,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
154 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
155 |
|
156 |
"use strict";
|
157 |
-
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 prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * External dependencies\n */\n\n\n\n/**\n * WordPress dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar PollAnswerResults = function PollAnswerResults(_ref) {\n var error = _ref.error,\n loading = _ref.loading,\n text = _ref.text,\n totalVotes = _ref.totalVotes,\n votes = _ref.votes;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('
|
158 |
|
159 |
/***/ }),
|
160 |
|
@@ -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 _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 prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__);\n\n\n/**\n * External dependencies\n */\n\n\n\n/**\n * WordPress dependencies\n */\n\n\n\nvar PollAnswer = function PollAnswer(_ref) {\n var answerIdFromApi = _ref.answerIdFromApi,\n hasVoted = _ref.hasVoted,\n isMultipleChoice = _ref.isMultipleChoice,\n isSelected = _ref.isSelected,\n isVoting = _ref.isVoting,\n isFocused = _ref.isFocused,\n onSelect = _ref.onSelect,\n onFocus = _ref.onFocus,\n text = _ref.text;\n\n var handleSelect = function handleSelect(event) {\n return onSelect(parseInt(event.target.value, 10));\n };\n\n var handleFocus = function handleFocus(event) {\n return onFocus(parseInt(event.target.value, 10));\n };\n\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('
|
170 |
|
171 |
/***/ }),
|
172 |
|
@@ -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 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 }, '
|
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\n\n/**\n * External dependencies\n */\n\n\nvar ErrorBanner = function ErrorBanner(_ref) {\n var children = _ref.children;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"
|
194 |
|
195 |
/***/ }),
|
196 |
|
@@ -202,7 +202,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wor
|
|
202 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
203 |
|
204 |
"use strict";
|
205 |
-
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 lib_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * Internal dependencies\n */\n\n\nvar FooterBranding = function FooterBranding(_ref) {\n var showLogo = _ref.showLogo;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"
|
206 |
|
207 |
/***/ }),
|
208 |
|
@@ -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 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 |
|
@@ -226,7 +226,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab
|
|
226 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
227 |
|
228 |
"use strict";
|
229 |
-
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 prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var data_hooks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! data/hooks */ \"./client/data/hooks/index.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _answer_results__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./answer-results */ \"./client/components/poll/answer-results.js\");\n/* harmony import */ var _footer_branding__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./footer-branding */ \"./client/components/poll/footer-branding.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./util */ \"./client/components/poll/util.js\");\n\n\n/**\n * External dependencies\n */\n\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\nvar PollResults = function PollResults(_ref) {\n var answers = _ref.answers,\n pollIdFromApi = _ref.pollIdFromApi,\n setErrorMessage = _ref.setErrorMessage,\n hideBranding = _ref.hideBranding;\n\n var _usePollResults = Object(data_hooks__WEBPACK_IMPORTED_MODULE_5__[\"usePollResults\"])(pollIdFromApi),\n error = _usePollResults.error,\n loading = _usePollResults.loading,\n results = _usePollResults.results;\n\n Object(react__WEBPACK_IMPORTED_MODULE_1__[\"useEffect\"])(function () {\n setErrorMessage(error ? Object(lib_i18n__WEBPACK_IMPORTED_MODULE_6__[\"__\"])(\"Unfortunately, we're having some trouble retrieving \" + \"the results for this poll at this time.\") : '');\n }, [error]);\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('
|
230 |
|
231 |
/***/ }),
|
232 |
|
@@ -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 h3Node = node.querySelector('h3');\n var wideContentNode = node.querySelector('.alignwide');\n
|
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: \"
|
254 |
|
255 |
/***/ }),
|
256 |
|
@@ -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
|
278 |
|
279 |
/***/ }),
|
280 |
|
@@ -294,11 +294,11 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) *
|
|
294 |
/*!********************************************************!*\
|
295 |
!*** ./client/components/with-fallback-styles/util.js ***!
|
296 |
\********************************************************/
|
297 |
-
/*! exports provided: getBackgroundColor */
|
298 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
299 |
|
300 |
"use strict";
|
301 |
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBackgroundColor\", function() { return getBackgroundColor; });\n/**\n * Traverses the parent chain of the given node to get a 'best guess' of\n * what the background color is if the provided node has a transparent background.\n * Algorithm for traversing parent chain \"borrowed\" from\n * https://github.com/WordPress/gutenberg/blob/0c6e369/packages/block-editor/src/components/colors/use-colors.js#L201-L216\n *\n * @param {Element} backgroundColorNode The element to check for background color\n * @return {string} The background colour of the node\n */\nvar getBackgroundColor = function getBackgroundColor(backgroundColorNode) {\n var backgroundColor = window.getComputedStyle(backgroundColorNode).backgroundColor;\n\n while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === window.Node.ELEMENT_NODE) {\n backgroundColorNode = backgroundColorNode.parentNode;\n backgroundColor = window.getComputedStyle(backgroundColorNode).backgroundColor;\n }\n\n return backgroundColor;\n};\n\n//# sourceURL=webpack:///./client/components/with-fallback-styles/util.js?");
|
302 |
|
303 |
/***/ }),
|
304 |
|
@@ -931,6 +931,17 @@ eval("(function() { module.exports = this[\"wp\"][\"apiFetch\"]; }());\n\n//# so
|
|
931 |
|
932 |
/***/ }),
|
933 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
934 |
/***/ "@wordpress/components":
|
935 |
/*!*********************************************!*\
|
936 |
!*** external {"this":["wp","components"]} ***!
|
90 |
/*!*****************************************!*\
|
91 |
!*** ./client/blocks/poll/constants.js ***!
|
92 |
\*****************************************/
|
93 |
+
/*! exports provided: ConfirmMessageType, FontFamilyType, GoogleFonts, FontFamilyMap, PollStatus, ClosedPollState, ConnectedAccountState, AnswerStyle, ButtonAlignment */
|
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 export (binding) */ __webpack_require__.d(__webpack_exports__, \"AnswerStyle\", function() { return AnswerStyle; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ButtonAlignment\", function() { return ButtonAlignment; });\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});\nvar AnswerStyle = Object.freeze({\n RADIO: 'radio',\n BUTTON: 'button'\n});\nvar ButtonAlignment = Object.freeze({\n LIST: 'list',\n INLINE: 'inline'\n});\n\n//# sourceURL=webpack:///./client/blocks/poll/constants.js?");
|
98 |
|
99 |
/***/ }),
|
100 |
|
102 |
/*!************************************!*\
|
103 |
!*** ./client/blocks/poll/util.js ***!
|
104 |
\************************************/
|
105 |
+
/*! exports provided: addAnswer, getFontFamilyFromType, getStyleVars, extractRGBColorProperties, hexToRGB, getBlockCssClasses, isPollClosed, getAnswerStyle, toggleButtonStyleAvailability */
|
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__, \"getAnswerStyle\", function() { return getAnswerStyle; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"toggleButtonStyleAvailability\", function() { return toggleButtonStyleAvailability; });\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 _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/blocks */ \"@wordpress/blocks\");\n/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_5__ = __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 * Internal dependencies\n */\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_4__[\"FontFamilyType\"], type)) {\n return null;\n }\n\n return _constants__WEBPACK_IMPORTED_MODULE_4__[\"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_4__[\"PollStatus\"].CLOSED === pollStatus) {\n return true;\n }\n\n if (_constants__WEBPACK_IMPORTED_MODULE_4__[\"PollStatus\"].CLOSED_AFTER === pollStatus) {\n var closedAfterDateTime = new Date(closedAfterDateTimeUTC);\n return closedAfterDateTime < currentDateTime;\n }\n\n return false;\n};\n/**\n * Returns the type of answer controls that should be rendered given the current state of the block.\n *\n * @param {*} attributes the poll's attributes.\n * @param {string} className the css class string Gutenberg is passing into the block.\n */\n\nvar getAnswerStyle = function getAnswerStyle(attributes, className) {\n if (attributes.isMultipleChoice) {\n return _constants__WEBPACK_IMPORTED_MODULE_4__[\"AnswerStyle\"].RADIO;\n }\n\n if (!Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"isEmpty\"])(className) && className.indexOf('is-style-buttons') > -1) {\n return _constants__WEBPACK_IMPORTED_MODULE_4__[\"AnswerStyle\"].BUTTON;\n }\n\n return _constants__WEBPACK_IMPORTED_MODULE_4__[\"AnswerStyle\"].RADIO;\n};\n/**\n * Registers or de-registers the `buttons` block style.\n *\n * @param {boolean} enable True if button style should be available, false if not.\n */\n\nvar toggleButtonStyleAvailability = function toggleButtonStyleAvailability(enable) {\n if (enable) {\n Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__[\"registerBlockStyle\"])('crowdsignal-forms/poll', {\n name: 'buttons',\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_5__[\"__\"])('Buttons')\n });\n } else {\n Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__[\"unregisterBlockStyle\"])('crowdsignal-forms/poll', 'buttons');\n }\n};\n\n//# sourceURL=webpack:///./client/blocks/poll/util.js?");
|
110 |
|
111 |
/***/ }),
|
112 |
|
154 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
155 |
|
156 |
"use strict";
|
157 |
+
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 prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * External dependencies\n */\n\n\n\n/**\n * WordPress dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar PollAnswerResults = function PollAnswerResults(_ref) {\n var error = _ref.error,\n loading = _ref.loading,\n text = _ref.text,\n totalVotes = _ref.totalVotes,\n votes = _ref.votes;\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('crowdsignal-forms-poll__answer-results', {\n 'is-error': error,\n 'is-loading': loading\n });\n var showResults = !loading && !error;\n var answerShare = 0 === totalVotes ? 0 : votes * 100 / totalVotes;\n var progressBarStyles = {\n width: \"\".concat(parseInt(answerShare, 10), \"%\")\n };\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: classes\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__answer-results-labels\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"crowdsignal-forms-poll__answer-results-answer\"\n }, Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__[\"decodeEntities\"])(text)), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"crowdsignal-forms-poll__answer-results-votes\"\n }, showResults && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_5__[\"sprintf\"])( // translators: %s: Number of votes.\n Object(lib_i18n__WEBPACK_IMPORTED_MODULE_5__[\"_n\"])('%s vote', '%s votes', votes), votes.toLocaleString())), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"crowdsignal-forms-poll__answer-results-percent\"\n }, showResults && \"\".concat(answerShare.toFixed(2), \"%\"))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__answer-results-progress-track\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__answer-results-progress-bar\",\n style: progressBarStyles\n })));\n};\n\nPollAnswerResults.propTypes = {\n loading: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,\n text: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string.isRequired,\n totalVotes: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,\n votes: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (PollAnswerResults);\n\n//# sourceURL=webpack:///./client/components/poll/answer-results.js?");
|
158 |
|
159 |
/***/ }),
|
160 |
|
166 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
167 |
|
168 |
"use strict";
|
169 |
+
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 prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var blocks_poll_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! blocks/poll/constants */ \"./client/blocks/poll/constants.js\");\n\n\n/**\n * External dependencies\n */\n\n\n\n/**\n * WordPress dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar PollAnswer = function PollAnswer(_ref) {\n var answerIdFromApi = _ref.answerIdFromApi,\n answerStyle = _ref.answerStyle,\n hasVoted = _ref.hasVoted,\n isMultipleChoice = _ref.isMultipleChoice,\n isSelected = _ref.isSelected,\n isVoting = _ref.isVoting,\n isFocused = _ref.isFocused,\n onSelect = _ref.onSelect,\n onFocus = _ref.onFocus,\n text = _ref.text;\n\n var handleSelect = function handleSelect(event) {\n return onSelect(parseInt(event.target.attributes.answerid.value, 10));\n };\n\n var handleFocus = function handleFocus(event) {\n return onFocus(parseInt(event.target.attributes.answerid.value, 10));\n };\n\n var handleButtonVote = function handleButtonVote(event) {\n event.preventDefault();\n handleSelect(event);\n };\n\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('crowdsignal-forms-poll__answer', {\n 'is-multiple-choice': isMultipleChoice,\n 'is-selected': isSelected,\n 'is-focused': isFocused,\n 'is-button': blocks_poll_constants__WEBPACK_IMPORTED_MODULE_5__[\"AnswerStyle\"].BUTTON === answerStyle\n });\n var answerElementId = \"poll-answer-\".concat(answerIdFromApi);\n\n var renderRadioAnswers = function renderRadioAnswers() {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"label\", {\n className: classes,\n htmlFor: answerElementId,\n tabIndex: \"-1\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"input\", {\n className: \"crowdsignal-forms-poll__input\",\n id: answerElementId,\n name: \"answer\",\n onChange: handleSelect,\n selected: isSelected,\n type: isMultipleChoice ? 'checkbox' : 'radio',\n answerid: answerIdFromApi,\n disabled: hasVoted || isVoting,\n tabIndex: \"0\",\n \"aria-label\": text,\n onFocus: handleFocus\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"crowdsignal-forms-poll__check\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__answer-label-wrapper\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"crowdsignal-forms-poll__answer-label\"\n }, Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__[\"decodeEntities\"])(text))));\n };\n\n var renderButtonAnswers = function renderButtonAnswers() {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button crowdsignal-forms-poll__block-button\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"input\", {\n type: \"submit\",\n className: \"wp-block-button__link crowdsignal-forms-poll__submit-button\",\n value: Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__[\"decodeEntities\"])(text),\n answerid: answerIdFromApi,\n onClick: handleButtonVote\n }));\n };\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: classes\n }, blocks_poll_constants__WEBPACK_IMPORTED_MODULE_5__[\"AnswerStyle\"].RADIO === answerStyle && renderRadioAnswers(), blocks_poll_constants__WEBPACK_IMPORTED_MODULE_5__[\"AnswerStyle\"].BUTTON === answerStyle && renderButtonAnswers());\n};\n\nPollAnswer.propTypes = {\n answerIdFromApi: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number.isRequired,\n hasVoted: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,\n isMultipleChoice: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,\n isSelected: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,\n isVoting: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool,\n onSelect: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.func.isRequired,\n text: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string.isRequired\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (PollAnswer);\n\n//# sourceURL=webpack:///./client/components/poll/answer.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 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 }, '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 |
|
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\n\n/**\n * External dependencies\n */\n\n\nvar ErrorBanner = function ErrorBanner(_ref) {\n var children = _ref.children;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__error-banner\"\n }, children);\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (ErrorBanner);\n\n//# sourceURL=webpack:///./client/components/poll/error-banner.js?");
|
194 |
|
195 |
/***/ }),
|
196 |
|
202 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
203 |
|
204 |
"use strict";
|
205 |
+
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 lib_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * Internal dependencies\n */\n\n\nvar FooterBranding = function FooterBranding(_ref) {\n var showLogo = _ref.showLogo;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__footer-branding\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"a\", {\n className: \"crowdsignal-forms-poll__footer-cs-link\",\n href: \"https://crowdsignal.com\",\n target: \"_blank\",\n rel: \"noopener noreferrer\"\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_1__[\"__\"])('Create your own poll with Crowdsignal')), showLogo && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"img\", {\n className: \"crowdsignal-forms-poll__footer-branding-logo\",\n src: \"https://app.crowdsignal.com/images/svg/cs-logo-dots.svg\",\n alt: \"Crowdsignal sticker\"\n }));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (FooterBranding);\n\n//# sourceURL=webpack:///./client/components/poll/footer-branding.js?");
|
206 |
|
207 |
/***/ }),
|
208 |
|
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, 'crowdsignal-forms-poll', {\n 'has-voted': hasVoted,\n 'is-closed': isClosed,\n 'is-voting': isVoting,\n 'has-default-thankyou': hasDefaultThankyou\n });\n\n var blockStyle = _objectSpread({\n width: attributes.align !== 'full' ? \"\".concat(attributes.width, \"%\") : 'auto'\n }, Object(blocks_poll_util__WEBPACK_IMPORTED_MODULE_11__[\"getStyleVars\"])(attributes, fallbackStyles));\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 }, 'crowdsignal-forms-poll__content');\n var answerStyle = Object(blocks_poll_util__WEBPACK_IMPORTED_MODULE_11__[\"getAnswerStyle\"])(attributes, attributes.className);\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: blockStyle\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: \"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: \"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 answerStyle: answerStyle,\n buttonAlignment: attributes.buttonAlignment,\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 |
|
226 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
227 |
|
228 |
"use strict";
|
229 |
+
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 prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var data_hooks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! data/hooks */ \"./client/data/hooks/index.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _answer_results__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./answer-results */ \"./client/components/poll/answer-results.js\");\n/* harmony import */ var _footer_branding__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./footer-branding */ \"./client/components/poll/footer-branding.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./util */ \"./client/components/poll/util.js\");\n\n\n/**\n * External dependencies\n */\n\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\nvar PollResults = function PollResults(_ref) {\n var answers = _ref.answers,\n pollIdFromApi = _ref.pollIdFromApi,\n setErrorMessage = _ref.setErrorMessage,\n hideBranding = _ref.hideBranding;\n\n var _usePollResults = Object(data_hooks__WEBPACK_IMPORTED_MODULE_5__[\"usePollResults\"])(pollIdFromApi),\n error = _usePollResults.error,\n loading = _usePollResults.loading,\n results = _usePollResults.results;\n\n Object(react__WEBPACK_IMPORTED_MODULE_1__[\"useEffect\"])(function () {\n setErrorMessage(error ? Object(lib_i18n__WEBPACK_IMPORTED_MODULE_6__[\"__\"])(\"Unfortunately, we're having some trouble retrieving \" + \"the results for this poll at this time.\") : '');\n }, [error]);\n var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('crowdsignal-forms-poll__results', {\n 'is-error': !!error,\n 'is-loading': loading\n });\n var total = Object(lodash__WEBPACK_IMPORTED_MODULE_4__[\"sum\"])(Object(lodash__WEBPACK_IMPORTED_MODULE_4__[\"values\"])(results));\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: classes\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__results-list\"\n }, Object(lodash__WEBPACK_IMPORTED_MODULE_4__[\"map\"])(answers, function (answer) {\n var _results$answer$answe;\n\n return !Object(_util__WEBPACK_IMPORTED_MODULE_9__[\"isAnswerEmpty\"])(answer) && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_answer_results__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n key: answer.answerId,\n error: !!error,\n loading: loading,\n text: answer.text,\n totalVotes: total,\n votes: results ? (_results$answer$answe = results[answer.answerIdFromApi]) !== null && _results$answer$answe !== void 0 ? _results$answer$answe : 0 : 0\n });\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__results-footer\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"crowdsignal-forms-poll__results-total\"\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_6__[\"sprintf\"])( // translators: %s: Number of votes\n Object(lib_i18n__WEBPACK_IMPORTED_MODULE_6__[\"_n\"])('%s total vote', '%s total votes', total), total ? total.toLocaleString() : 0)), !hideBranding && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_footer_branding__WEBPACK_IMPORTED_MODULE_8__[\"default\"], null)));\n};\n\nPollResults.propTypes = {\n pollIdFromApi: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,\n answers: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.shape({\n answerId: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string.isRequired,\n answerIdFromApi: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,\n text: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string\n })).isRequired,\n setErrorMessage: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.func.isRequired,\n hideBranding: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (PollResults);\n\n//# sourceURL=webpack:///./client/components/poll/results.js?");
|
230 |
|
231 |
/***/ }),
|
232 |
|
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 var accentColor = Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(buttonNode);\n var surfaceColor = Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(textNode);\n var textColor = window.getComputedStyle(textNode).color; // Ensure that we don't end up with the same color for surface and accent.\n // Falls back to button border color, then text color.\n\n if (accentColor === surfaceColor) {\n var borderColor = Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBorderColor\"])(buttonNode);\n accentColor = borderColor ? borderColor : textColor;\n }\n\n return {\n accent: accentColor,\n surface: surfaceColor,\n text: textColor,\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: \"crowdsignal-forms-poll__submit-message-container\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"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: \"crowdsignal-forms-poll__thank-you-sticker\"\n }), !hideBranding && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"img\", {\n className: \"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: \"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: \"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: \"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: \"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 |
|
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 classnames__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var blocks_poll_constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! blocks/poll/constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var _answer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./answer */ \"./client/components/poll/answer.js\");\n/* harmony import */ var _footer_branding__WEBPACK_IMPORTED_MODULE_10__ = __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/**\n * Internal dependencies\n */\n\n\n\n\n\nvar PollVote = function PollVote(_ref) {\n var answers = _ref.answers,\n answerStyle = _ref.answerStyle,\n buttonAlignment = _ref.buttonAlignment,\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 (blocks_poll_constants__WEBPACK_IMPORTED_MODULE_8__[\"AnswerStyle\"].BUTTON === answerStyle) {\n setSelected([answerId]);\n return onSubmit([answerId]);\n }\n\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 var classes = classnames__WEBPACK_IMPORTED_MODULE_7___default()({\n 'is-button': blocks_poll_constants__WEBPACK_IMPORTED_MODULE_8__[\"AnswerStyle\"].BUTTON === answerStyle,\n 'is-inline-button-alignment': blocks_poll_constants__WEBPACK_IMPORTED_MODULE_8__[\"ButtonAlignment\"].INLINE === buttonAlignment\n }, 'crowdsignal-forms-poll__options');\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"form\", {\n className: \"crowdsignal-forms-poll__form\",\n onSubmit: handleSubmit\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: classes\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_9__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({\n key: \"poll-answer-\".concat(index),\n answerStyle: answerStyle,\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 && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_8__[\"AnswerStyle\"].RADIO === answerStyle && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms-poll__actions\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-button crowdsignal-forms-poll__block-button\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"input\", {\n type: \"submit\",\n className: \"wp-block-button__link 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_10__[\"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 |
|
294 |
/*!********************************************************!*\
|
295 |
!*** ./client/components/with-fallback-styles/util.js ***!
|
296 |
\********************************************************/
|
297 |
+
/*! exports provided: getBackgroundColor, getBorderColor */
|
298 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
299 |
|
300 |
"use strict";
|
301 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBackgroundColor\", function() { return getBackgroundColor; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBorderColor\", function() { return getBorderColor; });\n/**\n * Traverses the parent chain of the given node to get a 'best guess' of\n * what the background color is if the provided node has a transparent background.\n * Algorithm for traversing parent chain \"borrowed\" from\n * https://github.com/WordPress/gutenberg/blob/0c6e369/packages/block-editor/src/components/colors/use-colors.js#L201-L216\n *\n * @param {Element} backgroundColorNode The element to check for background color\n * @return {string} The background colour of the node\n */\nvar getBackgroundColor = function getBackgroundColor(backgroundColorNode) {\n var backgroundColor = window.getComputedStyle(backgroundColorNode).backgroundColor;\n\n while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === window.Node.ELEMENT_NODE) {\n backgroundColorNode = backgroundColorNode.parentNode;\n backgroundColor = window.getComputedStyle(backgroundColorNode).backgroundColor;\n }\n\n return backgroundColor;\n};\n/**\n * Gets the border color for a node, if it appears valid.\n * If we get '0px' for the width, then we likely don't have a border and return null.\n * We use 'borderBlockStartWidth' because of FF: https://bugzilla.mozilla.org/show_bug.cgi?id=137688\n *\n * @param {Element} borderNode The element to check for a border color\n * @return {string|null} The border colour value of null if invalid\n */\n\nvar getBorderColor = function getBorderColor(borderNode) {\n var borderWidth = window.getComputedStyle(borderNode).borderBlockStartWidth;\n return borderWidth !== '0px' ? window.getComputedStyle(borderNode).borderBlockStartColor : null;\n};\n\n//# sourceURL=webpack:///./client/components/with-fallback-styles/util.js?");
|
302 |
|
303 |
/***/ }),
|
304 |
|
931 |
|
932 |
/***/ }),
|
933 |
|
934 |
+
/***/ "@wordpress/blocks":
|
935 |
+
/*!*****************************************!*\
|
936 |
+
!*** external {"this":["wp","blocks"]} ***!
|
937 |
+
\*****************************************/
|
938 |
+
/*! no static exports found */
|
939 |
+
/***/ (function(module, exports) {
|
940 |
+
|
941 |
+
eval("(function() { module.exports = this[\"wp\"][\"blocks\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22blocks%22%5D%7D?");
|
942 |
+
|
943 |
+
/***/ }),
|
944 |
+
|
945 |
/***/ "@wordpress/components":
|
946 |
/*!*********************************************!*\
|
947 |
!*** external {"this":["wp","components"]} ***!
|
changelog.txt
CHANGED
@@ -1,14 +1,31 @@
|
|
1 |
-
= 1.0 =
|
2 |
-
*
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
* Add
|
13 |
-
*
|
14 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
= 1.1.0 =
|
2 |
+
* Implement a poll width setting (#255)
|
3 |
+
* fix method used when updating poll ids in post meta (#257)
|
4 |
+
* Fix archiving of poll blocks in comments (#256)
|
5 |
+
* Address the comments from the p2tenberg compatibility pr. (#252)
|
6 |
+
* P2tenberg: Get The Edit Bar To Display in p2tenberg (#254)
|
7 |
+
* keep button placeholder on focus of button answers for a less jarring editing experience (#242)
|
8 |
+
* P2tenberg compatibility (#175)
|
9 |
+
* Change radio/checkbox fill colour to text colour (#241)
|
10 |
+
* Add release preparation script (#240)
|
11 |
+
* Add Button Answer Type (with actual buttons) (#230)
|
12 |
+
* Add a link for crowdsignal.com In Sidebar for an Unpublished Poll (#239)
|
13 |
+
* remove ios styling from submit button (#225)
|
14 |
+
* Move asset definitions to the `block` class to simplify adding new blocks (#224)
|
15 |
+
* update branches that travis will build (#233)
|
16 |
+
* Add wp-editor dependency
|
17 |
+
|
18 |
+
= 1.0 =
|
19 |
+
* Update default sidebar status
|
20 |
+
* Increase Default Poll Margins
|
21 |
+
* Test suite for admin hooks
|
22 |
+
* Copy text reviews
|
23 |
+
* Added support for loading curated list of google fonts
|
24 |
+
* Normalize "thanks you" message
|
25 |
+
* Fix display of "thank you" message (custom and default) on dark backgrounds
|
26 |
+
* Add Separate Question and Body Font Family fallbacks
|
27 |
+
* Fix styles on wp-admin not honoring margins
|
28 |
+
* Fix submit button styling for themes with very specific selectors (ex TwentyNineteen theme)
|
29 |
+
* Add Unverified Account Check
|
30 |
+
* Code cleanup
|
31 |
+
* 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: 1.
|
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', '1.0' );
|
32 |
define( 'CROWDSIGNAL_FORMS_PLUGIN_FILE', __FILE__ );
|
33 |
define( 'CROWDSIGNAL_FORMS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
34 |
|
15 |
* Plugin Name: Crowdsignal Forms
|
16 |
* Plugin URI: https://crowdsignal.com/crowdsignal-forms/
|
17 |
* Description: Crowdsignal Form Blocks
|
18 |
+
* Version: 1.1.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.1.0' );
|
32 |
define( 'CROWDSIGNAL_FORMS_PLUGIN_FILE', __FILE__ );
|
33 |
define( 'CROWDSIGNAL_FORMS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
34 |
|
includes/admin/class-admin-hooks.php
CHANGED
@@ -12,6 +12,9 @@ use Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin_Notices;
|
|
12 |
use Crowdsignal_Forms\Models\Poll;
|
13 |
use Crowdsignal_Forms\Crowdsignal_Forms;
|
14 |
use Crowdsignal_Forms\Auth\Crowdsignal_Forms_Api_Authenticator;
|
|
|
|
|
|
|
15 |
|
16 |
if ( ! defined( 'ABSPATH' ) ) {
|
17 |
exit;
|
@@ -67,31 +70,58 @@ class Admin_Hooks {
|
|
67 |
}
|
68 |
|
69 |
add_action( 'save_post', array( $this, 'save_polls_to_api' ), 10, 3 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
return $this;
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
-
*
|
76 |
*
|
77 |
-
* @param
|
78 |
-
* @
|
|
|
|
|
|
|
79 |
*
|
80 |
-
* @
|
|
|
|
|
81 |
*/
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
85 |
}
|
86 |
|
87 |
/**
|
88 |
-
*
|
|
|
|
|
|
|
89 |
*
|
90 |
-
* @
|
91 |
-
*
|
|
|
|
|
|
|
92 |
*/
|
93 |
-
|
94 |
-
|
|
|
|
|
95 |
}
|
96 |
|
97 |
/**
|
@@ -102,127 +132,14 @@ class Admin_Hooks {
|
|
102 |
* @param bool $is_update Is this an update.
|
103 |
*
|
104 |
* @since 0.9.0
|
105 |
-
* @return void
|
106 |
-
* @throws \Exception In case of bad request. This is temporary.
|
107 |
-
*/
|
108 |
-
public function save_polls_to_api( $post_ID, $post, $is_update = false ) {
|
109 |
-
if ( wp_is_post_autosave( $post_ID ) || wp_is_post_revision( $post_ID ) || 'trash' === $post->post_status ) {
|
110 |
-
return;
|
111 |
-
}
|
112 |
-
|
113 |
-
$poll_ids_saved_in_post = get_post_meta( $post_ID, self::CROWDSIGNAL_FORMS_POLL_IDS, true );
|
114 |
-
if ( ! has_blocks( $post ) || ! has_block( 'crowdsignal-forms/poll', $post ) ) {
|
115 |
-
// No poll blocks, proactively archive any polls that were previously saved.
|
116 |
-
$this->archive_polls_with_ids( $poll_ids_saved_in_post );
|
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;
|
124 |
-
}
|
125 |
-
|
126 |
-
$content = $post->post_content;
|
127 |
-
$blocks = parse_blocks( $content );
|
128 |
-
|
129 |
-
$poll_ids_present_in_content = array();
|
130 |
-
$gateway = Crowdsignal_Forms::instance()->get_api_gateway();
|
131 |
-
|
132 |
-
$poll_ids_saved_in_post = get_post_meta( $post_ID, self::CROWDSIGNAL_FORMS_POLL_IDS, true );
|
133 |
-
|
134 |
-
if ( empty( $poll_ids_saved_in_post ) ) {
|
135 |
-
$poll_ids_saved_in_post = array();
|
136 |
-
}
|
137 |
-
|
138 |
-
$this->process_blocks( $blocks, $post_ID, $gateway, $poll_ids_present_in_content );
|
139 |
-
|
140 |
-
$poll_ids_to_archive = array_diff( $poll_ids_saved_in_post, $poll_ids_present_in_content );
|
141 |
-
$this->archive_polls_with_ids( $poll_ids_to_archive );
|
142 |
-
|
143 |
-
if ( empty( $poll_ids_saved_in_post ) ) {
|
144 |
-
add_post_meta( $post_ID, self::CROWDSIGNAL_FORMS_POLL_IDS, $poll_ids_present_in_content );
|
145 |
-
} else {
|
146 |
-
update_post_meta( $post_ID, self::CROWDSIGNAL_FORMS_POLL_IDS, $poll_ids_present_in_content );
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Processes all blocks in the content to find any poll blocks that need to be saved.
|
152 |
-
*
|
153 |
-
* @param array $blocks List of blocks to check.
|
154 |
-
* @param int $post_ID ID of the current poll.
|
155 |
-
* @param object $gateway crowdsignal api gateway instance.
|
156 |
-
* @param array $poll_ids_present_in_content Array to track IDs that are present in the content.
|
157 |
*
|
158 |
-
* @since 0.9.0
|
159 |
-
* @return void
|
160 |
* @throws \Exception In case of bad request. This is temporary.
|
161 |
*/
|
162 |
-
|
163 |
-
|
164 |
-
$
|
165 |
-
|
166 |
-
|
167 |
-
while ( ! empty( $blocks_to_process ) ) {
|
168 |
-
$blocks_to_process_next_iteration = array();
|
169 |
-
|
170 |
-
foreach ( $blocks_to_process as $block ) {
|
171 |
-
if ( 'crowdsignal-forms/poll' === $block['blockName'] ) {
|
172 |
-
$poll_blocks[] = $block;
|
173 |
-
continue;
|
174 |
-
}
|
175 |
-
|
176 |
-
if ( empty( $block['innerBlocks'] ) ) {
|
177 |
-
continue;
|
178 |
-
}
|
179 |
-
$blocks_to_process_next_iteration = array_merge( $blocks_to_process_next_iteration, $block['innerBlocks'] );
|
180 |
-
}
|
181 |
-
|
182 |
-
$blocks_to_process = $blocks_to_process_next_iteration;
|
183 |
-
}
|
184 |
-
|
185 |
-
// process the found blocks.
|
186 |
-
foreach ( $poll_blocks as &$poll_block ) {
|
187 |
-
$poll_client_id = $poll_block['attrs']['pollId'];
|
188 |
-
if ( empty( $poll_client_id ) ) {
|
189 |
-
// This is sorta serious, means the poll block is invalid, what to do?
|
190 |
-
// for now, throw!
|
191 |
-
throw new \Exception( 'No poll client_id' );
|
192 |
-
}
|
193 |
-
|
194 |
-
$platform_poll_data = Crowdsignal_Forms::instance()
|
195 |
-
->get_post_poll_meta_gateway()
|
196 |
-
->get_poll_data_for_poll_client_id( $post_ID, $poll_client_id );
|
197 |
-
|
198 |
-
// Append post_ID so Crowdsignal_Forms\Models\Poll::from_array
|
199 |
-
// can inject the source_link.
|
200 |
-
if ( empty( $platform_poll_data ) ) {
|
201 |
-
// nothing in the key or key not existing. New poll.
|
202 |
-
$platform_poll_data = array( 'post_id' => $post_ID );
|
203 |
-
} else {
|
204 |
-
$platform_poll_data = array_merge( $platform_poll_data, array( 'post_id' => $post_ID ) );
|
205 |
-
}
|
206 |
-
|
207 |
-
$poll = Poll::from_array( $platform_poll_data );
|
208 |
-
|
209 |
-
$poll->update_from_block_attrs( $poll_block['attrs'] );
|
210 |
-
if ( $poll->get_id() < 1 ) {
|
211 |
-
$result = $gateway->create_poll( $poll );
|
212 |
-
} else {
|
213 |
-
$result = $gateway->update_poll( $poll );
|
214 |
-
}
|
215 |
-
|
216 |
-
if ( ! is_wp_error( $result ) ) {
|
217 |
-
$poll_ids_present_in_content[] = $result->get_id();
|
218 |
-
Crowdsignal_Forms::instance()
|
219 |
-
->get_post_poll_meta_gateway()
|
220 |
-
->update_poll_data_for_client_id( $post_ID, $poll_client_id, $result->to_array() );
|
221 |
-
} else {
|
222 |
-
// TODO: Pretty serious, we didn't get a poll response. What to do? Throw!
|
223 |
-
throw new \Exception( $result->get_error_code() );
|
224 |
-
}
|
225 |
-
}
|
226 |
}
|
227 |
|
228 |
/**
|
12 |
use Crowdsignal_Forms\Models\Poll;
|
13 |
use Crowdsignal_Forms\Crowdsignal_Forms;
|
14 |
use Crowdsignal_Forms\Auth\Crowdsignal_Forms_Api_Authenticator;
|
15 |
+
use Crowdsignal_Forms\Synchronization\Post_Sync_Entity;
|
16 |
+
use Crowdsignal_Forms\Synchronization\Comment_Sync_Entity;
|
17 |
+
use Crowdsignal_Forms\Synchronization\Poll_Block_Synchronizer;
|
18 |
|
19 |
if ( ! defined( 'ABSPATH' ) ) {
|
20 |
exit;
|
70 |
}
|
71 |
|
72 |
add_action( 'save_post', array( $this, 'save_polls_to_api' ), 10, 3 );
|
73 |
+
/**
|
74 |
+
* Should we synchronize poll blocks in comments too?
|
75 |
+
*
|
76 |
+
* @since 1.0.0
|
77 |
+
*
|
78 |
+
* @param bool $should_sync Synchronize the poll blocks in comments.
|
79 |
+
* @return bool
|
80 |
+
*/
|
81 |
+
$should_sync_comment_polls = (bool) apply_filters( 'crowdsignal_forms_should_sync_comment_polls', true );
|
82 |
+
if ( $should_sync_comment_polls ) {
|
83 |
+
add_action( 'comment_post', array( $this, 'save_polls_to_api_from_new_comment' ), 10, 3 );
|
84 |
+
add_action( 'edit_comment', array( $this, 'save_polls_to_api_from_updated_comment' ), 10, 2 );
|
85 |
+
}
|
86 |
|
87 |
return $this;
|
88 |
}
|
89 |
|
90 |
/**
|
91 |
+
* Save polls in new comments.
|
92 |
*
|
93 |
+
* @param int $comment_id The comment id.
|
94 |
+
* @param int|string $comment_approved Comment approved status.
|
95 |
+
* @param array $commentdata The comment data.
|
96 |
+
*
|
97 |
+
* @return void|bool
|
98 |
*
|
99 |
+
* @throws \Exception In case of bad request. This is temporary.
|
100 |
+
*
|
101 |
+
* @since 1.0.0
|
102 |
*/
|
103 |
+
public function save_polls_to_api_from_new_comment( $comment_id, $comment_approved, $commentdata ) {
|
104 |
+
$saver = new Comment_Sync_Entity( $comment_id, $comment_approved, $commentdata );
|
105 |
+
$synchronizer = new Poll_Block_Synchronizer( $saver );
|
106 |
+
return $synchronizer->synchronize();
|
107 |
}
|
108 |
|
109 |
/**
|
110 |
+
* Save polls in updated comments.
|
111 |
+
*
|
112 |
+
* @param int $comment_id The comment id.
|
113 |
+
* @param array $commentdata The comment data.
|
114 |
*
|
115 |
+
* @return void|bool
|
116 |
+
*
|
117 |
+
* @throws \Exception In case of bad request. This is temporary.
|
118 |
+
*
|
119 |
+
* @since 1.0.0
|
120 |
*/
|
121 |
+
public function save_polls_to_api_from_updated_comment( $comment_id, $commentdata ) {
|
122 |
+
$saver = new Comment_Sync_Entity( $comment_id, null, $commentdata );
|
123 |
+
$synchronizer = new Poll_Block_Synchronizer( $saver );
|
124 |
+
return $synchronizer->synchronize();
|
125 |
}
|
126 |
|
127 |
/**
|
132 |
* @param bool $is_update Is this an update.
|
133 |
*
|
134 |
* @since 0.9.0
|
135 |
+
* @return void|bool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
*
|
|
|
|
|
137 |
* @throws \Exception In case of bad request. This is temporary.
|
138 |
*/
|
139 |
+
public function save_polls_to_api( $post_ID, $post, $is_update = false ) {
|
140 |
+
$saver = new Post_Sync_Entity( $post_ID, $post, $is_update );
|
141 |
+
$synchronizer = new Poll_Block_Synchronizer( $saver );
|
142 |
+
return $synchronizer->synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
144 |
|
145 |
/**
|
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(), '1.0' );
|
46 |
}
|
47 |
|
48 |
/**
|
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.1.0' );
|
46 |
}
|
47 |
|
48 |
/**
|
includes/admin/class-crowdsignal-forms-setup.php
CHANGED
@@ -64,7 +64,7 @@ class Crowdsignal_Forms_Setup {
|
|
64 |
* Enqueues scripts for setup page.
|
65 |
*/
|
66 |
public function admin_enqueue_scripts() {
|
67 |
-
wp_enqueue_style( 'admin-styles', plugin_dir_url( __FILE__ ) . '/admin-styles.css', array(), '0
|
68 |
wp_enqueue_script( 'videopress', 'https://videopress.com/videopress-iframe.js', array(), '1.0', false );
|
69 |
}
|
70 |
|
64 |
* Enqueues scripts for setup page.
|
65 |
*/
|
66 |
public function admin_enqueue_scripts() {
|
67 |
+
wp_enqueue_style( 'admin-styles', plugin_dir_url( __FILE__ ) . '/admin-styles.css', array(), '1.1.0' );
|
68 |
wp_enqueue_script( 'videopress', 'https://videopress.com/videopress-iframe.js', array(), '1.0', false );
|
69 |
}
|
70 |
|
includes/frontend/blocks/class-crowdsignal-forms-poll-block.php
CHANGED
@@ -35,6 +35,24 @@ class Crowdsignal_Forms_Poll_Block implements Crowdsignal_Forms_Block {
|
|
35 |
*/
|
36 |
private static $is_cs_connected = null;
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
/**
|
39 |
* {@inheritDoc}
|
40 |
*/
|
@@ -61,8 +79,8 @@ class Crowdsignal_Forms_Poll_Block implements Crowdsignal_Forms_Block {
|
|
61 |
return '';
|
62 |
}
|
63 |
|
64 |
-
wp_enqueue_script(
|
65 |
-
wp_enqueue_style(
|
66 |
|
67 |
$attributes['hideBranding'] = $this->should_hide_branding();
|
68 |
$post = get_post();
|
@@ -70,6 +88,7 @@ class Crowdsignal_Forms_Poll_Block implements Crowdsignal_Forms_Block {
|
|
70 |
$platform_poll_data = Crowdsignal_Forms::instance()
|
71 |
->get_post_poll_meta_gateway()
|
72 |
->get_poll_data_for_poll_client_id( $post->ID, $attributes['pollId'] );
|
|
|
73 |
if ( ! empty( $platform_poll_data ) ) {
|
74 |
$attributes['apiPollData'] = $platform_poll_data;
|
75 |
}
|
@@ -233,8 +252,11 @@ class Crowdsignal_Forms_Poll_Block implements Crowdsignal_Forms_Block {
|
|
233 |
'default' => false,
|
234 |
),
|
235 |
'align' => array(
|
236 |
-
'type'
|
237 |
-
|
|
|
|
|
|
|
238 |
),
|
239 |
'pollStatus' => array(
|
240 |
'type' => 'string',
|
@@ -252,6 +274,10 @@ class Crowdsignal_Forms_Poll_Block implements Crowdsignal_Forms_Block {
|
|
252 |
'type' => 'boolean',
|
253 |
'default' => false,
|
254 |
),
|
|
|
|
|
|
|
|
|
255 |
);
|
256 |
}
|
257 |
}
|
35 |
*/
|
36 |
private static $is_cs_connected = null;
|
37 |
|
38 |
+
/**
|
39 |
+
* {@inheritDoc}
|
40 |
+
*/
|
41 |
+
public function asset_identifier() {
|
42 |
+
return 'crowdsignal-forms-poll';
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* {@inheritDoc}
|
47 |
+
*/
|
48 |
+
public function assets() {
|
49 |
+
return array(
|
50 |
+
'config' => '/build/poll.asset.php',
|
51 |
+
'script' => '/build/poll.js',
|
52 |
+
'style' => '/build/poll.css',
|
53 |
+
);
|
54 |
+
}
|
55 |
+
|
56 |
/**
|
57 |
* {@inheritDoc}
|
58 |
*/
|
79 |
return '';
|
80 |
}
|
81 |
|
82 |
+
wp_enqueue_script( $this->asset_identifier() );
|
83 |
+
wp_enqueue_style( $this->asset_identifier() );
|
84 |
|
85 |
$attributes['hideBranding'] = $this->should_hide_branding();
|
86 |
$post = get_post();
|
88 |
$platform_poll_data = Crowdsignal_Forms::instance()
|
89 |
->get_post_poll_meta_gateway()
|
90 |
->get_poll_data_for_poll_client_id( $post->ID, $attributes['pollId'] );
|
91 |
+
|
92 |
if ( ! empty( $platform_poll_data ) ) {
|
93 |
$attributes['apiPollData'] = $platform_poll_data;
|
94 |
}
|
252 |
'default' => false,
|
253 |
),
|
254 |
'align' => array(
|
255 |
+
'type' => 'string',
|
256 |
+
),
|
257 |
+
'width' => array(
|
258 |
+
'type' => 'number',
|
259 |
+
'default' => 100,
|
260 |
),
|
261 |
'pollStatus' => array(
|
262 |
'type' => 'string',
|
274 |
'type' => 'boolean',
|
275 |
'default' => false,
|
276 |
),
|
277 |
+
'buttonAlignment' => array(
|
278 |
+
'type' => 'string',
|
279 |
+
'default' => 'list', // See: client/blocks/poll/constants.js.
|
280 |
+
),
|
281 |
);
|
282 |
}
|
283 |
}
|
includes/frontend/class-crowdsignal-forms-block.php
CHANGED
@@ -24,4 +24,24 @@ interface Crowdsignal_Forms_Block {
|
|
24 |
* Registers the Gutenberg block.
|
25 |
*/
|
26 |
public function register();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
24 |
* Registers the Gutenberg block.
|
25 |
*/
|
26 |
public function register();
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Returns a unique name for the block's registered assets.
|
30 |
+
*
|
31 |
+
* @return string The name for the registered assets.
|
32 |
+
*/
|
33 |
+
public function asset_identifier();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Configuration array for the assets of the block.
|
37 |
+
* Must conform to the following format:
|
38 |
+
* array(
|
39 |
+
* 'config' => '/build/poll.asset.php',
|
40 |
+
* 'script' => '/build/poll.js',
|
41 |
+
* 'style' => '/build/poll.css',
|
42 |
+
* )
|
43 |
+
*
|
44 |
+
* @return array The config array.
|
45 |
+
*/
|
46 |
+
public function assets();
|
47 |
}
|
includes/frontend/class-crowdsignal-forms-blocks-assets.php
CHANGED
@@ -21,7 +21,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
class Crowdsignal_Forms_Blocks_Assets {
|
22 |
|
23 |
const EDITOR = 'crowdsignal-forms-editor';
|
24 |
-
const POLL = 'crowdsignal-forms-poll';
|
25 |
|
26 |
/**
|
27 |
* Returns an array containing js and css targets
|
@@ -30,18 +29,19 @@ class Crowdsignal_Forms_Blocks_Assets {
|
|
30 |
* @return array
|
31 |
*/
|
32 |
private static function assets() {
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
),
|
44 |
);
|
|
|
|
|
45 |
}
|
46 |
|
47 |
/**
|
@@ -68,7 +68,7 @@ class Crowdsignal_Forms_Blocks_Assets {
|
|
68 |
wp_register_script(
|
69 |
$id,
|
70 |
$this->url_path( $paths['script'] ),
|
71 |
-
array_merge( array( 'wp-url' ), $config['dependencies'] ), // fix for apiFetch dependency in some environments.
|
72 |
$config['version'],
|
73 |
true
|
74 |
);
|
21 |
class Crowdsignal_Forms_Blocks_Assets {
|
22 |
|
23 |
const EDITOR = 'crowdsignal-forms-editor';
|
|
|
24 |
|
25 |
/**
|
26 |
* Returns an array containing js and css targets
|
29 |
* @return array
|
30 |
*/
|
31 |
private static function assets() {
|
32 |
+
$assets = array();
|
33 |
+
|
34 |
+
foreach ( Crowdsignal_Forms_Blocks::blocks() as $block ) {
|
35 |
+
$assets[ $block->asset_identifier() ] = $block->assets();
|
36 |
+
}
|
37 |
+
|
38 |
+
$assets[ self::EDITOR ] = array(
|
39 |
+
'config' => '/build/editor.asset.php',
|
40 |
+
'script' => '/build/editor.js',
|
41 |
+
'style' => '/build/editor.css',
|
|
|
42 |
);
|
43 |
+
|
44 |
+
return $assets;
|
45 |
}
|
46 |
|
47 |
/**
|
68 |
wp_register_script(
|
69 |
$id,
|
70 |
$this->url_path( $paths['script'] ),
|
71 |
+
array_merge( array( 'wp-url', 'wp-editor' ), $config['dependencies'] ), // fix for apiFetch dependency in some environments.
|
72 |
$config['version'],
|
73 |
true
|
74 |
);
|
includes/frontend/class-crowdsignal-forms-blocks.php
CHANGED
@@ -22,23 +22,35 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
22 |
*/
|
23 |
class Crowdsignal_Forms_Blocks {
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Returns a list containing all block classes
|
27 |
*
|
28 |
* @return array
|
29 |
*/
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
33 |
);
|
|
|
|
|
34 |
}
|
35 |
|
36 |
/**
|
37 |
* Registers Crowdsignal Forms' custom Gutenberg blocks
|
38 |
*/
|
39 |
public function register() {
|
40 |
-
foreach ( self::blocks() as $
|
41 |
-
$block = new $block_class();
|
42 |
$block->register();
|
43 |
}
|
44 |
}
|
22 |
*/
|
23 |
class Crowdsignal_Forms_Blocks {
|
24 |
|
25 |
+
/**
|
26 |
+
* Collection of blocks to be registered.
|
27 |
+
*
|
28 |
+
* @var Blocks\Crowdsignal_Forms_Poll_Block[]
|
29 |
+
*/
|
30 |
+
private static $blocks = array();
|
31 |
+
|
32 |
/**
|
33 |
* Returns a list containing all block classes
|
34 |
*
|
35 |
* @return array
|
36 |
*/
|
37 |
+
public static function blocks() {
|
38 |
+
if ( count( self::$blocks ) > 0 ) {
|
39 |
+
return self::$blocks;
|
40 |
+
}
|
41 |
+
|
42 |
+
self::$blocks = array(
|
43 |
+
new Blocks\Crowdsignal_Forms_Poll_Block(),
|
44 |
);
|
45 |
+
|
46 |
+
return self::$blocks;
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
* Registers Crowdsignal Forms' custom Gutenberg blocks
|
51 |
*/
|
52 |
public function register() {
|
53 |
+
foreach ( self::blocks() as $block ) {
|
|
|
54 |
$block->register();
|
55 |
}
|
56 |
}
|
includes/gateways/class-post-poll-meta-gateway.php
CHANGED
@@ -31,7 +31,31 @@ class Post_Poll_Meta_Gateway {
|
|
31 |
* @return array
|
32 |
*/
|
33 |
public function get_poll_data_for_poll_client_id( $post_id, $client_id ) {
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
if ( empty( $platform_poll_data ) ) {
|
36 |
return array();
|
37 |
}
|
31 |
* @return array
|
32 |
*/
|
33 |
public function get_poll_data_for_poll_client_id( $post_id, $client_id ) {
|
34 |
+
global $wpdb;
|
35 |
+
|
36 |
+
if ( null === $client_id ) {
|
37 |
+
return array();
|
38 |
+
}
|
39 |
+
|
40 |
+
$poll_meta_key = $this->get_poll_meta_key( $client_id );
|
41 |
+
if ( null === $post_id ) {
|
42 |
+
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
|
43 |
+
$platform_poll_data_row = (array) $wpdb->get_row(
|
44 |
+
$wpdb->prepare(
|
45 |
+
"SELECT * from {$wpdb->postmeta} where meta_key = %s LIMIT 1",
|
46 |
+
$poll_meta_key
|
47 |
+
)
|
48 |
+
);
|
49 |
+
|
50 |
+
if ( ! empty( $platform_poll_data_row && isset( $platform_poll_data_row['meta_value'] ) ) ) {
|
51 |
+
$platform_poll_data = maybe_unserialize( $platform_poll_data_row['meta_value'] );
|
52 |
+
} else {
|
53 |
+
$platform_poll_data = array();
|
54 |
+
}
|
55 |
+
} else {
|
56 |
+
$platform_poll_data = (array) get_post_meta( $post_id, $poll_meta_key, true );
|
57 |
+
}
|
58 |
+
|
59 |
if ( empty( $platform_poll_data ) ) {
|
60 |
return array();
|
61 |
}
|
includes/models/class-poll-settings.php
CHANGED
@@ -153,6 +153,8 @@ class Poll_Settings {
|
|
153 |
? $data['close_status']
|
154 |
: self::CLOSE_TYPE_OPEN;
|
155 |
|
|
|
|
|
156 |
$allowed_after_vote_options = array(
|
157 |
self::AFTER_VOTE_RESULTS,
|
158 |
self::AFTER_VOTE_THANKYOU,
|
153 |
? $data['close_status']
|
154 |
: self::CLOSE_TYPE_OPEN;
|
155 |
|
156 |
+
$data['close_after'] = strtotime( $data['close_after'] );
|
157 |
+
|
158 |
$allowed_after_vote_options = array(
|
159 |
self::AFTER_VOTE_RESULTS,
|
160 |
self::AFTER_VOTE_THANKYOU,
|
includes/models/class-poll.php
CHANGED
@@ -119,7 +119,9 @@ class Poll {
|
|
119 |
$poll->set_client_id( $data['client_id'] );
|
120 |
}
|
121 |
|
122 |
-
if ( isset( $data['
|
|
|
|
|
123 |
// v2 will carry both edit and view links, leaving this commented for the future
|
124 |
// $source_link = trim( admin_url( 'post.php?post=' . $data['post_id'] . '&action=edit' ) );
|
125 |
// $poll->set_source_link( $source_link );.
|
119 |
$poll->set_client_id( $data['client_id'] );
|
120 |
}
|
121 |
|
122 |
+
if ( isset( $data['comment_id'] ) ) {
|
123 |
+
$poll->set_source_link( \get_comment_link( $data['comment_id'] ) );
|
124 |
+
} elseif ( isset( $data['post_id'] ) ) {
|
125 |
// v2 will carry both edit and view links, leaving this commented for the future
|
126 |
// $source_link = trim( admin_url( 'post.php?post=' . $data['post_id'] . '&action=edit' ) );
|
127 |
// $poll->set_source_link( $source_link );.
|
includes/rest-api/controllers/class-polls-controller.php
CHANGED
@@ -68,7 +68,7 @@ class Polls_Controller {
|
|
68 |
// GET polls/:poll_id route.
|
69 |
register_rest_route(
|
70 |
$this->namespace,
|
71 |
-
'/' . $this->rest_base . '/(?P<poll_id
|
72 |
array(
|
73 |
array(
|
74 |
'methods' => \WP_REST_Server::READABLE,
|
@@ -82,7 +82,7 @@ class Polls_Controller {
|
|
82 |
// GET polls/:poll_id/results route.
|
83 |
register_rest_route(
|
84 |
$this->namespace,
|
85 |
-
'/' . $this->rest_base . '/(?P<poll_id
|
86 |
array(
|
87 |
array(
|
88 |
'methods' => \WP_REST_Server::READABLE,
|
@@ -289,17 +289,39 @@ class Polls_Controller {
|
|
289 |
**/
|
290 |
public function get_poll( $request ) {
|
291 |
$poll_id = $request->get_param( 'poll_id' );
|
292 |
-
if ( null === $poll_id
|
293 |
return new \WP_Error(
|
294 |
'invalid-poll-id',
|
295 |
__( 'Invalid poll ID', 'crowdsignal-forms' ),
|
296 |
array( 'status' => 400 )
|
297 |
);
|
298 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
$poll = Crowdsignal_Forms::instance()->get_api_gateway()->get_poll( $poll_id );
|
|
|
300 |
if ( is_wp_error( $poll ) ) {
|
301 |
return rest_ensure_response( $poll );
|
302 |
}
|
|
|
303 |
return rest_ensure_response( $poll->to_array() );
|
304 |
}
|
305 |
|
@@ -308,7 +330,7 @@ class Polls_Controller {
|
|
308 |
*
|
309 |
* @since 0.9.0
|
310 |
*
|
311 |
-
* @param \WP_REST_Request $request
|
312 |
*
|
313 |
* @return \WP_REST_Response|\WP_Error
|
314 |
**/
|
@@ -395,7 +417,7 @@ class Polls_Controller {
|
|
395 |
return array(
|
396 |
'poll_id' => array(
|
397 |
'validate_callback' => function( $param, $request, $key ) {
|
398 |
-
return
|
399 |
},
|
400 |
),
|
401 |
);
|
68 |
// GET polls/:poll_id route.
|
69 |
register_rest_route(
|
70 |
$this->namespace,
|
71 |
+
'/' . $this->rest_base . '/(?P<poll_id>[a-zA-Z0-9\-\_]+)',
|
72 |
array(
|
73 |
array(
|
74 |
'methods' => \WP_REST_Server::READABLE,
|
82 |
// GET polls/:poll_id/results route.
|
83 |
register_rest_route(
|
84 |
$this->namespace,
|
85 |
+
'/' . $this->rest_base . '/(?P<poll_id>[a-zA-Z0-9\-\_]+)/results',
|
86 |
array(
|
87 |
array(
|
88 |
'methods' => \WP_REST_Server::READABLE,
|
289 |
**/
|
290 |
public function get_poll( $request ) {
|
291 |
$poll_id = $request->get_param( 'poll_id' );
|
292 |
+
if ( null === $poll_id ) {
|
293 |
return new \WP_Error(
|
294 |
'invalid-poll-id',
|
295 |
__( 'Invalid poll ID', 'crowdsignal-forms' ),
|
296 |
array( 'status' => 400 )
|
297 |
);
|
298 |
}
|
299 |
+
|
300 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
301 |
+
$use_cached = isset( $_REQUEST['cached'] );
|
302 |
+
|
303 |
+
if ( ! is_numeric( $poll_id ) ) {
|
304 |
+
$poll_client_id = $poll_id;
|
305 |
+
$poll_saved_in_meta = Crowdsignal_Forms::instance()
|
306 |
+
->get_post_poll_meta_gateway()
|
307 |
+
->get_poll_data_for_poll_client_id( null, $poll_client_id );
|
308 |
+
|
309 |
+
if ( empty( $poll_saved_in_meta ) ) {
|
310 |
+
return $this->resource_not_found();
|
311 |
+
}
|
312 |
+
|
313 |
+
if ( $use_cached ) {
|
314 |
+
return rest_ensure_response( Poll::from_array( $poll_saved_in_meta )->to_array() );
|
315 |
+
}
|
316 |
+
|
317 |
+
$poll_id = $poll_saved_in_meta['id'];
|
318 |
+
}
|
319 |
$poll = Crowdsignal_Forms::instance()->get_api_gateway()->get_poll( $poll_id );
|
320 |
+
|
321 |
if ( is_wp_error( $poll ) ) {
|
322 |
return rest_ensure_response( $poll );
|
323 |
}
|
324 |
+
|
325 |
return rest_ensure_response( $poll->to_array() );
|
326 |
}
|
327 |
|
330 |
*
|
331 |
* @since 0.9.0
|
332 |
*
|
333 |
+
* @param \WP_REST_Request $request The HTTP request.
|
334 |
*
|
335 |
* @return \WP_REST_Response|\WP_Error
|
336 |
**/
|
417 |
return array(
|
418 |
'poll_id' => array(
|
419 |
'validate_callback' => function( $param, $request, $key ) {
|
420 |
+
return true;
|
421 |
},
|
422 |
),
|
423 |
);
|
includes/synchronization/class-comment-sync-entity.php
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the model \Crowdsignal_Forms\Synchronization\Comment_Sync_Entity.
|
4 |
+
*
|
5 |
+
* @package crowdsignal-forms/Synchronization
|
6 |
+
* @since 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Synchronization;
|
10 |
+
|
11 |
+
use Crowdsignal_Forms\Crowdsignal_Forms;
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Class Comment_Sync_Entity
|
19 |
+
*
|
20 |
+
* @package Crowdsignal_Forms\Synchronization
|
21 |
+
*/
|
22 |
+
class Comment_Sync_Entity implements Synchronizable_Entity {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The poll ids meta key prefix for a specific comment.
|
26 |
+
*/
|
27 |
+
const CROWDSIGNAL_FORMS_POST_COMMENTS_POLL_IDS = '_crowdsignal_forms_comment_poll_ids_';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* The comment id.
|
31 |
+
*
|
32 |
+
* @var int
|
33 |
+
*/
|
34 |
+
private $comment_id;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Comment approved status.
|
38 |
+
*
|
39 |
+
* @var int|string|null
|
40 |
+
*/
|
41 |
+
private $comment_approved;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Comment data.
|
45 |
+
*
|
46 |
+
* @var array
|
47 |
+
*/
|
48 |
+
private $commentdata;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* The comment.
|
52 |
+
*
|
53 |
+
* @var array|\WP_Comment|null
|
54 |
+
*/
|
55 |
+
private $comment;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* The post the comment belongs to.
|
59 |
+
*
|
60 |
+
* @var int
|
61 |
+
*/
|
62 |
+
private $post_id;
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Comment_Sync_Entity constructor.
|
66 |
+
*
|
67 |
+
* @param int $comment_id The comment id.
|
68 |
+
* @param int|string|null $comment_approved The comment status. If null, derived from the comment we fetch.
|
69 |
+
* @param array $commentdata The comment data.
|
70 |
+
*/
|
71 |
+
public function __construct( $comment_id, $comment_approved, $commentdata ) {
|
72 |
+
$this->comment_id = $comment_id;
|
73 |
+
$this->commentdata = $commentdata;
|
74 |
+
$this->comment = get_comment( $comment_id );
|
75 |
+
if ( null === $comment_approved ) {
|
76 |
+
$comment_approved = empty( $this->comment ) ? 0 : $this->comment->comment_approved;
|
77 |
+
}
|
78 |
+
$this->comment_approved = $comment_approved;
|
79 |
+
$this->post_id = $this->comment->comment_post_ID;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Checks if the content is saveable.
|
84 |
+
*
|
85 |
+
* @since 1.0.0
|
86 |
+
*
|
87 |
+
* @return bool
|
88 |
+
*/
|
89 |
+
public function can_be_saved() {
|
90 |
+
if ( 'spam' === $this->comment_approved ||
|
91 |
+
0 === $this->comment_approved ||
|
92 |
+
empty( $this->comment ) ||
|
93 |
+
! isset( $this->comment->comment_content ) ) {
|
94 |
+
return false;
|
95 |
+
}
|
96 |
+
return true;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Get Blocks.
|
101 |
+
*
|
102 |
+
* @since 1.0.0
|
103 |
+
*
|
104 |
+
* @return array
|
105 |
+
*/
|
106 |
+
public function get_blocks() {
|
107 |
+
$content = $this->comment->comment_content;
|
108 |
+
return parse_blocks( $content );
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Gets the poll ids the entity has in it's content.
|
113 |
+
*
|
114 |
+
* @since 1.0.0
|
115 |
+
*
|
116 |
+
* @return array
|
117 |
+
*/
|
118 |
+
public function get_poll_ids_saved_in_entity() {
|
119 |
+
$poll_ids_saved_in_entity = get_post_meta( $this->post_id, $this->get_comment_poll_ids_meta_key(), true );
|
120 |
+
return is_array( $poll_ids_saved_in_entity ) ? $poll_ids_saved_in_entity : array();
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Check if the entity contains any blocks.
|
125 |
+
*
|
126 |
+
* @since 1.0.0
|
127 |
+
*
|
128 |
+
* @return bool
|
129 |
+
*/
|
130 |
+
public function has_crowdsignal_forms_blocks() {
|
131 |
+
$content = $this->comment->comment_content;
|
132 |
+
return has_blocks( $content ) && has_block( 'crowdsignal-forms/poll', $content );
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Get the poll data saved in the entity for the specified client id.
|
137 |
+
*
|
138 |
+
* @since 1.0.0
|
139 |
+
*
|
140 |
+
* @param string $poll_client_id The poll unique client id.
|
141 |
+
* @return array|null
|
142 |
+
*/
|
143 |
+
public function get_entity_poll_data( $poll_client_id ) {
|
144 |
+
$platform_poll_data = Crowdsignal_Forms::instance()
|
145 |
+
->get_post_poll_meta_gateway()
|
146 |
+
->get_poll_data_for_poll_client_id( $this->post_id, $poll_client_id );
|
147 |
+
|
148 |
+
if ( empty( $platform_poll_data ) ) {
|
149 |
+
// nothing in the key or key not existing. New poll.
|
150 |
+
$platform_poll_data = array(
|
151 |
+
'post_id' => $this->post_id,
|
152 |
+
'comment_id' => $this->comment_id,
|
153 |
+
);
|
154 |
+
} else {
|
155 |
+
$platform_poll_data = array_merge(
|
156 |
+
$platform_poll_data,
|
157 |
+
array(
|
158 |
+
'post_id' => $this->post_id,
|
159 |
+
'comment_id' => $this->comment_id,
|
160 |
+
)
|
161 |
+
);
|
162 |
+
}
|
163 |
+
return $platform_poll_data;
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Update the poll data saved in the entity for the specified client id.
|
168 |
+
*
|
169 |
+
* @since 1.0.0
|
170 |
+
* @param string $poll_client_id The poll unique client id.
|
171 |
+
* @param array $result_array An updated poll array.
|
172 |
+
*
|
173 |
+
* @return mixed
|
174 |
+
*/
|
175 |
+
public function update_entity_poll_data( $poll_client_id, $result_array ) {
|
176 |
+
return Crowdsignal_Forms::instance()->get_post_poll_meta_gateway()
|
177 |
+
->update_poll_data_for_client_id( $this->post_id, $poll_client_id, $result_array );
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Updates the list of poll ids saved in entity.
|
182 |
+
*
|
183 |
+
* @since 1.0.0
|
184 |
+
*
|
185 |
+
* @param array $poll_ids_present_in_content The polls that are currently part of the content.
|
186 |
+
*
|
187 |
+
* @return mixed
|
188 |
+
*/
|
189 |
+
public function update_poll_ids_present_in_entity( $poll_ids_present_in_content ) {
|
190 |
+
return update_post_meta( $this->post_id, $this->get_comment_poll_ids_meta_key(), $poll_ids_present_in_content );
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Get the meta key we use for storing the poll ids present on a given comment.
|
195 |
+
*
|
196 |
+
* @since 1.1.0
|
197 |
+
* @return string
|
198 |
+
*/
|
199 |
+
private function get_comment_poll_ids_meta_key() {
|
200 |
+
return self::CROWDSIGNAL_FORMS_POST_COMMENTS_POLL_IDS . $this->comment_id;
|
201 |
+
}
|
202 |
+
}
|
includes/synchronization/class-poll-block-synchronizer.php
ADDED
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the model \Crowdsignal_Forms\Synchronization\Poll_Block_Synchronizer.
|
4 |
+
*
|
5 |
+
* @package crowdsignal-forms/Synchronization
|
6 |
+
* @since 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Synchronization;
|
10 |
+
|
11 |
+
use Crowdsignal_Forms\Crowdsignal_Forms;
|
12 |
+
use Crowdsignal_Forms\Models\Poll;
|
13 |
+
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Class Poll_Block_Synchronizer
|
20 |
+
*
|
21 |
+
* @package Crowdsignal_Forms\Synchronization
|
22 |
+
*/
|
23 |
+
class Poll_Block_Synchronizer {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* The authenticator object.
|
27 |
+
*
|
28 |
+
* @since 1.0.0
|
29 |
+
* @var \Crowdsignal_Forms\Auth\Crowdsignal_Forms_Api_Authenticator|null
|
30 |
+
*/
|
31 |
+
protected $authenticator;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* The api gateway.
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
* @var \Crowdsignal_Forms\Gateways\Api_Gateway_Interface
|
38 |
+
*/
|
39 |
+
protected $gateway;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* The entity we are saving the sync result to.
|
43 |
+
*
|
44 |
+
* @since 1.0.0
|
45 |
+
* @var Synchronizable_Entity;
|
46 |
+
*/
|
47 |
+
protected $entity_bridge;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Poll_Block_Synchronizer constructor.
|
51 |
+
*
|
52 |
+
* @since 1.0.0
|
53 |
+
* @param Synchronizable_Entity $sync_entity The entity which will persist the sync results.
|
54 |
+
*/
|
55 |
+
public function __construct( $sync_entity ) {
|
56 |
+
$this->entity_bridge = $sync_entity;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Save function.
|
61 |
+
*
|
62 |
+
* @return bool|void
|
63 |
+
* @throws \Exception Thrown in cases where severe failures happen.
|
64 |
+
*/
|
65 |
+
public function synchronize() {
|
66 |
+
if ( ! $this->entity_bridge->can_be_saved() ) {
|
67 |
+
return;
|
68 |
+
}
|
69 |
+
|
70 |
+
$this->authenticator = Crowdsignal_Forms::instance()->get_api_authenticator();
|
71 |
+
if ( ! $this->authenticator->get_user_code() ) {
|
72 |
+
// Plugin hasn't been authenticated yet, abort sync.
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
|
76 |
+
$poll_ids_saved_in_entity = $this->entity_bridge->get_poll_ids_saved_in_entity();
|
77 |
+
|
78 |
+
if ( ! $this->entity_bridge->has_crowdsignal_forms_blocks() ) {
|
79 |
+
// No poll blocks, proactively archive any polls that were previously saved.
|
80 |
+
$this->archive_polls_with_ids( $poll_ids_saved_in_entity );
|
81 |
+
if ( ! empty( $poll_ids_saved_in_entity ) ) {
|
82 |
+
$this->entity_bridge->update_poll_ids_present_in_entity( array() );
|
83 |
+
}
|
84 |
+
|
85 |
+
return;
|
86 |
+
}
|
87 |
+
|
88 |
+
$this->gateway = Crowdsignal_Forms::instance()->get_api_gateway();
|
89 |
+
|
90 |
+
$blocks = $this->entity_bridge->get_blocks();
|
91 |
+
try {
|
92 |
+
$poll_ids_present_in_content = $this->process_blocks( $blocks );
|
93 |
+
|
94 |
+
$poll_ids_to_archive = array_diff( $poll_ids_saved_in_entity, $poll_ids_present_in_content );
|
95 |
+
$this->archive_polls_with_ids( $poll_ids_to_archive );
|
96 |
+
|
97 |
+
$this->entity_bridge->update_poll_ids_present_in_entity( $poll_ids_present_in_content );
|
98 |
+
} catch ( \Exception $sync_exception ) {
|
99 |
+
$this->handle_api_sync_exception( $sync_exception );
|
100 |
+
return;
|
101 |
+
}
|
102 |
+
|
103 |
+
return true;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Archive polls with these ids.
|
108 |
+
*
|
109 |
+
* @param array $poll_ids_to_archive Ids to archive.
|
110 |
+
*/
|
111 |
+
protected function archive_polls_with_ids( $poll_ids_to_archive ) {
|
112 |
+
if ( empty( $poll_ids_to_archive ) ) {
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
|
116 |
+
$this->gateway = Crowdsignal_Forms::instance()->get_api_gateway();
|
117 |
+
foreach ( $poll_ids_to_archive as $id_to_archive ) {
|
118 |
+
$this->gateway->archive_poll( $id_to_archive );
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Processes all blocks in the content to find any poll blocks that need to be saved.
|
124 |
+
*
|
125 |
+
* @param array $blocks List of blocks to check.
|
126 |
+
*
|
127 |
+
* @return array
|
128 |
+
*
|
129 |
+
* @throws \Exception In case of bad request. This is temporary.
|
130 |
+
* @since 1.0.0
|
131 |
+
*/
|
132 |
+
protected function process_blocks( $blocks ) {
|
133 |
+
// search for all poll blocks at top level and nested in other blocks.
|
134 |
+
$poll_blocks = array();
|
135 |
+
$blocks_to_process = $blocks;
|
136 |
+
$poll_ids_present_in_content = array();
|
137 |
+
|
138 |
+
while ( ! empty( $blocks_to_process ) ) {
|
139 |
+
$blocks_to_process_next_iteration = array();
|
140 |
+
|
141 |
+
foreach ( $blocks_to_process as $block ) {
|
142 |
+
if ( 'crowdsignal-forms/poll' === $block['blockName'] ) {
|
143 |
+
$poll_blocks[] = $block;
|
144 |
+
continue;
|
145 |
+
}
|
146 |
+
|
147 |
+
if ( empty( $block['innerBlocks'] ) ) {
|
148 |
+
continue;
|
149 |
+
}
|
150 |
+
$blocks_to_process_next_iteration = array_merge( $blocks_to_process_next_iteration, $block['innerBlocks'] );
|
151 |
+
}
|
152 |
+
|
153 |
+
$blocks_to_process = $blocks_to_process_next_iteration;
|
154 |
+
}
|
155 |
+
|
156 |
+
// process the found blocks.
|
157 |
+
foreach ( $poll_blocks as $poll_block ) {
|
158 |
+
$poll_client_id = $poll_block['attrs']['pollId'];
|
159 |
+
if ( empty( $poll_client_id ) ) {
|
160 |
+
// This is sorta serious, means the poll block is invalid, what to do?
|
161 |
+
// for now, throw!
|
162 |
+
throw new \Exception( 'No poll client_id' );
|
163 |
+
}
|
164 |
+
|
165 |
+
$platform_poll_data = $this->entity_bridge->get_entity_poll_data( $poll_client_id );
|
166 |
+
|
167 |
+
$poll = Poll::from_array( $platform_poll_data );
|
168 |
+
|
169 |
+
$poll->update_from_block_attrs( $poll_block['attrs'] );
|
170 |
+
if ( $poll->get_id() < 1 ) {
|
171 |
+
$result = $this->gateway->create_poll( $poll );
|
172 |
+
} else {
|
173 |
+
$result = $this->gateway->update_poll( $poll );
|
174 |
+
}
|
175 |
+
|
176 |
+
if ( ! is_wp_error( $result ) ) {
|
177 |
+
$poll_ids_present_in_content[] = $result->get_id();
|
178 |
+
$this->entity_bridge->update_entity_poll_data( $poll_client_id, $result->to_array() );
|
179 |
+
|
180 |
+
} else {
|
181 |
+
// TODO: Pretty serious, we didn't get a poll response. What to do? Throw!
|
182 |
+
throw new \Exception( $result->get_error_code() );
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
return $poll_ids_present_in_content;
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Fire any exception handling code here.
|
191 |
+
*
|
192 |
+
* @param \Exception $sync_exception The sync exception.
|
193 |
+
*/
|
194 |
+
private function handle_api_sync_exception( $sync_exception ) {
|
195 |
+
/**
|
196 |
+
* Sync failed for some reason. We might want to do something about this by hooking into this action.
|
197 |
+
*
|
198 |
+
* @param \Exception $sync_exception The exception that was thrown.
|
199 |
+
* @param Poll_Block_Synchronizer $this This block sync instance.
|
200 |
+
* @since 1.0.0
|
201 |
+
*/
|
202 |
+
do_action( 'crowdsignal_forms_poll_sync_exception', $sync_exception, $this );
|
203 |
+
}
|
204 |
+
}
|
includes/synchronization/class-post-sync-entity.php
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing \Crowdsignal_Forms\Synchronization\Post_Sync_Entity.
|
4 |
+
*
|
5 |
+
* @package crowdsignal-forms/Synchronization
|
6 |
+
* @since 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Synchronization;
|
10 |
+
|
11 |
+
use Crowdsignal_Forms\Crowdsignal_Forms;
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Class Post_Sync_Entity
|
19 |
+
*
|
20 |
+
* @package Crowdsignal_Forms\Synchronization
|
21 |
+
*/
|
22 |
+
class Post_Sync_Entity implements Synchronizable_Entity {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The poll ids meta key.
|
26 |
+
*/
|
27 |
+
const CROWDSIGNAL_FORMS_POLL_IDS = '_crowdsignal_forms_poll_ids';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* The post id.
|
31 |
+
*
|
32 |
+
* @var int $post_id
|
33 |
+
*/
|
34 |
+
private $post_id;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* The post.
|
38 |
+
*
|
39 |
+
* @var \WP_Post $post
|
40 |
+
*/
|
41 |
+
private $post;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Is this an update or not.
|
45 |
+
*
|
46 |
+
* @var bool $is_update
|
47 |
+
*/
|
48 |
+
private $is_update;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Post_Poll_Block_Saver constructor.
|
52 |
+
*
|
53 |
+
* @param int $post_id The post id.
|
54 |
+
* @param object $post The post.
|
55 |
+
* @param bool $is_update Is Update.
|
56 |
+
*/
|
57 |
+
public function __construct( $post_id, $post, $is_update = false ) {
|
58 |
+
$this->post_id = $post_id;
|
59 |
+
$this->post = $post;
|
60 |
+
$this->is_update = $is_update;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Checks if the content is saveable.
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
+
*
|
68 |
+
* @return bool
|
69 |
+
*/
|
70 |
+
public function can_be_saved() {
|
71 |
+
if ( wp_is_post_autosave( $this->post_id ) || wp_is_post_revision( $this->post_id ) || 'trash' === $this->post->post_status ) {
|
72 |
+
return false;
|
73 |
+
}
|
74 |
+
return true;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Get Blocks.
|
79 |
+
*
|
80 |
+
* @since 1.0.0
|
81 |
+
*
|
82 |
+
* @return array
|
83 |
+
*/
|
84 |
+
public function get_blocks() {
|
85 |
+
$content = $this->post->post_content;
|
86 |
+
return parse_blocks( $content );
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Gets the poll ids the entity has in it's content.
|
91 |
+
*
|
92 |
+
* @since 1.0.0
|
93 |
+
*
|
94 |
+
* @return array
|
95 |
+
*/
|
96 |
+
public function get_poll_ids_saved_in_entity() {
|
97 |
+
$poll_ids_saved_in_entity = get_post_meta( $this->post_id, self::CROWDSIGNAL_FORMS_POLL_IDS, true );
|
98 |
+
return is_array( $poll_ids_saved_in_entity ) ? $poll_ids_saved_in_entity : array();
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Check if the entity contains any blocks.
|
103 |
+
*
|
104 |
+
* @since 1.0.0
|
105 |
+
*
|
106 |
+
* @return bool
|
107 |
+
*/
|
108 |
+
public function has_crowdsignal_forms_blocks() {
|
109 |
+
return has_blocks( $this->post ) && has_block( 'crowdsignal-forms/poll', $this->post );
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Get the poll data saved in the entity for the specified client id.
|
114 |
+
*
|
115 |
+
* @since 1.0.0
|
116 |
+
*
|
117 |
+
* @param string $poll_client_id The poll unique client id.
|
118 |
+
* @return array|null
|
119 |
+
*/
|
120 |
+
public function get_entity_poll_data( $poll_client_id ) {
|
121 |
+
$platform_poll_data = Crowdsignal_Forms::instance()
|
122 |
+
->get_post_poll_meta_gateway()
|
123 |
+
->get_poll_data_for_poll_client_id( $this->post_id, $poll_client_id );
|
124 |
+
|
125 |
+
// Append post_ID so Crowdsignal_Forms\Models\Poll::from_array
|
126 |
+
// can inject the source_link.
|
127 |
+
if ( empty( $platform_poll_data ) ) {
|
128 |
+
// nothing in the key or key not existing. New poll.
|
129 |
+
$platform_poll_data = array( 'post_id' => $this->post_id );
|
130 |
+
} else {
|
131 |
+
$platform_poll_data = array_merge( $platform_poll_data, array( 'post_id' => $this->post_id ) );
|
132 |
+
}
|
133 |
+
return $platform_poll_data;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Update the poll data saved in the entity for the specified client id.
|
138 |
+
*
|
139 |
+
* @since 1.0.0
|
140 |
+
* @param string $poll_client_id The poll unique client id.
|
141 |
+
* @param array $result_array An updated poll array.
|
142 |
+
*
|
143 |
+
* @return mixed
|
144 |
+
*/
|
145 |
+
public function update_entity_poll_data( $poll_client_id, $result_array ) {
|
146 |
+
return Crowdsignal_Forms::instance()->get_post_poll_meta_gateway()
|
147 |
+
->update_poll_data_for_client_id( $this->post_id, $poll_client_id, $result_array );
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Updates the list of poll ids saved in entity.
|
152 |
+
*
|
153 |
+
* @since 1.0.0
|
154 |
+
*
|
155 |
+
* @param array $poll_ids_present_in_content The polls that are currently part of the content.
|
156 |
+
*
|
157 |
+
* @return mixed
|
158 |
+
*/
|
159 |
+
public function update_poll_ids_present_in_entity( $poll_ids_present_in_content ) {
|
160 |
+
return update_post_meta( $this->post_id, self::CROWDSIGNAL_FORMS_POLL_IDS, $poll_ids_present_in_content );
|
161 |
+
}
|
162 |
+
}
|
includes/synchronization/class-synchronizable-entity.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the model \Crowdsignal_Forms\Synchronization\Synchronizable_Entity.
|
4 |
+
*
|
5 |
+
* @package crowdsignal-forms/Synchronization
|
6 |
+
* @since 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Synchronization;
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Interface Synchronizable_Entity.
|
17 |
+
*
|
18 |
+
* @package Crowdsignal_Forms\Synchronization
|
19 |
+
*/
|
20 |
+
interface Synchronizable_Entity {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Checks if the content is saveable.
|
24 |
+
*
|
25 |
+
* @since 1.0.0
|
26 |
+
*
|
27 |
+
* @return bool
|
28 |
+
*/
|
29 |
+
public function can_be_saved();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Get Blocks.
|
33 |
+
*
|
34 |
+
* @since 1.0.0
|
35 |
+
*
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function get_blocks();
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Gets the poll ids the entity has in it's content.
|
42 |
+
*
|
43 |
+
* @since 1.0.0
|
44 |
+
*
|
45 |
+
* @return array
|
46 |
+
*/
|
47 |
+
public function get_poll_ids_saved_in_entity();
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Check if the entity contains any crowdsignal-forms blocks.
|
51 |
+
*
|
52 |
+
* @since 1.0.0
|
53 |
+
*
|
54 |
+
* @return bool
|
55 |
+
*/
|
56 |
+
public function has_crowdsignal_forms_blocks();
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Get the poll data saved in the entity for the specified client id.
|
60 |
+
*
|
61 |
+
* @since 1.0.0
|
62 |
+
*
|
63 |
+
* @param string $poll_client_id The poll unique client id.
|
64 |
+
* @return array|null
|
65 |
+
*/
|
66 |
+
public function get_entity_poll_data( $poll_client_id );
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Update the poll data saved in the entity for the specified client id.
|
70 |
+
*
|
71 |
+
* @since 1.0.0
|
72 |
+
* @param string $poll_client_id The poll unique client id.
|
73 |
+
* @param array $result_array An updated poll array.
|
74 |
+
*
|
75 |
+
* @return mixed
|
76 |
+
*/
|
77 |
+
public function update_entity_poll_data( $poll_client_id, $result_array );
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Updates the list of poll ids saved in entity.
|
81 |
+
*
|
82 |
+
* @since 1.0.0
|
83 |
+
*
|
84 |
+
* @param array $poll_ids_present_in_content The polls that are currently part of the content.
|
85 |
+
* @return mixed
|
86 |
+
*/
|
87 |
+
public function update_poll_ids_present_in_entity( $poll_ids_present_in_content );
|
88 |
+
}
|
languages/crowdsignal-forms.pot
CHANGED
@@ -2,16 +2,16 @@
|
|
2 |
# This file is distributed under the GPL-2.0+.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Crowdsignal Forms
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/crowdsignal-forms\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
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-
|
15 |
"X-Domain: crowdsignal-forms\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
@@ -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 |
|
@@ -199,14 +199,14 @@ msgid "No Poll ID was provided."
|
|
199 |
msgstr ""
|
200 |
|
201 |
#: includes/rest-api/controllers/class-polls-controller.php:295
|
202 |
-
#: includes/rest-api/controllers/class-polls-controller.php:
|
203 |
msgid "Invalid poll ID"
|
204 |
msgstr ""
|
205 |
|
206 |
-
#: includes/rest-api/controllers/class-polls-controller.php:
|
207 |
msgid "Invalid post ID"
|
208 |
msgstr ""
|
209 |
|
210 |
-
#: includes/rest-api/controllers/class-polls-controller.php:
|
211 |
msgid "Resource not found"
|
212 |
msgstr ""
|
2 |
# This file is distributed under the GPL-2.0+.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Crowdsignal Forms 1.1.0\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/crowdsignal-forms\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
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-09-14T19:42:46+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
+
"X-Generator: WP-CLI 2.5.0-alpha-75cb7e3\n"
|
15 |
"X-Domain: crowdsignal-forms\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
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:174
|
184 |
msgid "Untitled Poll"
|
185 |
msgstr ""
|
186 |
|
187 |
+
#: includes/frontend/blocks/class-crowdsignal-forms-poll-block.php:203
|
188 |
msgid "Submit"
|
189 |
msgstr ""
|
190 |
|
199 |
msgstr ""
|
200 |
|
201 |
#: includes/rest-api/controllers/class-polls-controller.php:295
|
202 |
+
#: includes/rest-api/controllers/class-polls-controller.php:358
|
203 |
msgid "Invalid poll ID"
|
204 |
msgstr ""
|
205 |
|
206 |
+
#: includes/rest-api/controllers/class-polls-controller.php:344
|
207 |
msgid "Invalid post ID"
|
208 |
msgstr ""
|
209 |
|
210 |
+
#: includes/rest-api/controllers/class-polls-controller.php:435
|
211 |
msgid "Resource not found"
|
212 |
msgstr ""
|