Version Description
Download this release
Release Info
Developer | cgastrell |
Plugin | Crowdsignal Forms |
Version | 0.9.0 |
Comparing to | |
See all releases |
Version 0.9.0
- LICENSE.TXT +339 -0
- README.TXT +77 -0
- build/editor.asset.php +1 -0
- build/editor.css +1 -0
- build/editor.js +1105 -0
- build/poll.asset.php +1 -0
- build/poll.css +1 -0
- build/poll.js +1011 -0
- changelog.txt +0 -0
- crowdsignal-forms.php +44 -0
- includes/admin/admin-styles.css +308 -0
- includes/admin/class-admin-hooks.php +242 -0
- includes/admin/class-crowdsignal-forms-admin-notices.php +228 -0
- includes/admin/class-crowdsignal-forms-admin.php +91 -0
- includes/admin/class-crowdsignal-forms-settings.php +235 -0
- includes/admin/class-crowdsignal-forms-setup.php +140 -0
- includes/admin/index.php +2 -0
- includes/admin/views/html-admin-notice-core-setup.php +24 -0
- includes/admin/views/html-admin-setup-footer.php +30 -0
- includes/admin/views/html-admin-setup-header.php +59 -0
- includes/admin/views/html-admin-setup-step-1.php +80 -0
- includes/admin/views/html-admin-setup-step-2.php +20 -0
- includes/admin/views/html-admin-setup-step-3.php +63 -0
- includes/auth/class-api-auth-provider-interface.php +28 -0
- includes/auth/class-crowdsignal-forms-api-authenticator.php +118 -0
- includes/auth/class-default-api-auth-provider.php +76 -0
- includes/class-autoloader.php +118 -0
- includes/class-crowdsignal-forms.php +362 -0
- includes/frontend/blocks/class-crowdsignal-forms-poll-block.php +251 -0
- includes/frontend/class-crowdsignal-forms-block.php +27 -0
- includes/frontend/class-crowdsignal-forms-blocks-assets.php +106 -0
- includes/frontend/class-crowdsignal-forms-blocks.php +45 -0
- includes/frontend/index.php +2 -0
- includes/gateways/class-api-gateway-interface.php +73 -0
- includes/gateways/class-api-gateway.php +345 -0
- includes/gateways/class-post-poll-meta-gateway.php +64 -0
- includes/gateways/index.php +3 -0
- includes/index.php +2 -0
- includes/logging/class-webservice-logger.php +82 -0
- includes/models/class-poll-answer.php +150 -0
- includes/models/class-poll-settings.php +232 -0
- includes/models/class-poll.php +277 -0
- includes/rest-api/controllers/class-account-controller.php +124 -0
- includes/rest-api/controllers/class-polls-controller.php +417 -0
- includes/rest-api/controllers/index.php +2 -0
- index.php +2 -0
- languages/crowdsignal-forms.pot +212 -0
- uninstall.php +30 -0
LICENSE.TXT
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
<one line to give the program's name and a brief idea of what it does.>
|
294 |
+
Copyright (C) <year> <name of author>
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License along
|
307 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
+
|
310 |
+
Also add information on how to contact you by electronic and paper mail.
|
311 |
+
|
312 |
+
If the program is interactive, make it output a short notice like this
|
313 |
+
when it starts in an interactive mode:
|
314 |
+
|
315 |
+
Gnomovision version 69, Copyright (C) year name of author
|
316 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
+
This is free software, and you are welcome to redistribute it
|
318 |
+
under certain conditions; type `show c' for details.
|
319 |
+
|
320 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
+
parts of the General Public License. Of course, the commands you use may
|
322 |
+
be called something other than `show w' and `show c'; they could even be
|
323 |
+
mouse-clicks or menu items--whatever suits your program.
|
324 |
+
|
325 |
+
You should also get your employer (if you work as a programmer) or your
|
326 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
+
necessary. Here is a sample; alter the names:
|
328 |
+
|
329 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
+
|
332 |
+
<signature of Ty Coon>, 1 April 1989
|
333 |
+
Ty Coon, President of Vice
|
334 |
+
|
335 |
+
This General Public License does not permit incorporating your program into
|
336 |
+
proprietary programs. If your program is a subroutine library, you may
|
337 |
+
consider it more useful to permit linking proprietary applications with the
|
338 |
+
library. If this is what you want to do, use the GNU Lesser General
|
339 |
+
Public License instead of this License.
|
README.TXT
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Crowdsignal Forms ===
|
2 |
+
Contributors: automattic
|
3 |
+
Tags: polls, forms, surveys, gutenberg, block
|
4 |
+
Requires at least: 5.0
|
5 |
+
Requires PHP: 5.6.20
|
6 |
+
Tested up to: 5.4.2
|
7 |
+
Stable tag: 0.9.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
The Crowdsignal Forms plugin allows you to create and manage polls right from within the block editor.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
The Crowdsignal Forms plugin allows you to create and manage polls right from within the block editor.
|
16 |
+
Creating polls is as simple and as fast as writing a bullet point list. No embed blocks and no copy pasting needed anymore.
|
17 |
+
|
18 |
+
Customize the look and feel of your polls to match your brand, and pick your favorite color. The poll block supports the styling of your theme by default, and from there you can customize the styling of your polls the way you want.
|
19 |
+
|
20 |
+
With Crowdsignal’s results page you can view all responses as they come in. See the geo-locations of your voters and analyze IP addresses for any suspicious voting behavior. See advanced stats and analytics for understanding your audience.
|
21 |
+
|
22 |
+
Analyze your results and then export them in a number of different formats.
|
23 |
+
|
24 |
+
Set close dates for polls, create polls with single or multiple choice answers, choose whether to show your readers the poll results or keep them private.
|
25 |
+
|
26 |
+
You can create an unlimited number of polls with a free [Crowdsignal](https://crowdsignal.com/) account and your first 2,500 signals are free. A signal is a response you get to a poll. If you are on a free plan, you still have full access to the first 2,500 signals. Any further responses you collect will still be recorded but if you [upgrade](https://crowdsignal.com/pricing/) you will get access to our unlocked reports to see them. You’ll also get access to a [range of features](https://crowdsignal.com/features/) not available to free users.
|
27 |
+
|
28 |
+
== Installation ==
|
29 |
+
|
30 |
+
The easiest way to install this plugin is through the "Add New Plugins" page on your site.
|
31 |
+
1. Go to the Plugins page and click "Add New".
|
32 |
+
2. Type "Crowdsignal Forms" in the search box and press return.
|
33 |
+
3. Click the "Install Now" button.
|
34 |
+
|
35 |
+
Once installed you must connect your site to Crowdsignal.com
|
36 |
+
1. Activate the plugin and you will be brought to the Getting Started page.
|
37 |
+
2. Click "Let's get started" to open a popup that will allow you to login or create a new Crowdsignal account.
|
38 |
+
3. You'll be presented with an API key to use so press Connect and you'll be brought back to your own site.
|
39 |
+
4. The popup will disappear and the message, "You’re ready to start using Crowdsignal!" will be shown.
|
40 |
+
5. Happy polling! Create a post and add a new "poll" block!
|
41 |
+
|
42 |
+
|
43 |
+
== Frequently Asked Questions ==
|
44 |
+
|
45 |
+
= Why Crowdsignal Forms?
|
46 |
+
|
47 |
+
We’re starting with just the Crowdsignal poll block but more blocks are coming soon.
|
48 |
+
|
49 |
+
= Who is Crowdsignal?
|
50 |
+
|
51 |
+
Crowdsignal is built by Automattic, the company behind WordPress.com, WooCommerce, Tumblr and more. We’re here to stay!
|
52 |
+
|
53 |
+
= Where can I find help with this plugin?
|
54 |
+
|
55 |
+
Automattic is a distributed team working from all around the world, so it’s always business hours for our more than 250 Happiness Engineers. Check out our [support documentation](https://crowdsignal.com/support/), the [support forum](https://wordpress.org/support/plugin/crowdsignal-forms/) or [reach out to us](https://crowdsignal.com/contact/) anytime and we'll be happy to help.
|
56 |
+
|
57 |
+
= What plans do you offer?
|
58 |
+
Compare our [simple and affordable plans](https://crowdsignal.com/pricing/) or take a [product tour](https://crowdsignal.com/features/) to learn more.
|
59 |
+
|
60 |
+
|
61 |
+
== Screenshots ==
|
62 |
+
|
63 |
+
1. Create and style your polls from within the block editor
|
64 |
+
2. Analyze your results and export them everywhere
|
65 |
+
3. Your polls adopt your theme style
|
66 |
+
4. Use the poll block inside of other blocks
|
67 |
+
|
68 |
+
== Changelog ==
|
69 |
+
|
70 |
+
= 0.9 =
|
71 |
+
* Initial release
|
72 |
+
|
73 |
+
== Upgrade Notice ==
|
74 |
+
|
75 |
+
= 0.9 =
|
76 |
+
Initial release
|
77 |
+
|
build/editor.asset.php
ADDED
@@ -0,0 +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' => '30f318be3f7e7d5949fa7cee088a783a');
|
build/editor.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="full"] .wp-block-crowdsignal-forms-poll{border-left-width:0;border-right-width:0}@media screen and (min-width: 660px){#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="wide"] .wp-block-crowdsignal-forms-poll__content,#editor .editor-styles-wrapper .block-editor-block-list__block[data-type="crowdsignal-forms/poll"][data-align="full"] .wp-block-crowdsignal-forms-poll__content{padding:80px}}#editor .editor-styles-wrapper .wp-block-crowdsignal-forms-poll__answer{cursor:text}#editor .editor-styles-wrapper .wp-block-crowdsignal-forms-poll__answer:hover,#editor .editor-styles-wrapper .wp-block-crowdsignal-forms-poll__answer.is-focused{color:inherit}#editor .editor-styles-wrapper .wp-block-button .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{cursor:text}.wp-block-crowdsignal-forms__redirect-url input[type="text"]{width:100%}.wp-block-crowdsignal-forms__redirect-url__suggestions{width:260px}.wp-block-crowdsignal-forms__row{display:flex;flex-direction:row}.wp-block-crowdsignal-forms__row .wp-block-crowdsignal-forms__small-text-input input[type="text"]{width:40px}.wp-block-crowdsignal-forms__row .wp-block-crowdsignal-forms__small-text-input input[type="number"]{width:50px}.wp-block-crowdsignal-forms-poll__edit-bar{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:13px;margin-top:24px;padding:18px 24px;color:#d82e20;border-left:4px solid #d82e20;background:#f8dad8;display:flex;flex-direction:row;justify-content:space-between;align-items:center}.wp-block-crowdsignal-forms-poll__edit-bar .wp-block-crowdsignal-forms-poll__edit-bar-message{padding-inline-end:24px}.wp-block-crowdsignal-forms-poll__edit-bar button.wp-block-crowdsignal-forms-poll__edit-bar-button{border:2px solid #d82e20;border-radius:4px;color:#d82e20;background:transparent;padding:8px 16px;cursor:pointer}.wp-block-crowdsignal-forms__view-results.is-disabled{opacity:0.5;pointer-events:none}.wp-block-crowdsignal-forms__connect-to-crowdsignal{border:1px solid #000;font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;padding:24px;text-align:initial}.wp-block-crowdsignal-forms__connect-to-crowdsignal-header{display:flex;flex-direction:row;align-items:center}.wp-block-crowdsignal-forms__connect-to-crowdsignal-body{font-size:13px;margin-top:24px;margin-bottom:16px}.wp-block-crowdsignal-forms__connect-to-crowdsignal-title{font-size:24pt;margin-inline-start:16px}.wp-block-crowdsignal-forms-poll{border-color:var(--crowdsignal-forms-border-color);border-style:solid;border-width:var(--crowdsignal-forms-border-width);margin-top:1.25em;margin-bottom:1.25em;position:relative;text-align:left}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll{border-left-width:0;border-right-width:0}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question{margin:0 0 28px}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question:first-child{margin-top:0}.wp-block-crowdsignal-forms-poll p.wp-block-crowdsignal-forms-poll__note{font-style:italic;margin:0 0 32px}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:40px 24px 16px 24px}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{margin:0 auto;max-width:var(--crowdsignal-forms-content-wide-width)}@media screen and (min-width: 660px){.alignwide.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content,.alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:80px}}.wp-block-crowdsignal-forms-poll.is-closed .wp-block-crowdsignal-forms-poll__form{opacity:0.5}.wp-block-crowdsignal-forms-poll.is-hidden{opacity:0.5}.wp-block-crowdsignal-forms-poll.has-font-family .wp-block-crowdsignal-forms-poll__answer-label-wrapper,.wp-block-crowdsignal-forms-poll.has-font-family .wp-block-crowdsignal-forms-poll__question,.wp-block-crowdsignal-forms-poll.has-font-family .wp-block-crowdsignal-forms-poll__note{font-family:var(--crowdsignal-forms-font-family)}.wp-block-crowdsignal-forms-poll.has-text-color{color:var(--crowdsignal-forms-text-color)}.wp-block-crowdsignal-forms-poll.has-bg-color{background-color:var(--crowdsignal-forms-bg-color)}.wp-block-crowdsignal-forms-poll.has-border-radius{border-radius:var(--crowdsignal-forms-border-radius);overflow:hidden}.wp-block-crowdsignal-forms-poll.has-box-shadow{box-shadow:0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23)}.wp-block-crowdsignal-forms-poll__submit-button:disabled{opacity:0.7}.wp-block-crowdsignal-forms-poll.has-submit-button-bg-color .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{background-color:var(--crowdsignal-forms-submit-button-bg-color)}.wp-block-crowdsignal-forms-poll.has-submit-button-text-color .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{color:var(--crowdsignal-forms-submit-button-text-color)}.wp-block-crowdsignal-forms-poll__answer{cursor:pointer;display:flex;font-size:inherit;font-weight:600;margin:0 0 16px;padding:0 2px;position:relative}.wp-block-crowdsignal-forms-poll__answer:hover,.wp-block-crowdsignal-forms-poll__answer.is-focused{color:var(--crowdsignal-forms-submit-button-bg-color)}.has-voted .wp-block-crowdsignal-forms-poll__answer{opacity:0.5}input[type="checkbox"].wp-block-crowdsignal-forms-poll__input,input[type="radio"].wp-block-crowdsignal-forms-poll__input{height:0;opacity:0;position:absolute;width:0}.wp-block-crowdsignal-forms-poll__check{display:inline-block;height:1em;margin:0 10px 0 0;position:relative;width:1em}.wp-block-crowdsignal-forms-poll__check::before{background-color:transparent;border:1.5px solid var(--crowdsignal-forms-text-color);border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;transition:background-color 0.3s, border-color 0.3s;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::before{border-radius:3px}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice.is-selected .wp-block-crowdsignal-forms-poll__check::before{border-color:var(--crowdsignal-forms-border-color);background-color:var(--crowdsignal-forms-border-color)}.wp-block-crowdsignal-forms-poll__answer.is-selected:not(.is-multiple-choice) .wp-block-crowdsignal-forms-poll__check::after{animation-duration:0.3s;animation-name:crowdsignal-forms-animation__pop;animation-iteration-count:1;background-clip:padding-box;background-color:var(--crowdsignal-forms-border-color);border:4.5px solid transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;position:absolute;left:0;top:0;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-selected.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::after{border-color:var(--crowdsignal-forms-submit-button-text-color);border-style:solid;border-width:0 0 2px 2px;box-sizing:border-box;content:"";display:block;height:25%;margin:-0.1em 0 0 -0.2em;position:absolute;left:50%;top:50%;transform:rotateZ(-45deg);width:50%}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper{flex:1;word-break:break-word}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label{line-height:1;vertical-align:top}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label span::after{vertical-align:top}.wp-block-crowdsignal-forms-poll__button{border:0;padding:0}.wp-block-crowdsignal-forms-poll__actions{display:flex;justify-content:flex-end}.wp-block-crowdsignal-forms-poll__actions .wp-block-button{margin:0}.editor-styles-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__actions .wp-block-button.wp-block-crowdsignal-forms-poll__block-button{margin:0}.wp-block-crowdsignal-forms-poll__closed-banner{background-color:var(--crowdsignal-forms-border-color);box-sizing:border-box;display:flex;color:var(--crowdsignal-forms-submit-button-text-color);font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;justify-content:center;padding:calc(var(--crowdsignal-forms-border-width) + 0.2em) 0 0.2em;width:100%}.is-hidden .wp-block-crowdsignal-forms-poll__closed-banner{font-style:italic}.wp-block-crowdsignal-forms-poll__error{color:red}.wp-block-crowdsignal-forms-poll__results-list{margin:0 0 1em;position:relative}.wp-block-crowdsignal-forms-poll__answer-results{display:flex;flex-direction:column;margin:0 0 16px;width:100%}.wp-block-crowdsignal-forms-poll__answer-results:last-child{margin:0}.wp-block-crowdsignal-forms-poll__answer-results-labels{align-items:flex-end;display:flex;margin:0 0 8px;width:100%;word-break:break-word}.wp-block-crowdsignal-forms-poll__answer-results-answer{flex:1;font-size:1em;font-weight:600}.wp-block-crowdsignal-forms-poll__answer-results-votes{font-size:0.75em;line-height:2}.wp-block-crowdsignal-forms-poll__answer-results-percent{font-weight:600;line-height:1.6}.wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results-percent{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;margin-left:20px;transition:opacity 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-percent{display:none}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse;background-color:var(--crowdsignal-forms-text-color);font-size:0.7em;height:1em;width:50px}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes:last-child,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent:last-child{width:40px}.wp-block-crowdsignal-forms-poll__answer-results-progress-track{border:1px solid;border-color:rgba(var(--crowdsignal-forms-text-color-properties), 0.3);box-sizing:border-box;height:1em;width:100%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-track{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse}.wp-block-crowdsignal-forms-poll__answer-results-progress-bar{animation-fill-mode:forwards;background-color:var(--crowdsignal-forms-submit-button-bg-color);height:100%;transition:background-color 0.3s, width 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:0}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{background-color:var(--crowdsignal-forms-text-color);width:25%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+1) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:40%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+2) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:75%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+3) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:50%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+4) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:60%}.wp-block-crowdsignal-forms-poll__results-footer{display:flex;flex-direction:column;justify-content:space-between;width:100%;font-size:0.9em}.wp-block-crowdsignal-forms-poll__results-total{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;position:relative;text-align:right;width:100%;margin-bottom:1em}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total{color:transparent}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total::before{animation-name:crowdsignal-forms-animation__pulse;animation-duration:1.5s;animation-iteration-count:infinite;background-color:var(--crowdsignal-forms-text-color);content:"";display:block;position:absolute;right:0;height:1em;width:150px}.wp-block-crowdsignal-forms-poll__footer-branding{display:flex;justify-content:space-between;align-items:center;width:100%}.wp-block-crowdsignal-forms-poll__footer-branding img.wp-block-crowdsignal-forms-poll__footer-branding-logo{width:50px;height:50px;margin-left:0;margin-right:0}.wp-block-crowdsignal-forms-poll__footer-cs-link{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:16px;text-decoration:none;text-transform:uppercase}.wp-block-crowdsignal-forms-poll__footer-cs-link:not(:hover){color:var(--crowdsignal-forms-text-color);opacity:0.4}.wp-block-crowdsignal-forms-poll__error-banner{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:13px;margin-top:24px;padding:18px 24px;color:#d82e20;border-left:4px solid #d82e20;background:#f8dad8}.wp-block-crowdsignal-forms-poll__submit-message-container{position:absolute;background-color:#fff;left:0;top:0;width:100%;height:100%;overflow:hidden}.wp-block-crowdsignal-forms-poll__submit-message{position:relative}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message{position:absolute;right:0;top:0;background-color:transparent;color:#000;text-decoration:none;border:none}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message:hover{background:inherit}.wp-block-crowdsignal-forms-poll__submit-message-footer{position:absolute;bottom:0;left:0;padding:16px 24px;width:100%;background-color:#fff}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker{right:25px;top:66px}.wp-block-crowdsignal-forms-poll__thank-you-sticker{right:132px;top:12px}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker,.wp-block-crowdsignal-forms-poll__thank-you-sticker{filter:drop-shadow(0 1px 2px rgba(0,0,0,0.2));width:100px;height:100px;position:absolute}.wp-block-crowdsignal-forms-poll__custom-message-check{color:var(--crowdsignal-forms-submit-button-bg-color);padding-left:24px;padding-top:24px}.wp-block-crowdsignal-forms-poll__custom-message{font-weight:600;padding:16px 24px}.wp_block-crowdsignal-forms-poll__vote-branding{margin-top:16px}.crowdsignal-forms__style-probe{display:none}
|
build/editor.js
ADDED
@@ -0,0 +1,1105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(e, a) { for(var i in a) e[i] = a[i]; }(window, /******/ (function(modules) { // webpackBootstrap
|
2 |
+
/******/ // The module cache
|
3 |
+
/******/ var installedModules = {};
|
4 |
+
/******/
|
5 |
+
/******/ // The require function
|
6 |
+
/******/ function __webpack_require__(moduleId) {
|
7 |
+
/******/
|
8 |
+
/******/ // Check if module is in cache
|
9 |
+
/******/ if(installedModules[moduleId]) {
|
10 |
+
/******/ return installedModules[moduleId].exports;
|
11 |
+
/******/ }
|
12 |
+
/******/ // Create a new module (and put it into the cache)
|
13 |
+
/******/ var module = installedModules[moduleId] = {
|
14 |
+
/******/ i: moduleId,
|
15 |
+
/******/ l: false,
|
16 |
+
/******/ exports: {}
|
17 |
+
/******/ };
|
18 |
+
/******/
|
19 |
+
/******/ // Execute the module function
|
20 |
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21 |
+
/******/
|
22 |
+
/******/ // Flag the module as loaded
|
23 |
+
/******/ module.l = true;
|
24 |
+
/******/
|
25 |
+
/******/ // Return the exports of the module
|
26 |
+
/******/ return module.exports;
|
27 |
+
/******/ }
|
28 |
+
/******/
|
29 |
+
/******/
|
30 |
+
/******/ // expose the modules object (__webpack_modules__)
|
31 |
+
/******/ __webpack_require__.m = modules;
|
32 |
+
/******/
|
33 |
+
/******/ // expose the module cache
|
34 |
+
/******/ __webpack_require__.c = installedModules;
|
35 |
+
/******/
|
36 |
+
/******/ // define getter function for harmony exports
|
37 |
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
38 |
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
39 |
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
40 |
+
/******/ }
|
41 |
+
/******/ };
|
42 |
+
/******/
|
43 |
+
/******/ // define __esModule on exports
|
44 |
+
/******/ __webpack_require__.r = function(exports) {
|
45 |
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
46 |
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
47 |
+
/******/ }
|
48 |
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
49 |
+
/******/ };
|
50 |
+
/******/
|
51 |
+
/******/ // create a fake namespace object
|
52 |
+
/******/ // mode & 1: value is a module id, require it
|
53 |
+
/******/ // mode & 2: merge all properties of value into the ns
|
54 |
+
/******/ // mode & 4: return value when already ns object
|
55 |
+
/******/ // mode & 8|1: behave like require
|
56 |
+
/******/ __webpack_require__.t = function(value, mode) {
|
57 |
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
58 |
+
/******/ if(mode & 8) return value;
|
59 |
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
60 |
+
/******/ var ns = Object.create(null);
|
61 |
+
/******/ __webpack_require__.r(ns);
|
62 |
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
63 |
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
64 |
+
/******/ return ns;
|
65 |
+
/******/ };
|
66 |
+
/******/
|
67 |
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
68 |
+
/******/ __webpack_require__.n = function(module) {
|
69 |
+
/******/ var getter = module && module.__esModule ?
|
70 |
+
/******/ function getDefault() { return module['default']; } :
|
71 |
+
/******/ function getModuleExports() { return module; };
|
72 |
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
73 |
+
/******/ return getter;
|
74 |
+
/******/ };
|
75 |
+
/******/
|
76 |
+
/******/ // Object.prototype.hasOwnProperty.call
|
77 |
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
78 |
+
/******/
|
79 |
+
/******/ // __webpack_public_path__
|
80 |
+
/******/ __webpack_require__.p = "";
|
81 |
+
/******/
|
82 |
+
/******/
|
83 |
+
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./client/editor.js");
|
85 |
+
/******/ })
|
86 |
+
/************************************************************************/
|
87 |
+
/******/ ({
|
88 |
+
|
89 |
+
/***/ "./client/blocks/poll/attributes.js":
|
90 |
+
/*!******************************************!*\
|
91 |
+
!*** ./client/blocks/poll/attributes.js ***!
|
92 |
+
\******************************************/
|
93 |
+
/*! exports provided: default */
|
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 default: 'center'\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});\n\n//# sourceURL=webpack:///./client/blocks/poll/attributes.js?");
|
98 |
+
|
99 |
+
/***/ }),
|
100 |
+
|
101 |
+
/***/ "./client/blocks/poll/connect-to-crowdsignal.js":
|
102 |
+
/*!******************************************************!*\
|
103 |
+
!*** ./client/blocks/poll/connect-to-crowdsignal.js ***!
|
104 |
+
\******************************************************/
|
105 |
+
/*! exports provided: default */
|
106 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
107 |
+
|
108 |
+
"use strict";
|
109 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ \"@wordpress/components\");\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var components_icon_poll__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! components/icon/poll */ \"./client/components/icon/poll.js\");\n/* harmony import */ var data_hooks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! data/hooks */ \"./client/data/hooks/index.js\");\n\n\n\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\nvar ConnectToCrowdsignal = function ConnectToCrowdsignal(props) {\n var _useIsCsConnected = Object(data_hooks__WEBPACK_IMPORTED_MODULE_6__[\"useIsCsConnected\"])(),\n isConnected = _useIsCsConnected.isConnected,\n checkIsConnected = _useIsCsConnected.checkIsConnected;\n\n var handleConnectClick = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() {\n var isNowConnected;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return checkIsConnected();\n\n case 2:\n isNowConnected = _context.sent;\n\n if (!isNowConnected) {\n window.open('/wp-admin/admin.php?page=crowdsignal-forms-setup');\n }\n\n case 4:\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) {\n return props.children;\n }\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__connect-to-crowdsignal\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__connect-to-crowdsignal-header\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(components_icon_poll__WEBPACK_IMPORTED_MODULE_5__[\"default\"], null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__connect-to-crowdsignal-title\"\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_4__[\"__\"])('Crowdsignal Poll'))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__connect-to-crowdsignal-body\"\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_4__[\"__\"])('You need to connect to a Crowdsignal account for collecting and managing your results.')), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"Button\"], {\n isPrimary: true,\n onClick: handleConnectClick\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_4__[\"__\"])('Connect to Crowdsignal')));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (ConnectToCrowdsignal);\n\n//# sourceURL=webpack:///./client/blocks/poll/connect-to-crowdsignal.js?");
|
110 |
+
|
111 |
+
/***/ }),
|
112 |
+
|
113 |
+
/***/ "./client/blocks/poll/constants.js":
|
114 |
+
/*!*****************************************!*\
|
115 |
+
!*** ./client/blocks/poll/constants.js ***!
|
116 |
+
\*****************************************/
|
117 |
+
/*! exports provided: ConfirmMessageType, FontFamilyType, FontFamilyMap, PollStatus, ClosedPollState */
|
118 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
119 |
+
|
120 |
+
"use strict";
|
121 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConfirmMessageType\", function() { return ConfirmMessageType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FontFamilyType\", function() { return FontFamilyType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FontFamilyMap\", function() { return FontFamilyMap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PollStatus\", function() { return PollStatus; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClosedPollState\", function() { return ClosedPollState; });\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);\n\n\nvar _Object$freeze;\n\nvar ConfirmMessageType = Object.freeze({\n THANK_YOU: 'thank-you',\n CUSTOM_TEXT: 'custom-text',\n REDIRECT: 'redirect',\n RESULTS: 'results'\n});\nvar FontFamilyType = Object.freeze({\n THEME_DEFAULT: 'theme-default',\n GEORGIA: 'georgia',\n PALATINO: 'palatino',\n TIMES_NEW_ROMAN: 'times-new-roman',\n ARIAL: 'arial',\n IMPACT: 'impact',\n LUCIDA: 'lucida',\n TAHOMA: 'tahoma',\n TREBUCHET: 'trebuchet',\n VERDANA: 'verdana',\n COURIER: 'courier'\n});\nvar FontFamilyMap = Object.freeze((_Object$freeze = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.THEME_DEFAULT, null), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.GEORGIA, 'Georgia, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.PALATINO, '\"Palatino Linotype\", \"Book Antiqua\", Palatino, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TIMES_NEW_ROMAN, '\"Times New Roman\", Times, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.ARIAL, 'Arial, Helvetica, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.IMPACT, 'Impact, Charcoal, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.LUCIDA, '\"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TAHOMA, 'Tahoma, Geneva, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TREBUCHET, '\"Trebuchet MS\", Helvetica, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.VERDANA, 'Verdana, Geneva, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.COURIER, '\"Courier New\", Courier, monospace'), _Object$freeze));\nvar PollStatus = Object.freeze({\n OPEN: 'open',\n CLOSED: 'closed',\n CLOSED_AFTER: 'closed-after'\n});\nvar ClosedPollState = Object.freeze({\n SHOW_RESULTS: 'show-results',\n SHOW_CLOSED_BANNER: 'show-closed-banner',\n HIDDEN: 'hidden'\n});\n\n//# sourceURL=webpack:///./client/blocks/poll/constants.js?");
|
122 |
+
|
123 |
+
/***/ }),
|
124 |
+
|
125 |
+
/***/ "./client/blocks/poll/edit-answer.js":
|
126 |
+
/*!*******************************************!*\
|
127 |
+
!*** ./client/blocks/poll/edit-answer.js ***!
|
128 |
+
\*******************************************/
|
129 |
+
/*! exports provided: default */
|
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()('wp-block-crowdsignal-forms-poll__answer', {\n 'is-multiple-choice': isMultipleChoice\n });\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"div\", {\n className: classes\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"span\", {\n className: \"wp-block-crowdsignal-forms-poll__check\"\n }), !disabled ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__answer-label-wrapper\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__[\"RichText\"], {\n className: \"wp-block-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\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__answer-label-wrapper\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"span\", {\n className: \"wp-block-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/* harmony default export */ __webpack_exports__[\"default\"] = (EditAnswer);\n\n//# sourceURL=webpack:///./client/blocks/poll/edit-answer.js?");
|
134 |
+
|
135 |
+
/***/ }),
|
136 |
+
|
137 |
+
/***/ "./client/blocks/poll/edit-answers.js":
|
138 |
+
/*!********************************************!*\
|
139 |
+
!*** ./client/blocks/poll/edit-answers.js ***!
|
140 |
+
\********************************************/
|
141 |
+
/*! exports provided: default */
|
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 _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 _edit_answer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./edit-answer */ \"./client/blocks/poll/edit-answer.js\");\n/* harmony import */ var components_poll_util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! components/poll/util */ \"./client/components/poll/util.js\");\n\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\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 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_6__[\"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 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: \"wp-block-crowdsignal-forms-poll__options\"\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_5__[\"default\"], {\n key: \"poll-answer-\".concat(index),\n answer: answer,\n index: index,\n isMultipleChoice: attributes.isMultipleChoice,\n onChange: handleChangeAnswer,\n onDelete: handleDeleteAnswer,\n onNewAnswer: handleNewAnswer,\n disabled: disabled\n });\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__actions\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(\"div\", {\n className: \"wp-block-button wp-block-crowdsignal-forms-poll__block-button\"\n }, !disabled ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"RichText\"], {\n className: \"wp-block-button__link wp-block-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 wp-block-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 |
+
|
149 |
+
/***/ "./client/blocks/poll/edit-bar.js":
|
150 |
+
/*!****************************************!*\
|
151 |
+
!*** ./client/blocks/poll/edit-bar.js ***!
|
152 |
+
\****************************************/
|
153 |
+
/*! exports provided: default */
|
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: \"wp-block-crowdsignal-forms-poll__edit-bar\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-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: \"wp-block-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 |
+
|
161 |
+
/***/ "./client/blocks/poll/edit.js":
|
162 |
+
/*!************************************!*\
|
163 |
+
!*** ./client/blocks/poll/edit.js ***!
|
164 |
+
\************************************/
|
165 |
+
/*! exports provided: default */
|
166 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
167 |
+
|
168 |
+
"use strict";
|
169 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/block-editor */ \"@wordpress/block-editor\");\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/data */ \"@wordpress/data\");\n/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var components_poll_closed_banner__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! components/poll/closed-banner */ \"./client/components/poll/closed-banner.js\");\n/* harmony import */ var components_poll_styles__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! components/poll/styles */ \"./client/components/poll/styles.js\");\n/* harmony import */ var components_poll_results__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! components/poll/results */ \"./client/components/poll/results.js\");\n/* harmony import */ var components_poll_util__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! components/poll/util */ \"./client/components/poll/util.js\");\n/* harmony import */ var components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! components/with-fallback-styles */ \"./client/components/with-fallback-styles/index.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var _edit_answers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./edit-answers */ \"./client/blocks/poll/edit-answers.js\");\n/* harmony import */ var _sidebar__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./sidebar */ \"./client/blocks/poll/sidebar.js\");\n/* harmony import */ var _toolbar__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./toolbar */ \"./client/blocks/poll/toolbar.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./util */ \"./client/blocks/poll/util.js\");\n/* harmony import */ var components_poll_error_banner__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! components/poll/error-banner */ \"./client/components/poll/error-banner.js\");\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/index.js\");\n/* harmony import */ var _edit_bar__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./edit-bar */ \"./client/blocks/poll/edit-bar.js\");\n/* harmony import */ var _subscriptions__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./subscriptions */ \"./client/blocks/poll/subscriptions.js\");\n/* harmony import */ var _connect_to_crowdsignal__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./connect-to-crowdsignal */ \"./client/blocks/poll/connect-to-crowdsignal.js\");\n\n\n\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n/**\n * External dependencies\n */\n\n\n/**\n * WordPress dependencies\n */\n\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nObject(_subscriptions__WEBPACK_IMPORTED_MODULE_23__[\"startSubscriptions\"])();\n\nvar withPollAndAnswerIds = function withPollAndAnswerIds(Element) {\n return function (props) {\n var attributes = props.attributes,\n setAttributes = props.setAttributes;\n Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useEffect\"])(function () {\n if (!attributes.pollId) {\n var thePollId = Object(uuid__WEBPACK_IMPORTED_MODULE_21__[\"v4\"])();\n setAttributes({\n pollId: thePollId\n });\n }\n\n if (Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"some\"])(attributes.answers, function (a) {\n return !a.answerId && a.text;\n })) {\n var answers = Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"map\"])(attributes.answers, function (answer) {\n if (answer.answerId || !answer.text) {\n return answer;\n }\n\n var answerId = Object(uuid__WEBPACK_IMPORTED_MODULE_21__[\"v4\"])();\n return _objectSpread({}, answer, {\n answerId: answerId\n });\n });\n setAttributes({\n answers: answers\n });\n }\n });\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(Element, props);\n };\n};\n\nvar PollBlock = function PollBlock(props) {\n var attributes = props.attributes,\n className = props.className,\n fallbackStyles = props.fallbackStyles,\n isSelected = props.isSelected,\n setAttributes = props.setAttributes,\n renderStyleProbe = props.renderStyleProbe,\n pollDataFromApi = props.pollDataFromApi;\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useState\"])(true),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),\n isPollEditable = _useState2[0],\n setIsPollEditable = _useState2[1];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useState\"])(''),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),\n errorMessage = _useState4[0],\n setErrorMessage = _useState4[1];\n\n var viewResultsUrl = pollDataFromApi ? pollDataFromApi.viewResultsUrl : '';\n var pollIdFromApi = pollDataFromApi ? pollDataFromApi.id : null;\n var answerIdMap = {};\n\n if (pollDataFromApi) {\n Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"map\"])(pollDataFromApi.answers, function (answer) {\n answerIdMap[answer.client_id] = answer.id;\n });\n }\n\n var handleChangeQuestion = function handleChangeQuestion(question) {\n return setAttributes({\n question: question\n });\n };\n\n var handleChangeNote = function handleChangeNote(note) {\n return setAttributes({\n note: note\n });\n };\n\n var isClosed = Object(_util__WEBPACK_IMPORTED_MODULE_19__[\"isPollClosed\"])(attributes.pollStatus, attributes.closedAfterDateTime);\n var showNote = attributes.note || isSelected && isPollEditable;\n var showResults = isClosed && _constants__WEBPACK_IMPORTED_MODULE_15__[\"ClosedPollState\"].SHOW_RESULTS === attributes.closedPollState;\n var isHidden = isClosed && _constants__WEBPACK_IMPORTED_MODULE_15__[\"ClosedPollState\"].HIDDEN === attributes.closedPollState;\n var hideBranding = true; // hide branding in editor for now\n\n var postDetails = wp.data.select('core/editor').getCurrentPost();\n var wasBlockAddedBeforeLastPublish = 'publish' === postDetails.status && Object(_util__WEBPACK_IMPORTED_MODULE_19__[\"pollIdExistsInPageContent\"])(attributes.pollId, postDetails.content);\n Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useEffect\"])(function () {\n return setIsPollEditable(!wasBlockAddedBeforeLastPublish);\n }, [isSelected]);\n var showEditBar = isSelected && wasBlockAddedBeforeLastPublish && !isPollEditable;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_connect_to_crowdsignal__WEBPACK_IMPORTED_MODULE_24__[\"default\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_toolbar__WEBPACK_IMPORTED_MODULE_18__[\"default\"], props), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_sidebar__WEBPACK_IMPORTED_MODULE_17__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, props, {\n viewResultsUrl: viewResultsUrl\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: Object(_util__WEBPACK_IMPORTED_MODULE_19__[\"getBlockCssClasses\"])(attributes, className, {\n 'is-selected-in-editor': isSelected,\n 'is-closed': isClosed,\n 'is-hidden': isHidden\n }),\n style: Object(_util__WEBPACK_IMPORTED_MODULE_19__[\"getStyleVars\"])(attributes, fallbackStyles)\n }, showEditBar && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_edit_bar__WEBPACK_IMPORTED_MODULE_22__[\"default\"], {\n onEditClick: function onEditClick() {\n setIsPollEditable(true);\n }\n }), errorMessage && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(components_poll_error_banner__WEBPACK_IMPORTED_MODULE_20__[\"default\"], null, errorMessage), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__content\"\n }, isPollEditable ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__[\"RichText\"], {\n tagName: \"h3\",\n className: \"wp-block-crowdsignal-forms-poll__question\",\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_14__[\"__\"])('Enter your question'),\n onChange: handleChangeQuestion,\n value: attributes.question,\n allowedFormats: []\n }) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"h3\", {\n className: \"wp-block-crowdsignal-forms-poll__question\"\n }, attributes.question ? Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8__[\"decodeEntities\"])(attributes.question) : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_14__[\"__\"])('Enter your question')), showNote && (isPollEditable ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__[\"RichText\"], {\n tagName: \"p\",\n className: \"wp-block-crowdsignal-forms-poll__note\",\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_14__[\"__\"])('Add a note (optional)'),\n onChange: handleChangeNote,\n value: attributes.note,\n allowedFormats: []\n }) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"p\", {\n className: \"wp-block-crowdsignal-forms-poll__note\"\n }, attributes.note ? Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_8__[\"decodeEntities\"])(attributes.note) : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_14__[\"__\"])('Add a note (optional)'))), !showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_edit_answers__WEBPACK_IMPORTED_MODULE_16__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, props, {\n setAttributes: setAttributes,\n disabled: !isPollEditable\n })), showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(components_poll_results__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n answers: Object(components_poll_util__WEBPACK_IMPORTED_MODULE_12__[\"addApiAnswerIds\"])(Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"filter\"])(attributes.answers, function (answer) {\n return !Object(components_poll_util__WEBPACK_IMPORTED_MODULE_12__[\"isAnswerEmpty\"])(answer);\n }), answerIdMap),\n pollIdFromApi: pollIdFromApi,\n hideBranding: hideBranding,\n setErrorMessage: setErrorMessage\n })), isClosed && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(components_poll_closed_banner__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n isPollHidden: isHidden,\n isPollClosed: isClosed\n }), renderStyleProbe()));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_13__[\"withFallbackStyles\"])(components_poll_styles__WEBPACK_IMPORTED_MODULE_10__[\"PollStyles\"], components_poll_styles__WEBPACK_IMPORTED_MODULE_10__[\"getPollStyles\"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_7__[\"withSelect\"])(function (select, ownProps) {\n var attributes = ownProps.attributes;\n var pollDataFromApi = attributes.pollId ? select('crowdsignal-forms/polls').getPollDataByClientId(attributes.pollId) : null;\n return {\n pollDataFromApi: pollDataFromApi\n };\n})(withPollAndAnswerIds(PollBlock))));\n\n//# sourceURL=webpack:///./client/blocks/poll/edit.js?");
|
170 |
+
|
171 |
+
/***/ }),
|
172 |
+
|
173 |
+
/***/ "./client/blocks/poll/index.js":
|
174 |
+
/*!*************************************!*\
|
175 |
+
!*** ./client/blocks/poll/index.js ***!
|
176 |
+
\*************************************/
|
177 |
+
/*! exports provided: default */
|
178 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
179 |
+
|
180 |
+
"use strict";
|
181 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var components_icon_poll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! components/icon/poll */ \"./client/components/icon/poll.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store */ \"./client/blocks/poll/store.js\");\n/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./edit */ \"./client/blocks/poll/edit.js\");\n/* harmony import */ var _attributes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./attributes */ \"./client/blocks/poll/attributes.js\");\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Poll'),\n description: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Create polls and get your audience’s opinion — powered by Crowdsignal.'),\n category: 'widgets',\n icon: Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(components_icon_poll__WEBPACK_IMPORTED_MODULE_1__[\"default\"], null),\n edit: _edit__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n attributes: _attributes__WEBPACK_IMPORTED_MODULE_5__[\"default\"],\n supports: {\n align: ['center', 'wide', 'full']\n },\n getEditWrapperProps: function getEditWrapperProps(_ref) {\n var align = _ref.align;\n return {\n 'data-align': align\n };\n },\n example: {\n attributes: {\n question: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('How did you hear about us?'),\n answers: [{\n text: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Search')\n }, {\n text: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Friend')\n }, {\n text: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('Email')\n }]\n }\n }\n});\n\n//# sourceURL=webpack:///./client/blocks/poll/index.js?");
|
182 |
+
|
183 |
+
/***/ }),
|
184 |
+
|
185 |
+
/***/ "./client/blocks/poll/sidebar.js":
|
186 |
+
/*!***************************************!*\
|
187 |
+
!*** ./client/blocks/poll/sidebar.js ***!
|
188 |
+
\***************************************/
|
189 |
+
/*! exports provided: default */
|
190 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
191 |
+
|
192 |
+
"use strict";
|
193 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ \"@wordpress/components\");\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ \"@wordpress/block-editor\");\n/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * WordPress dependencies\n */\n\n\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\nvar SideBar = function SideBar(_ref) {\n var _attributes$title;\n\n var attributes = _ref.attributes,\n setAttributes = _ref.setAttributes,\n fallbackBackgroundColor = _ref.fallbackBackgroundColor,\n fallbackTextColor = _ref.fallbackTextColor,\n fallbackSubmitButtonBackgroundColor = _ref.fallbackSubmitButtonBackgroundColor,\n fallbackSubmitButtonTextColor = _ref.fallbackSubmitButtonTextColor,\n viewResultsUrl = _ref.viewResultsUrl;\n\n var handleChangeTitle = function handleChangeTitle(title) {\n return setAttributes({\n title: title\n });\n };\n\n var handleChangeConfirmMessageType = function handleChangeConfirmMessageType(type) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"], type) && setAttributes({\n confirmMessageType: type\n });\n };\n\n var handleChangeCustomConfirmMessage = function handleChangeCustomConfirmMessage(customConfirmMessage) {\n return setAttributes({\n customConfirmMessage: customConfirmMessage\n });\n };\n\n var handleChangeRedirectAddress = function handleChangeRedirectAddress(redirectAddress) {\n return setAttributes({\n redirectAddress: redirectAddress\n });\n };\n\n var handleChangeTextColor = function handleChangeTextColor(textColor) {\n return setAttributes({\n textColor: textColor\n });\n };\n\n var handleChangeBackgroundColor = function handleChangeBackgroundColor(backgroundColor) {\n return setAttributes({\n backgroundColor: backgroundColor\n });\n };\n\n var handleChangeBorderColor = function handleChangeBorderColor(borderColor) {\n return setAttributes({\n borderColor: borderColor\n });\n };\n\n var handleChangeBorderRadius = function handleChangeBorderRadius(borderRadius) {\n setAttributes({\n borderRadius: parseInt(borderRadius, 10) || 0\n });\n };\n\n var handleChangeBorderWidth = function handleChangeBorderWidth(borderWidth) {\n setAttributes({\n borderWidth: parseInt(borderWidth, 10) || 0\n });\n };\n\n var handleChangeFontFamily = function handleChangeFontFamily(font) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"], font) && setAttributes({\n fontFamily: font\n });\n };\n\n var handleChangeHasOneResponsePerComputer = function handleChangeHasOneResponsePerComputer(hasOneResponsePerComputer) {\n return setAttributes({\n hasOneResponsePerComputer: hasOneResponsePerComputer\n });\n };\n\n var handleChangeRandomizeAnswers = function handleChangeRandomizeAnswers(randomizeAnswers) {\n return setAttributes({\n randomizeAnswers: randomizeAnswers\n });\n };\n\n var handleChangeSubmitButtonTextColor = function handleChangeSubmitButtonTextColor(submitButtonTextColor) {\n return setAttributes({\n submitButtonTextColor: submitButtonTextColor\n });\n };\n\n var handleChangeSubmitButtonBackgroundColor = function handleChangeSubmitButtonBackgroundColor(submitButtonBackgroundColor) {\n return setAttributes({\n submitButtonBackgroundColor: submitButtonBackgroundColor\n });\n };\n\n var handleChangePollStatus = function handleChangePollStatus(pollStatus) {\n if (!Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"], pollStatus)) {\n return;\n } // closedAfterDateTime MUST be set when pollStatus is set to CLOSED_AFTER\n\n\n setAttributes({\n closedAfterDateTime: pollStatus === _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].CLOSED_AFTER ? new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString() : null,\n pollStatus: pollStatus\n });\n };\n\n var handleChangeClosedPollState = function handleChangeClosedPollState(closedPollState) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_5__[\"includes\"])(_constants__WEBPACK_IMPORTED_MODULE_7__[\"ClosedPollState\"], closedPollState) && setAttributes({\n closedPollState: closedPollState\n });\n };\n\n var handleChangeCloseAfterDateTime = function handleChangeCloseAfterDateTime(closedAfterDateTime) {\n var dateTime = new Date(closedAfterDateTime);\n setAttributes({\n closedAfterDateTime: dateTime.toISOString()\n });\n };\n\n var handleChangeHasBoxShadow = function handleChangeHasBoxShadow(hasBoxShadow) {\n setAttributes({\n hasBoxShadow: hasBoxShadow\n });\n };\n\n var resultsLinkEnabled = '' !== viewResultsUrl;\n var resultsLinkClasses = classnames__WEBPACK_IMPORTED_MODULE_2___default()('wp-block-crowdsignal-forms__view-results', {\n 'is-disabled': !resultsLinkEnabled\n });\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"InspectorControls\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Results'),\n initialOpen: true\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: resultsLinkClasses\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null, resultsLinkEnabled ? Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Manage results on: ') : Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Save this poll to enable results.'), resultsLinkEnabled && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"ExternalLink\"], {\n href: viewResultsUrl\n }, \"crowdsignal.com\")), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"Button\"], {\n href: viewResultsUrl,\n isSecondary: true,\n target: \"_blank\"\n }, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('View results')))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TextControl\"], {\n value: Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__[\"decodeEntities\"])((_attributes$title = attributes.title) !== null && _attributes$title !== void 0 ? _attributes$title : attributes.question),\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Title of the poll block'),\n onChange: handleChangeTitle\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Confirmation message'),\n initialOpen: false\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"SelectControl\"], {\n value: attributes.confirmMessageType,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('On submission'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show results'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].RESULTS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show \"Thank You\" message'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].THANK_YOU\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show a custom text message'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].CUSTOM_TEXT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Redirect to another webpage'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].REDIRECT\n }],\n onChange: handleChangeConfirmMessageType\n }), _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].CUSTOM_TEXT === attributes.confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TextareaControl\"], {\n value: attributes.customConfirmMessage,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Message text'),\n placeholder: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Thank you for your submission!'),\n onChange: handleChangeCustomConfirmMessage\n }), _constants__WEBPACK_IMPORTED_MODULE_7__[\"ConfirmMessageType\"].REDIRECT === attributes.confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"URLInput\"], {\n className: \"wp-block-crowdsignal-forms__redirect-url\",\n value: attributes.redirectAddress,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Redirect address'),\n onChange: handleChangeRedirectAddress\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Poll status'),\n initialOpen: false\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"SelectControl\"], {\n value: attributes.pollStatus,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Currently'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Open'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].OPEN\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Closed after'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].CLOSED_AFTER\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Closed'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].CLOSED\n }],\n onChange: handleChangePollStatus\n }), _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].CLOSED_AFTER === attributes.pollStatus && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TimePicker\"], {\n currentTime: attributes.closedAfterDateTime,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Close poll on'),\n onChange: handleChangeCloseAfterDateTime,\n is12Hour: true\n }), _constants__WEBPACK_IMPORTED_MODULE_7__[\"PollStatus\"].OPEN !== attributes.pollStatus && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"SelectControl\"], {\n value: attributes.closedPollState,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('When poll is closed'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show results'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ClosedPollState\"].SHOW_RESULTS\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Show poll with \"Closed\" banner'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ClosedPollState\"].SHOW_CLOSED_BANNER\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Hide poll'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"ClosedPollState\"].HIDDEN\n }],\n onChange: handleChangeClosedPollState\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"PanelColorSettings\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Block styling'),\n initialOpen: true,\n colorSettings: [{\n value: attributes.textColor,\n onChange: handleChangeTextColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Text color')\n }, {\n value: attributes.backgroundColor,\n onChange: handleChangeBackgroundColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Background color')\n }, {\n value: attributes.borderColor,\n onChange: handleChangeBorderColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Border color')\n }]\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"ContrastChecker\"], {\n textColor: attributes.textColor,\n backgroundColor: attributes.backgroundColor,\n fallbackBackgroundColor: fallbackBackgroundColor,\n fallbackTextColor: fallbackTextColor\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"SelectControl\"], {\n value: attributes.fontFamily,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Choose font'),\n options: [{\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Default theme font'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].THEME_DEFAULT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Georgia'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].GEORGIA,\n style: {\n color: 'red'\n }\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Palatino'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].PALATINO\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Times New Roman'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].TIMES_NEW_ROMAN\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Arial'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].ARIAL\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Impact'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].IMPACT\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Lucida'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].LUCIDA\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Tahoma'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].TAHOMA\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Trebuchet'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].TREBUCHET\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Verdana'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].VERDANA\n }, {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Courier'),\n value: _constants__WEBPACK_IMPORTED_MODULE_7__[\"FontFamilyType\"].COURIER\n }],\n onChange: handleChangeFontFamily\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__row\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TextControl\"], {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Border thickness'),\n value: attributes.borderWidth,\n onChange: handleChangeBorderWidth,\n type: \"number\",\n className: \"wp-block-crowdsignal-forms__small-text-input\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"TextControl\"], {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Corner radius'),\n value: attributes.borderRadius,\n onChange: handleChangeBorderRadius,\n type: \"number\",\n className: \"wp-block-crowdsignal-forms__small-text-input\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"ToggleControl\"], {\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Drop shadow'),\n checked: attributes.hasBoxShadow,\n onChange: handleChangeHasBoxShadow\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"PanelColorSettings\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Button styling'),\n initialOpen: false,\n colorSettings: [{\n value: attributes.submitButtonTextColor,\n onChange: handleChangeSubmitButtonTextColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Text color')\n }, {\n value: attributes.submitButtonBackgroundColor,\n onChange: handleChangeSubmitButtonBackgroundColor,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Background color')\n }]\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__[\"ContrastChecker\"], {\n textColor: attributes.submitButtonTextColor,\n backgroundColor: attributes.submitButtonBackgroundColor,\n fallbackBackgroundColor: fallbackSubmitButtonBackgroundColor,\n fallbackTextColor: fallbackSubmitButtonTextColor\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"PanelBody\"], {\n title: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Answer settings'),\n initialOpen: false\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"CheckboxControl\"], {\n checked: attributes.hasOneResponsePerComputer,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('One response per computer'),\n onChange: handleChangeHasOneResponsePerComputer\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__[\"CheckboxControl\"], {\n checked: attributes.randomizeAnswers,\n label: Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Randomize answer order'),\n onChange: handleChangeRandomizeAnswers\n })));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (SideBar);\n\n//# sourceURL=webpack:///./client/blocks/poll/sidebar.js?");
|
194 |
+
|
195 |
+
/***/ }),
|
196 |
+
|
197 |
+
/***/ "./client/blocks/poll/store.js":
|
198 |
+
/*!*************************************!*\
|
199 |
+
!*** ./client/blocks/poll/store.js ***!
|
200 |
+
\*************************************/
|
201 |
+
/*! exports provided: default */
|
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_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\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 * 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 DEFAULT_STATE = {\n tryFetch: false,\n isFetching: false,\n pollsByClientId: {}\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};\nvar store = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__[\"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_0___default()({}, action.clientId, action.pollData))\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 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 |
+
|
209 |
+
/***/ "./client/blocks/poll/subscriptions.js":
|
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 _select = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__[\"select\"])('core/editor'),\n isEditedPostDirty = _select.isEditedPostDirty,\n isEditedPostNew = _select.isEditedPostNew,\n isSavingPost = _select.isSavingPost,\n isCleanNewPost = _select.isCleanNewPost,\n getCurrentPostId = _select.getCurrentPostId;\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 var _select2 = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__[\"select\"])('crowdsignal-forms/polls'),\n shouldTryFetchingPollData = _select2.shouldTryFetchingPollData,\n getPollDataByClientId = _select2.getPollDataByClientId,\n isFetchingPollData = _select2.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/post-polls/\".concat(postId, \"/\").concat(pollId),\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 |
+
|
221 |
+
/***/ "./client/blocks/poll/toolbar.js":
|
222 |
+
/*!***************************************!*\
|
223 |
+
!*** ./client/blocks/poll/toolbar.js ***!
|
224 |
+
\***************************************/
|
225 |
+
/*! exports provided: default */
|
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 return setAttributes({\n isMultipleChoice: button.value\n });\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 |
+
|
233 |
+
/***/ "./client/blocks/poll/util.js":
|
234 |
+
/*!************************************!*\
|
235 |
+
!*** ./client/blocks/poll/util.js ***!
|
236 |
+
\************************************/
|
237 |
+
/*! exports provided: addAnswer, getFontFamilyFromType, getStyleVars, extractRGBColorProperties, hexToRGB, getBlockCssClasses, isPollClosed, pollIdExistsInPageContent */
|
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, fallbackColors) {\n var _attributes$borderCol, _extractRGBColorPrope;\n\n var textColor = Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"isEmpty\"])(attributes.textColor) ? fallbackColors.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 : fallbackColors.accent,\n borderRadius: \"\".concat(attributes.borderRadius, \"px\"),\n borderWidth: \"\".concat(attributes.borderWidth, \"px\"),\n bgColor: attributes.backgroundColor,\n fontFamily: getFontFamilyFromType(attributes.fontFamily),\n submitButtonBgColor: attributes.submitButtonBackgroundColor || fallbackColors.accent,\n submitButtonTextColor: attributes.submitButtonTextColor || fallbackColors.textInverted,\n textColor: textColor,\n textColorProperties: (_extractRGBColorPrope = extractRGBColorProperties(textColor)) !== null && _extractRGBColorPrope !== void 0 ? _extractRGBColorPrope : '0, 0, 0',\n contentWideWidth: fallbackColors.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-font-family': attributes.fontFamily && _constants__WEBPACK_IMPORTED_MODULE_3__[\"FontFamilyType\"].THEME_DEFAULT !== attributes.fontFamily,\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 |
+
|
245 |
+
/***/ "./client/components/icon/checklist-multiple-choice.js":
|
246 |
+
/*!*************************************************************!*\
|
247 |
+
!*** ./client/components/icon/checklist-multiple-choice.js ***!
|
248 |
+
\*************************************************************/
|
249 |
+
/*! exports provided: default */
|
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\n/* harmony default export */ __webpack_exports__[\"default\"] = (function () {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"svg\", {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n d: \"M7 10.75H5V12.75H7V10.75ZM4 9.75V13.75H8V9.75H4Z\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M4 4H8V8H4V4Z\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M4 16H8V20H4V16Z\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M20 6.75H12V5.25H20V6.75Z\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M20 12.5H12V11H20V12.5Z\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M20 18.75H12V17.25H20V18.75Z\"\n }));\n});\n\n//# sourceURL=webpack:///./client/components/icon/checklist-multiple-choice.js?");
|
254 |
+
|
255 |
+
/***/ }),
|
256 |
+
|
257 |
+
/***/ "./client/components/icon/checklist-single-choice.js":
|
258 |
+
/*!***********************************************************!*\
|
259 |
+
!*** ./client/components/icon/checklist-single-choice.js ***!
|
260 |
+
\***********************************************************/
|
261 |
+
/*! exports provided: default */
|
262 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
263 |
+
|
264 |
+
"use strict";
|
265 |
+
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\n/* harmony default export */ __webpack_exports__[\"default\"] = (function () {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"svg\", {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M20 6.75H12V5.25H20V6.75Z\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M20 12.5H12V11H20V12.5Z\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M20 18.75H12V17.25H20V18.75Z\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n d: \"M6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM6 8C7.10457 8 8 7.10457 8 6C8 4.89543 7.10457 4 6 4C4.89543 4 4 4.89543 4 6C4 7.10457 4.89543 8 6 8Z\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M6 12.75C6.55228 12.75 7 12.3023 7 11.75C7 11.1977 6.55228 10.75 6 10.75C5.44772 10.75 5 11.1977 5 11.75C5 12.3023 5.44772 12.75 6 12.75ZM6 13.75C7.10457 13.75 8 12.8546 8 11.75C8 10.6454 7.10457 9.75 6 9.75C4.89543 9.75 4 10.6454 4 11.75C4 12.8546 4.89543 13.75 6 13.75Z\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n d: \"M6 19C6.55228 19 7 18.5523 7 18C7 17.4477 6.55228 17 6 17C5.44772 17 5 17.4477 5 18C5 18.5523 5.44772 19 6 19ZM6 20C7.10457 20 8 19.1046 8 18C8 16.8954 7.10457 16 6 16C4.89543 16 4 16.8954 4 18C4 19.1046 4.89543 20 6 20Z\"\n }));\n});\n\n//# sourceURL=webpack:///./client/components/icon/checklist-single-choice.js?");
|
266 |
+
|
267 |
+
/***/ }),
|
268 |
+
|
269 |
+
/***/ "./client/components/icon/poll.js":
|
270 |
+
/*!****************************************!*\
|
271 |
+
!*** ./client/components/icon/poll.js ***!
|
272 |
+
\****************************************/
|
273 |
+
/*! exports provided: default */
|
274 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
275 |
+
|
276 |
+
"use strict";
|
277 |
+
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\n/* harmony default export */ __webpack_exports__[\"default\"] = (function () {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"svg\", {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n d: \"M5.5 6L5.5 18C5.5 18.2761 5.72386 18.5 6 18.5L18 18.5C18.2761 18.5 18.5 18.2761 18.5 18L18.5 6C18.5 5.72386 18.2761 5.5 18 5.5L6 5.5C5.72386 5.5 5.5 5.72386 5.5 6ZM4 18L4 6C4 4.89543 4.89543 4 6 4L18 4C19.1046 4 20 4.89543 20 6L20 18C20 19.1046 19.1046 20 18 20L6 20C4.89543 20 4 19.1046 4 18Z\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"rect\", {\n x: \"15\",\n y: \"17\",\n width: \"6\",\n height: \"1.5\",\n transform: \"rotate(-90 15 17)\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"rect\", {\n x: \"11.5\",\n y: \"17\",\n width: \"9\",\n height: \"1.5\",\n transform: \"rotate(-90 11.5 17)\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"rect\", {\n x: \"8\",\n y: \"17\",\n width: \"5\",\n height: \"1.5\",\n transform: \"rotate(-90 8 17)\"\n }));\n});\n\n//# sourceURL=webpack:///./client/components/icon/poll.js?");
|
278 |
+
|
279 |
+
/***/ }),
|
280 |
+
|
281 |
+
/***/ "./client/components/poll/answer-results.js":
|
282 |
+
/*!**************************************************!*\
|
283 |
+
!*** ./client/components/poll/answer-results.js ***!
|
284 |
+
\**************************************************/
|
285 |
+
/*! exports provided: default */
|
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()('wp-block-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: \"wp-block-crowdsignal-forms-poll__answer-results-labels\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"wp-block-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: \"wp-block-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: \"wp-block-crowdsignal-forms-poll__answer-results-percent\"\n }, showResults && \"\".concat(answerShare.toFixed(2), \"%\"))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__answer-results-progress-track\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-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 |
+
|
293 |
+
/***/ "./client/components/poll/closed-banner.js":
|
294 |
+
/*!*************************************************!*\
|
295 |
+
!*** ./client/components/poll/closed-banner.js ***!
|
296 |
+
\*************************************************/
|
297 |
+
/*! exports provided: default */
|
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 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 ClosedBanner = function ClosedBanner(_ref) {\n var hasVoted = _ref.hasVoted,\n isPollClosed = _ref.isPollClosed,\n isPollHidden = _ref.isPollHidden;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__closed-banner\"\n }, isPollHidden && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('This Poll is Hidden'), isPollClosed && !isPollHidden && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('This Poll is Closed'), hasVoted && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('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 |
+
|
305 |
+
/***/ "./client/components/poll/error-banner.js":
|
306 |
+
/*!************************************************!*\
|
307 |
+
!*** ./client/components/poll/error-banner.js ***!
|
308 |
+
\************************************************/
|
309 |
+
/*! exports provided: default */
|
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: \"wp-block-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 |
+
|
317 |
+
/***/ "./client/components/poll/footer-branding.js":
|
318 |
+
/*!***************************************************!*\
|
319 |
+
!*** ./client/components/poll/footer-branding.js ***!
|
320 |
+
\***************************************************/
|
321 |
+
/*! exports provided: default */
|
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: \"wp-block-crowdsignal-forms-poll__footer-branding\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"a\", {\n className: \"wp-block-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: \"wp-block-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 |
+
|
329 |
+
/***/ "./client/components/poll/results.js":
|
330 |
+
/*!*******************************************!*\
|
331 |
+
!*** ./client/components/poll/results.js ***!
|
332 |
+
\*******************************************/
|
333 |
+
/*! exports provided: default */
|
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()('wp-block-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: \"wp-block-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: \"wp-block-crowdsignal-forms-poll__results-footer\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"wp-block-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 |
+
|
341 |
+
/***/ "./client/components/poll/styles.js":
|
342 |
+
/*!******************************************!*\
|
343 |
+
!*** ./client/components/poll/styles.js ***!
|
344 |
+
\******************************************/
|
345 |
+
/*! exports provided: getPollStyles, PollStyles */
|
346 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
347 |
+
|
348 |
+
"use strict";
|
349 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getPollStyles\", function() { return getPollStyles; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PollStyles\", function() { return PollStyles; });\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! components/with-fallback-styles/util */ \"./client/components/with-fallback-styles/util.js\");\n\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\nvar getPollStyles = function getPollStyles(node) {\n if (null === node) {\n return {};\n }\n\n var buttonNode = node.querySelector('.wp-block-button__link');\n var textNode = node.querySelector('p');\n var wideContentNode = node.querySelector('.alignwide');\n return {\n accent: Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(buttonNode),\n surface: Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(textNode),\n text: window.getComputedStyle(textNode).color,\n textInverted: window.getComputedStyle(buttonNode).color,\n contentWideWidth: window.getComputedStyle(wideContentNode).maxWidth\n };\n};\nvar PollStyles = function PollStyles() {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button__link\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"entry-content\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"alignwide\"\n })));\n};\n\n//# sourceURL=webpack:///./client/components/poll/styles.js?");
|
350 |
+
|
351 |
+
/***/ }),
|
352 |
+
|
353 |
+
/***/ "./client/components/poll/util.js":
|
354 |
+
/*!****************************************!*\
|
355 |
+
!*** ./client/components/poll/util.js ***!
|
356 |
+
\****************************************/
|
357 |
+
/*! exports provided: addApiAnswerIds, shuffleWithGenerator, isAnswerEmpty */
|
358 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
359 |
+
|
360 |
+
"use strict";
|
361 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addApiAnswerIds\", function() { return addApiAnswerIds; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shuffleWithGenerator\", function() { return shuffleWithGenerator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isAnswerEmpty\", function() { return isAnswerEmpty; });\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n/**\n * External dependencies\n */\n\n/**\n * Adds api answer ids to the answer objects (when they are available).\n *\n * @param {Array} answers Answers array\n * @param {Array} answerIdMap A json object with client answer ids as keys, and API answer ids as values.\n * @return {Array} Updated answers array\n */\n\nvar addApiAnswerIds = function addApiAnswerIds(answers, answerIdMap) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"map\"])(answers, function (answer) {\n if (typeof answer.answerIdFromApi !== 'undefined') {\n return answer;\n }\n\n return _objectSpread({}, answer, {\n answerIdFromApi: answerIdMap[answer.answerId]\n });\n });\n};\n/**\n * Fisher-Yates algorithm shuffle implementation.\n * Provides a predictable way of shuffling array items given a seed.\n *\n * @param {Array} toShuffle The array to shuffle.\n * @param {Function} randomNumberGenerator A function that generates a random number (like `seedrandom`).\n * @return {Array} The shuffled array.\n */\n\nvar shuffleWithGenerator = function shuffleWithGenerator(toShuffle, randomNumberGenerator) {\n var shuffled = toShuffle.slice();\n\n for (var i = shuffled.length - 1; i > 0; i--) {\n var j = Math.floor(randomNumberGenerator() * i);\n var tmp = shuffled[i];\n shuffled[i] = shuffled[j];\n shuffled[j] = tmp;\n }\n\n return shuffled;\n};\n/**\n * Determines if an answer is considered \"empty\", based on if text is set and blank or object has no values.\n *\n * @param {*} answer The answer object.\n */\n\nvar isAnswerEmpty = function isAnswerEmpty(answer) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"isEmpty\"])(answer) || 'undefined' === typeof answer.text || null === answer.text || '' === answer.text;\n};\n\n//# sourceURL=webpack:///./client/components/poll/util.js?");
|
362 |
+
|
363 |
+
/***/ }),
|
364 |
+
|
365 |
+
/***/ "./client/components/with-fallback-styles/index.js":
|
366 |
+
/*!*********************************************************!*\
|
367 |
+
!*** ./client/components/with-fallback-styles/index.js ***!
|
368 |
+
\*********************************************************/
|
369 |
+
/*! exports provided: withFallbackStyles */
|
370 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
371 |
+
|
372 |
+
"use strict";
|
373 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"withFallbackStyles\", function() { return withFallbackStyles; });\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_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/objectWithoutProperties */ \"./node_modules/@babel/runtime/helpers/objectWithoutProperties.js\");\n/* harmony import */ var _babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_objectWithoutProperties__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 react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ \"@wordpress/components\");\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__);\n\n\n\n\n/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\n\n\n\nvar StyleProbe = function StyleProbe(_ref) {\n var children = _ref.children;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms__style-probe\"\n }, children);\n};\n\nvar withFallbackStyles = function withFallbackStyles(VirtualComponent, getStyles) {\n return function (WrappedComponent) {\n var getFallbackStyles = Object(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__[\"withFallbackStyles\"])(function (node) {\n return {\n fallbackStyles: getStyles(node.querySelector('.crowdsignal-forms__style-probe'))\n };\n });\n return getFallbackStyles(function (_ref2) {\n var fallbackStyles = _ref2.fallbackStyles,\n props = _babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1___default()(_ref2, [\"fallbackStyles\"]);\n\n var renderProbe = function renderProbe() {\n if (fallbackStyles) {\n return null;\n }\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(StyleProbe, null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(VirtualComponent, null));\n };\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(WrappedComponent, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({\n fallbackStyles: fallbackStyles || {},\n renderStyleProbe: renderProbe\n }, props));\n });\n };\n};\n\n//# sourceURL=webpack:///./client/components/with-fallback-styles/index.js?");
|
374 |
+
|
375 |
+
/***/ }),
|
376 |
+
|
377 |
+
/***/ "./client/components/with-fallback-styles/util.js":
|
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 |
+
|
389 |
+
/***/ "./client/data/hooks/index.js":
|
390 |
+
/*!************************************!*\
|
391 |
+
!*** ./client/data/hooks/index.js ***!
|
392 |
+
\************************************/
|
393 |
+
/*! exports provided: usePollResults, usePollVote, useIsCsConnected */
|
394 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
395 |
+
|
396 |
+
"use strict";
|
397 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"usePollResults\", function() { return usePollResults; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"usePollVote\", function() { return usePollVote; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"useIsCsConnected\", function() { return useIsCsConnected; });\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! js-cookie */ \"./node_modules/js-cookie/src/js.cookie.js\");\n/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(js_cookie__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var data_poll__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! data/poll */ \"./client/data/poll/index.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util */ \"./client/data/hooks/util.js\");\n\n\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar usePollResults = function usePollResults(pollId) {\n var _useFetch = Object(_util__WEBPACK_IMPORTED_MODULE_6__[\"useFetch\"])(function () {\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestResults\"])(pollId);\n }, [pollId]),\n data = _useFetch.data,\n error = _useFetch.error,\n loading = _useFetch.loading;\n\n return {\n error: error,\n loading: loading,\n results: data\n };\n};\n/**\n * React Hook that returns state variables for voting status and a function to perform a vote.\n *\n * @param {number} pollId ID of the poll being loaded.\n * @param {boolean} enableVoteRestriction sets whether or not the vote cookie is read and set\n */\n\nvar usePollVote = function usePollVote(pollId) {\n var enableVoteRestriction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var cookieName = \"cs-poll-\".concat(pollId);\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(false),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2),\n isVoting = _useState2[0],\n setIsVoting = _useState2[1];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(false),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState3, 2),\n hasVoted = _useState4[0],\n setHasVoted = _useState4[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useEffect\"])(function () {\n if (enableVoteRestriction && undefined !== js_cookie__WEBPACK_IMPORTED_MODULE_4___default.a.get(cookieName)) {\n setHasVoted(true);\n }\n }, []);\n\n var vote = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(selectedAnswerIds) {\n var nonce;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n setIsVoting(true);\n _context.next = 4;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestVoteNonce\"])(pollId);\n\n case 4:\n nonce = _context.sent;\n _context.next = 7;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestVote\"])(nonce, pollId, selectedAnswerIds);\n\n case 7:\n setHasVoted(true);\n\n if (enableVoteRestriction) {\n js_cookie__WEBPACK_IMPORTED_MODULE_4___default.a.set(cookieName, new Date().getTime(), {\n sameSite: 'Strict',\n expires: 365\n });\n }\n\n case 9:\n _context.prev = 9;\n setIsVoting(false);\n return _context.finish(9);\n\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[0,, 9, 12]]);\n }));\n\n return function vote(_x) {\n return _ref.apply(this, arguments);\n };\n }();\n\n return {\n hasVoted: hasVoted,\n isVoting: isVoting,\n vote: vote\n };\n};\nvar useIsCsConnected = function useIsCsConnected() {\n /* assume connection is enabled, so placeholder doesn't flash while we add a block and wait for the request */\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(true),\n _useState6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState5, 2),\n isConnected = _useState6[0],\n setIsConnected = _useState6[1];\n\n var checkIsConnected = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() {\n var isEnabled;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestIsCsConnected\"])();\n\n case 2:\n isEnabled = _context2.sent;\n setIsConnected(isEnabled);\n return _context2.abrupt(\"return\", isEnabled);\n\n case 5:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n return function checkIsConnected() {\n return _ref2.apply(this, arguments);\n };\n }();\n\n Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useEffect\"])(function () {\n checkIsConnected();\n }, []);\n return {\n isConnected: isConnected,\n checkIsConnected: checkIsConnected\n };\n};\n\n//# sourceURL=webpack:///./client/data/hooks/index.js?");
|
398 |
+
|
399 |
+
/***/ }),
|
400 |
+
|
401 |
+
/***/ "./client/data/hooks/util.js":
|
402 |
+
/*!***********************************!*\
|
403 |
+
!*** ./client/data/hooks/util.js ***!
|
404 |
+
\***********************************/
|
405 |
+
/*! exports provided: useFetch */
|
406 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
407 |
+
|
408 |
+
"use strict";
|
409 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"useFetch\", function() { return useFetch; });\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__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\nvar useFetch = function useFetch(fetchCallback, watchProps) {\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_1__[\"useState\"])(null),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_useState, 2),\n data = _useState2[0],\n setData = _useState2[1];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_1__[\"useState\"])(null),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_useState3, 2),\n error = _useState4[0],\n setError = _useState4[1];\n\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_1__[\"useState\"])(true),\n _useState6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_useState5, 2),\n loading = _useState6[0],\n setLoading = _useState6[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_1__[\"useEffect\"])(function () {\n setLoading(true);\n setError(null);\n setData(null);\n fetchCallback().then(setData).catch(setError).finally(function () {\n return setLoading(false);\n });\n }, watchProps);\n return {\n data: data,\n error: error,\n loading: loading\n };\n};\n\n//# sourceURL=webpack:///./client/data/hooks/util.js?");
|
410 |
+
|
411 |
+
/***/ }),
|
412 |
+
|
413 |
+
/***/ "./client/data/poll/index.js":
|
414 |
+
/*!***********************************!*\
|
415 |
+
!*** ./client/data/poll/index.js ***!
|
416 |
+
\***********************************/
|
417 |
+
/*! exports provided: requestResults, requestVoteNonce, requestVote, CrowdsignalFormsError, CrowdsignalFormsServerError, requestIsCsConnected */
|
418 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
419 |
+
|
420 |
+
"use strict";
|
421 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestResults\", function() { return requestResults; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestVoteNonce\", function() { return requestVoteNonce; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestVote\", function() { return requestVote; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrowdsignalFormsError\", function() { return CrowdsignalFormsError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrowdsignalFormsServerError\", function() { return CrowdsignalFormsServerError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestIsCsConnected\", function() { return requestIsCsConnected; });\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\");\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ \"./node_modules/@babel/runtime/helpers/inherits.js\");\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ \"./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js\");\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ \"./node_modules/@babel/runtime/helpers/getPrototypeOf.js\");\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ \"./node_modules/@babel/runtime/helpers/wrapNativeSuper.js\");\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/api-fetch */ \"@wordpress/api-fetch\");\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n\n\n\n\n\n\nfunction _createSuper(Derived) { return function () { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n/**\n * Fetch the poll results for the given pollId\n *\n * @param {number} pollId Poll ID.\n * @return {Promise} Promise that resolves to a key-value object with answer IDs and vote counts.\n */\n\nvar requestResults = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee(pollId) {\n var baseUrl;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n baseUrl = 'https://api.crowdsignal.com/v3/polls';\n return _context.abrupt(\"return\", window.fetch(\"\".concat(baseUrl, \"/\").concat(pollId, \"/results\"), {\n method: 'GET',\n headers: {\n 'content-type': 'application/json'\n }\n }).then(function (response) {\n if (response.status >= 200 && response.status < 300) {\n return response.json();\n }\n\n throw response;\n }).then(function (response) {\n if (404 === response.status) {\n // poll doesn't exist on the platform yet, return an empty result\n return {};\n } else if (response.error) {\n throw new Error(response.message);\n }\n\n return response.results.votes_by_answer;\n }));\n\n case 2:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function requestResults(_x) {\n return _ref.apply(this, arguments);\n };\n}();\nvar requestVoteNonce = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee2(pollId) {\n var hash, timestamp, respNonce, jsonNonce;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n hash = '5430eeac3911395001d731d9702fc38b'; // hash not used when format=json is passed\n\n timestamp = new Date().getTime();\n _context2.next = 4;\n return window.fetch(\"https://polldaddy.com/n/\".concat(hash, \"/\").concat(pollId, \"?\").concat(timestamp, \"&format=json\"));\n\n case 4:\n respNonce = _context2.sent;\n\n if (respNonce.ok) {\n _context2.next = 7;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 7:\n _context2.next = 9;\n return respNonce.json();\n\n case 9:\n jsonNonce = _context2.sent;\n\n if (jsonNonce.nonce) {\n _context2.next = 12;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 12:\n return _context2.abrupt(\"return\", jsonNonce.nonce);\n\n case 13:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n return function requestVoteNonce(_x2) {\n return _ref2.apply(this, arguments);\n };\n}();\nvar requestVote = /*#__PURE__*/function () {\n var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee3(nonce, pollId, selectedAnswerIds) {\n var answerString, respVote, jsonVote;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n answerString = selectedAnswerIds.join(',');\n _context3.next = 3;\n return window.fetch(\"https://polls.polldaddy.com/vote-js.php?format=json&p=\".concat(pollId, \"&b=1&a=\").concat(answerString, \"&o=&va=16&cookie=0&n=\").concat(nonce, \"&url=\").concat(encodeURIComponent(window.location)));\n\n case 3:\n respVote = _context3.sent;\n\n if (respVote.ok) {\n _context3.next = 6;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 6:\n _context3.next = 8;\n return respVote.json();\n\n case 8:\n jsonVote = _context3.sent;\n\n if (!('error' === jsonVote.status)) {\n _context3.next = 11;\n break;\n }\n\n throw new CrowdsignalFormsError(jsonVote.error);\n\n case 11:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n\n return function requestVote(_x3, _x4, _x5) {\n return _ref3.apply(this, arguments);\n };\n}();\nvar CrowdsignalFormsError = /*#__PURE__*/function (_Error) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(CrowdsignalFormsError, _Error);\n\n var _super = _createSuper(CrowdsignalFormsError);\n\n function CrowdsignalFormsError() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CrowdsignalFormsError);\n\n return _super.apply(this, arguments);\n }\n\n return CrowdsignalFormsError;\n}( /*#__PURE__*/_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4___default()(Error));\nvar CrowdsignalFormsServerError = /*#__PURE__*/function (_CrowdsignalFormsErro) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(CrowdsignalFormsServerError, _CrowdsignalFormsErro);\n\n var _super2 = _createSuper(CrowdsignalFormsServerError);\n\n function CrowdsignalFormsServerError() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CrowdsignalFormsServerError);\n\n return _super2.call(this, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Server error. Please try again.'));\n }\n\n return CrowdsignalFormsServerError;\n}(CrowdsignalFormsError);\nvar requestIsCsConnected = /*#__PURE__*/function () {\n var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee4() {\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n _context4.next = 2;\n return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default()({\n path: \"/crowdsignal-forms/v1/account/connected\",\n method: 'GET'\n });\n\n case 2:\n return _context4.abrupt(\"return\", _context4.sent);\n\n case 3:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n\n return function requestIsCsConnected() {\n return _ref4.apply(this, arguments);\n };\n}();\n\n//# sourceURL=webpack:///./client/data/poll/index.js?");
|
422 |
+
|
423 |
+
/***/ }),
|
424 |
+
|
425 |
+
/***/ "./client/editor.js":
|
426 |
+
/*!**************************!*\
|
427 |
+
!*** ./client/editor.js ***!
|
428 |
+
\**************************/
|
429 |
+
/*! no exports provided */
|
430 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
431 |
+
|
432 |
+
"use strict";
|
433 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ \"@wordpress/blocks\");\n/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var blocks_poll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! blocks/poll */ \"./client/blocks/poll/index.js\");\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\nObject(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__[\"registerBlockType\"])('crowdsignal-forms/poll', blocks_poll__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n\n//# sourceURL=webpack:///./client/editor.js?");
|
434 |
+
|
435 |
+
/***/ }),
|
436 |
+
|
437 |
+
/***/ "./client/lib/i18n/index.js":
|
438 |
+
/*!**********************************!*\
|
439 |
+
!*** ./client/lib/i18n/index.js ***!
|
440 |
+
\**********************************/
|
441 |
+
/*! exports provided: __, _n, sprintf */
|
442 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
443 |
+
|
444 |
+
"use strict";
|
445 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__\", function() { return __; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_n\", function() { return _n; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sprintf\", function() { return sprintf; });\n/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ \"@wordpress/i18n\");\n/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);\n/**\n * WordPress dependencies\n */\n\nvar __ = function __(text) {\n return Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__[\"__\"])(text, 'crowdsignal-forms');\n};\nvar _n = function _n(singular, plural, count) {\n return Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__[\"_n\"])(singular, plural, count, 'crowdsignal-forms');\n};\nvar sprintf = _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__[\"sprintf\"];\n\n//# sourceURL=webpack:///./client/lib/i18n/index.js?");
|
446 |
+
|
447 |
+
/***/ }),
|
448 |
+
|
449 |
+
/***/ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js":
|
450 |
+
/*!*****************************************************************!*\
|
451 |
+
!*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
|
452 |
+
\*****************************************************************/
|
453 |
+
/*! no static exports found */
|
454 |
+
/***/ (function(module, exports) {
|
455 |
+
|
456 |
+
eval("function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/arrayLikeToArray.js?");
|
457 |
+
|
458 |
+
/***/ }),
|
459 |
+
|
460 |
+
/***/ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js":
|
461 |
+
/*!***************************************************************!*\
|
462 |
+
!*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
|
463 |
+
\***************************************************************/
|
464 |
+
/*! no static exports found */
|
465 |
+
/***/ (function(module, exports) {
|
466 |
+
|
467 |
+
eval("function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/arrayWithHoles.js?");
|
468 |
+
|
469 |
+
/***/ }),
|
470 |
+
|
471 |
+
/***/ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js":
|
472 |
+
/*!******************************************************************!*\
|
473 |
+
!*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
|
474 |
+
\******************************************************************/
|
475 |
+
/*! no static exports found */
|
476 |
+
/***/ (function(module, exports, __webpack_require__) {
|
477 |
+
|
478 |
+
eval("var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ \"./node_modules/@babel/runtime/helpers/arrayLikeToArray.js\");\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js?");
|
479 |
+
|
480 |
+
/***/ }),
|
481 |
+
|
482 |
+
/***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js":
|
483 |
+
/*!**********************************************************************!*\
|
484 |
+
!*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
|
485 |
+
\**********************************************************************/
|
486 |
+
/*! no static exports found */
|
487 |
+
/***/ (function(module, exports) {
|
488 |
+
|
489 |
+
eval("function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/assertThisInitialized.js?");
|
490 |
+
|
491 |
+
/***/ }),
|
492 |
+
|
493 |
+
/***/ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js":
|
494 |
+
/*!*****************************************************************!*\
|
495 |
+
!*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
|
496 |
+
\*****************************************************************/
|
497 |
+
/*! no static exports found */
|
498 |
+
/***/ (function(module, exports) {
|
499 |
+
|
500 |
+
eval("function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js?");
|
501 |
+
|
502 |
+
/***/ }),
|
503 |
+
|
504 |
+
/***/ "./node_modules/@babel/runtime/helpers/classCallCheck.js":
|
505 |
+
/*!***************************************************************!*\
|
506 |
+
!*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
|
507 |
+
\***************************************************************/
|
508 |
+
/*! no static exports found */
|
509 |
+
/***/ (function(module, exports) {
|
510 |
+
|
511 |
+
eval("function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/classCallCheck.js?");
|
512 |
+
|
513 |
+
/***/ }),
|
514 |
+
|
515 |
+
/***/ "./node_modules/@babel/runtime/helpers/construct.js":
|
516 |
+
/*!**********************************************************!*\
|
517 |
+
!*** ./node_modules/@babel/runtime/helpers/construct.js ***!
|
518 |
+
\**********************************************************/
|
519 |
+
/*! no static exports found */
|
520 |
+
/***/ (function(module, exports, __webpack_require__) {
|
521 |
+
|
522 |
+
eval("var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf */ \"./node_modules/@babel/runtime/helpers/setPrototypeOf.js\");\n\nvar isNativeReflectConstruct = __webpack_require__(/*! ./isNativeReflectConstruct */ \"./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js\");\n\nfunction _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n module.exports = _construct = Reflect.construct;\n } else {\n module.exports = _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}\n\nmodule.exports = _construct;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/construct.js?");
|
523 |
+
|
524 |
+
/***/ }),
|
525 |
+
|
526 |
+
/***/ "./node_modules/@babel/runtime/helpers/defineProperty.js":
|
527 |
+
/*!***************************************************************!*\
|
528 |
+
!*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
|
529 |
+
\***************************************************************/
|
530 |
+
/*! no static exports found */
|
531 |
+
/***/ (function(module, exports) {
|
532 |
+
|
533 |
+
eval("function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/defineProperty.js?");
|
534 |
+
|
535 |
+
/***/ }),
|
536 |
+
|
537 |
+
/***/ "./node_modules/@babel/runtime/helpers/extends.js":
|
538 |
+
/*!********************************************************!*\
|
539 |
+
!*** ./node_modules/@babel/runtime/helpers/extends.js ***!
|
540 |
+
\********************************************************/
|
541 |
+
/*! no static exports found */
|
542 |
+
/***/ (function(module, exports) {
|
543 |
+
|
544 |
+
eval("function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/extends.js?");
|
545 |
+
|
546 |
+
/***/ }),
|
547 |
+
|
548 |
+
/***/ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js":
|
549 |
+
/*!***************************************************************!*\
|
550 |
+
!*** ./node_modules/@babel/runtime/helpers/getPrototypeOf.js ***!
|
551 |
+
\***************************************************************/
|
552 |
+
/*! no static exports found */
|
553 |
+
/***/ (function(module, exports) {
|
554 |
+
|
555 |
+
eval("function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/getPrototypeOf.js?");
|
556 |
+
|
557 |
+
/***/ }),
|
558 |
+
|
559 |
+
/***/ "./node_modules/@babel/runtime/helpers/inherits.js":
|
560 |
+
/*!*********************************************************!*\
|
561 |
+
!*** ./node_modules/@babel/runtime/helpers/inherits.js ***!
|
562 |
+
\*********************************************************/
|
563 |
+
/*! no static exports found */
|
564 |
+
/***/ (function(module, exports, __webpack_require__) {
|
565 |
+
|
566 |
+
eval("var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf */ \"./node_modules/@babel/runtime/helpers/setPrototypeOf.js\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/inherits.js?");
|
567 |
+
|
568 |
+
/***/ }),
|
569 |
+
|
570 |
+
/***/ "./node_modules/@babel/runtime/helpers/isNativeFunction.js":
|
571 |
+
/*!*****************************************************************!*\
|
572 |
+
!*** ./node_modules/@babel/runtime/helpers/isNativeFunction.js ***!
|
573 |
+
\*****************************************************************/
|
574 |
+
/*! no static exports found */
|
575 |
+
/***/ (function(module, exports) {
|
576 |
+
|
577 |
+
eval("function _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n}\n\nmodule.exports = _isNativeFunction;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/isNativeFunction.js?");
|
578 |
+
|
579 |
+
/***/ }),
|
580 |
+
|
581 |
+
/***/ "./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js":
|
582 |
+
/*!*************************************************************************!*\
|
583 |
+
!*** ./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js ***!
|
584 |
+
\*************************************************************************/
|
585 |
+
/*! no static exports found */
|
586 |
+
/***/ (function(module, exports) {
|
587 |
+
|
588 |
+
eval("function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nmodule.exports = _isNativeReflectConstruct;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js?");
|
589 |
+
|
590 |
+
/***/ }),
|
591 |
+
|
592 |
+
/***/ "./node_modules/@babel/runtime/helpers/iterableToArray.js":
|
593 |
+
/*!****************************************************************!*\
|
594 |
+
!*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
|
595 |
+
\****************************************************************/
|
596 |
+
/*! no static exports found */
|
597 |
+
/***/ (function(module, exports) {
|
598 |
+
|
599 |
+
eval("function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/iterableToArray.js?");
|
600 |
+
|
601 |
+
/***/ }),
|
602 |
+
|
603 |
+
/***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
|
604 |
+
/*!*********************************************************************!*\
|
605 |
+
!*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
|
606 |
+
\*********************************************************************/
|
607 |
+
/*! no static exports found */
|
608 |
+
/***/ (function(module, exports) {
|
609 |
+
|
610 |
+
eval("function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js?");
|
611 |
+
|
612 |
+
/***/ }),
|
613 |
+
|
614 |
+
/***/ "./node_modules/@babel/runtime/helpers/nonIterableRest.js":
|
615 |
+
/*!****************************************************************!*\
|
616 |
+
!*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
|
617 |
+
\****************************************************************/
|
618 |
+
/*! no static exports found */
|
619 |
+
/***/ (function(module, exports) {
|
620 |
+
|
621 |
+
eval("function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/nonIterableRest.js?");
|
622 |
+
|
623 |
+
/***/ }),
|
624 |
+
|
625 |
+
/***/ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js":
|
626 |
+
/*!******************************************************************!*\
|
627 |
+
!*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
|
628 |
+
\******************************************************************/
|
629 |
+
/*! no static exports found */
|
630 |
+
/***/ (function(module, exports) {
|
631 |
+
|
632 |
+
eval("function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableSpread;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/nonIterableSpread.js?");
|
633 |
+
|
634 |
+
/***/ }),
|
635 |
+
|
636 |
+
/***/ "./node_modules/@babel/runtime/helpers/objectWithoutProperties.js":
|
637 |
+
/*!************************************************************************!*\
|
638 |
+
!*** ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js ***!
|
639 |
+
\************************************************************************/
|
640 |
+
/*! no static exports found */
|
641 |
+
/***/ (function(module, exports, __webpack_require__) {
|
642 |
+
|
643 |
+
eval("var objectWithoutPropertiesLoose = __webpack_require__(/*! ./objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\");\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutProperties;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/objectWithoutProperties.js?");
|
644 |
+
|
645 |
+
/***/ }),
|
646 |
+
|
647 |
+
/***/ "./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js":
|
648 |
+
/*!*****************************************************************************!*\
|
649 |
+
!*** ./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js ***!
|
650 |
+
\*****************************************************************************/
|
651 |
+
/*! no static exports found */
|
652 |
+
/***/ (function(module, exports) {
|
653 |
+
|
654 |
+
eval("function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js?");
|
655 |
+
|
656 |
+
/***/ }),
|
657 |
+
|
658 |
+
/***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
|
659 |
+
/*!**************************************************************************!*\
|
660 |
+
!*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
|
661 |
+
\**************************************************************************/
|
662 |
+
/*! no static exports found */
|
663 |
+
/***/ (function(module, exports, __webpack_require__) {
|
664 |
+
|
665 |
+
eval("var _typeof = __webpack_require__(/*! ../helpers/typeof */ \"./node_modules/@babel/runtime/helpers/typeof.js\");\n\nvar assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized */ \"./node_modules/@babel/runtime/helpers/assertThisInitialized.js\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js?");
|
666 |
+
|
667 |
+
/***/ }),
|
668 |
+
|
669 |
+
/***/ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js":
|
670 |
+
/*!***************************************************************!*\
|
671 |
+
!*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
|
672 |
+
\***************************************************************/
|
673 |
+
/*! no static exports found */
|
674 |
+
/***/ (function(module, exports) {
|
675 |
+
|
676 |
+
eval("function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/setPrototypeOf.js?");
|
677 |
+
|
678 |
+
/***/ }),
|
679 |
+
|
680 |
+
/***/ "./node_modules/@babel/runtime/helpers/slicedToArray.js":
|
681 |
+
/*!**************************************************************!*\
|
682 |
+
!*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
|
683 |
+
\**************************************************************/
|
684 |
+
/*! no static exports found */
|
685 |
+
/***/ (function(module, exports, __webpack_require__) {
|
686 |
+
|
687 |
+
eval("var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles */ \"./node_modules/@babel/runtime/helpers/arrayWithHoles.js\");\n\nvar iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit */ \"./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js\");\n\nvar unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ \"./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js\");\n\nvar nonIterableRest = __webpack_require__(/*! ./nonIterableRest */ \"./node_modules/@babel/runtime/helpers/nonIterableRest.js\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/slicedToArray.js?");
|
688 |
+
|
689 |
+
/***/ }),
|
690 |
+
|
691 |
+
/***/ "./node_modules/@babel/runtime/helpers/toConsumableArray.js":
|
692 |
+
/*!******************************************************************!*\
|
693 |
+
!*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
|
694 |
+
\******************************************************************/
|
695 |
+
/*! no static exports found */
|
696 |
+
/***/ (function(module, exports, __webpack_require__) {
|
697 |
+
|
698 |
+
eval("var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles */ \"./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js\");\n\nvar iterableToArray = __webpack_require__(/*! ./iterableToArray */ \"./node_modules/@babel/runtime/helpers/iterableToArray.js\");\n\nvar unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ \"./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js\");\n\nvar nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread */ \"./node_modules/@babel/runtime/helpers/nonIterableSpread.js\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/toConsumableArray.js?");
|
699 |
+
|
700 |
+
/***/ }),
|
701 |
+
|
702 |
+
/***/ "./node_modules/@babel/runtime/helpers/typeof.js":
|
703 |
+
/*!*******************************************************!*\
|
704 |
+
!*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
|
705 |
+
\*******************************************************/
|
706 |
+
/*! no static exports found */
|
707 |
+
/***/ (function(module, exports) {
|
708 |
+
|
709 |
+
eval("function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/typeof.js?");
|
710 |
+
|
711 |
+
/***/ }),
|
712 |
+
|
713 |
+
/***/ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js":
|
714 |
+
/*!***************************************************************************!*\
|
715 |
+
!*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
|
716 |
+
\***************************************************************************/
|
717 |
+
/*! no static exports found */
|
718 |
+
/***/ (function(module, exports, __webpack_require__) {
|
719 |
+
|
720 |
+
eval("var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ \"./node_modules/@babel/runtime/helpers/arrayLikeToArray.js\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js?");
|
721 |
+
|
722 |
+
/***/ }),
|
723 |
+
|
724 |
+
/***/ "./node_modules/@babel/runtime/helpers/wrapNativeSuper.js":
|
725 |
+
/*!****************************************************************!*\
|
726 |
+
!*** ./node_modules/@babel/runtime/helpers/wrapNativeSuper.js ***!
|
727 |
+
\****************************************************************/
|
728 |
+
/*! no static exports found */
|
729 |
+
/***/ (function(module, exports, __webpack_require__) {
|
730 |
+
|
731 |
+
eval("var getPrototypeOf = __webpack_require__(/*! ./getPrototypeOf */ \"./node_modules/@babel/runtime/helpers/getPrototypeOf.js\");\n\nvar setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf */ \"./node_modules/@babel/runtime/helpers/setPrototypeOf.js\");\n\nvar isNativeFunction = __webpack_require__(/*! ./isNativeFunction */ \"./node_modules/@babel/runtime/helpers/isNativeFunction.js\");\n\nvar construct = __webpack_require__(/*! ./construct */ \"./node_modules/@babel/runtime/helpers/construct.js\");\n\nfunction _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n\n module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n\n _cache.set(Class, Wrapper);\n }\n\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n\n return _wrapNativeSuper(Class);\n}\n\nmodule.exports = _wrapNativeSuper;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/wrapNativeSuper.js?");
|
732 |
+
|
733 |
+
/***/ }),
|
734 |
+
|
735 |
+
/***/ "./node_modules/classnames/index.js":
|
736 |
+
/*!******************************************!*\
|
737 |
+
!*** ./node_modules/classnames/index.js ***!
|
738 |
+
\******************************************/
|
739 |
+
/*! no static exports found */
|
740 |
+
/***/ (function(module, exports, __webpack_require__) {
|
741 |
+
|
742 |
+
eval("var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif ( true && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (true) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n\t\t\treturn classNames;\n\t\t}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else {}\n}());\n\n\n//# sourceURL=webpack:///./node_modules/classnames/index.js?");
|
743 |
+
|
744 |
+
/***/ }),
|
745 |
+
|
746 |
+
/***/ "./node_modules/js-cookie/src/js.cookie.js":
|
747 |
+
/*!*************************************************!*\
|
748 |
+
!*** ./node_modules/js-cookie/src/js.cookie.js ***!
|
749 |
+
\*************************************************/
|
750 |
+
/*! no static exports found */
|
751 |
+
/***/ (function(module, exports, __webpack_require__) {
|
752 |
+
|
753 |
+
eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n * JavaScript Cookie v2.2.1\n * https://github.com/js-cookie/js-cookie\n *\n * Copyright 2006, 2015 Klaus Hartl & Fagner Brack\n * Released under the MIT license\n */\n;(function (factory) {\n\tvar registeredInModuleLoader;\n\tif (true) {\n\t\t!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :\n\t\t\t\t__WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\tregisteredInModuleLoader = true;\n\t}\n\tif (true) {\n\t\tmodule.exports = factory();\n\t\tregisteredInModuleLoader = true;\n\t}\n\tif (!registeredInModuleLoader) {\n\t\tvar OldCookies = window.Cookies;\n\t\tvar api = window.Cookies = factory();\n\t\tapi.noConflict = function () {\n\t\t\twindow.Cookies = OldCookies;\n\t\t\treturn api;\n\t\t};\n\t}\n}(function () {\n\tfunction extend () {\n\t\tvar i = 0;\n\t\tvar result = {};\n\t\tfor (; i < arguments.length; i++) {\n\t\t\tvar attributes = arguments[ i ];\n\t\t\tfor (var key in attributes) {\n\t\t\t\tresult[key] = attributes[key];\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tfunction decode (s) {\n\t\treturn s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);\n\t}\n\n\tfunction init (converter) {\n\t\tfunction api() {}\n\n\t\tfunction set (key, value, attributes) {\n\t\t\tif (typeof document === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tattributes = extend({\n\t\t\t\tpath: '/'\n\t\t\t}, api.defaults, attributes);\n\n\t\t\tif (typeof attributes.expires === 'number') {\n\t\t\t\tattributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);\n\t\t\t}\n\n\t\t\t// We're using \"expires\" because \"max-age\" is not supported by IE\n\t\t\tattributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';\n\n\t\t\ttry {\n\t\t\t\tvar result = JSON.stringify(value);\n\t\t\t\tif (/^[\\{\\[]/.test(result)) {\n\t\t\t\t\tvalue = result;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\n\t\t\tvalue = converter.write ?\n\t\t\t\tconverter.write(value, key) :\n\t\t\t\tencodeURIComponent(String(value))\n\t\t\t\t\t.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);\n\n\t\t\tkey = encodeURIComponent(String(key))\n\t\t\t\t.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)\n\t\t\t\t.replace(/[\\(\\)]/g, escape);\n\n\t\t\tvar stringifiedAttributes = '';\n\t\t\tfor (var attributeName in attributes) {\n\t\t\t\tif (!attributes[attributeName]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tstringifiedAttributes += '; ' + attributeName;\n\t\t\t\tif (attributes[attributeName] === true) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Considers RFC 6265 section 5.2:\n\t\t\t\t// ...\n\t\t\t\t// 3. If the remaining unparsed-attributes contains a %x3B (\";\")\n\t\t\t\t// character:\n\t\t\t\t// Consume the characters of the unparsed-attributes up to,\n\t\t\t\t// not including, the first %x3B (\";\") character.\n\t\t\t\t// ...\n\t\t\t\tstringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n\t\t\t}\n\n\t\t\treturn (document.cookie = key + '=' + value + stringifiedAttributes);\n\t\t}\n\n\t\tfunction get (key, json) {\n\t\t\tif (typeof document === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar jar = {};\n\t\t\t// To prevent the for loop in the first place assign an empty array\n\t\t\t// in case there are no cookies at all.\n\t\t\tvar cookies = document.cookie ? document.cookie.split('; ') : [];\n\t\t\tvar i = 0;\n\n\t\t\tfor (; i < cookies.length; i++) {\n\t\t\t\tvar parts = cookies[i].split('=');\n\t\t\t\tvar cookie = parts.slice(1).join('=');\n\n\t\t\t\tif (!json && cookie.charAt(0) === '\"') {\n\t\t\t\t\tcookie = cookie.slice(1, -1);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tvar name = decode(parts[0]);\n\t\t\t\t\tcookie = (converter.read || converter)(cookie, name) ||\n\t\t\t\t\t\tdecode(cookie);\n\n\t\t\t\t\tif (json) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tcookie = JSON.parse(cookie);\n\t\t\t\t\t\t} catch (e) {}\n\t\t\t\t\t}\n\n\t\t\t\t\tjar[name] = cookie;\n\n\t\t\t\t\tif (key === name) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {}\n\t\t\t}\n\n\t\t\treturn key ? jar[key] : jar;\n\t\t}\n\n\t\tapi.set = set;\n\t\tapi.get = function (key) {\n\t\t\treturn get(key, false /* read as raw */);\n\t\t};\n\t\tapi.getJSON = function (key) {\n\t\t\treturn get(key, true /* read as json */);\n\t\t};\n\t\tapi.remove = function (key, attributes) {\n\t\t\tset(key, '', extend(attributes, {\n\t\t\t\texpires: -1\n\t\t\t}));\n\t\t};\n\n\t\tapi.defaults = {};\n\n\t\tapi.withConverter = init;\n\n\t\treturn api;\n\t}\n\n\treturn init(function () {});\n}));\n\n\n//# sourceURL=webpack:///./node_modules/js-cookie/src/js.cookie.js?");
|
754 |
+
|
755 |
+
/***/ }),
|
756 |
+
|
757 |
+
/***/ "./node_modules/object-assign/index.js":
|
758 |
+
/*!*********************************************!*\
|
759 |
+
!*** ./node_modules/object-assign/index.js ***!
|
760 |
+
\*********************************************/
|
761 |
+
/*! no static exports found */
|
762 |
+
/***/ (function(module, exports, __webpack_require__) {
|
763 |
+
|
764 |
+
"use strict";
|
765 |
+
eval("/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\n\n//# sourceURL=webpack:///./node_modules/object-assign/index.js?");
|
766 |
+
|
767 |
+
/***/ }),
|
768 |
+
|
769 |
+
/***/ "./node_modules/prop-types/checkPropTypes.js":
|
770 |
+
/*!***************************************************!*\
|
771 |
+
!*** ./node_modules/prop-types/checkPropTypes.js ***!
|
772 |
+
\***************************************************/
|
773 |
+
/*! no static exports found */
|
774 |
+
/***/ (function(module, exports, __webpack_require__) {
|
775 |
+
|
776 |
+
"use strict";
|
777 |
+
eval("/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nvar printWarning = function() {};\n\nif (undefined !== 'production') {\n var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ \"./node_modules/prop-types/lib/ReactPropTypesSecret.js\");\n var loggedTypeFailures = {};\n var has = Function.call.bind(Object.prototype.hasOwnProperty);\n\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n}\n\n/**\n * Assert that the values match with the type specs.\n * Error messages are memorized and will only be shown once.\n *\n * @param {object} typeSpecs Map of name to a ReactPropType\n * @param {object} values Runtime values that need to be type-checked\n * @param {string} location e.g. \"prop\", \"context\", \"child context\"\n * @param {string} componentName Name of the component for error messages.\n * @param {?Function} getStack Returns the component stack.\n * @private\n */\nfunction checkPropTypes(typeSpecs, values, location, componentName, getStack) {\n if (undefined !== 'production') {\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error;\n // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n var err = Error(\n (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +\n 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'\n );\n err.name = 'Invariant Violation';\n throw err;\n }\n error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);\n } catch (ex) {\n error = ex;\n }\n if (error && !(error instanceof Error)) {\n printWarning(\n (componentName || 'React class') + ': type specification of ' +\n location + ' `' + typeSpecName + '` is invalid; the type checker ' +\n 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +\n 'You may have forgotten to pass an argument to the type checker ' +\n 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +\n 'shape all require an argument).'\n );\n }\n if (error instanceof Error && !(error.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error.message] = true;\n\n var stack = getStack ? getStack() : '';\n\n printWarning(\n 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')\n );\n }\n }\n }\n }\n}\n\n/**\n * Resets warning cache when testing.\n *\n * @private\n */\ncheckPropTypes.resetWarningCache = function() {\n if (undefined !== 'production') {\n loggedTypeFailures = {};\n }\n}\n\nmodule.exports = checkPropTypes;\n\n\n//# sourceURL=webpack:///./node_modules/prop-types/checkPropTypes.js?");
|
778 |
+
|
779 |
+
/***/ }),
|
780 |
+
|
781 |
+
/***/ "./node_modules/prop-types/factoryWithThrowingShims.js":
|
782 |
+
/*!*************************************************************!*\
|
783 |
+
!*** ./node_modules/prop-types/factoryWithThrowingShims.js ***!
|
784 |
+
\*************************************************************/
|
785 |
+
/*! no static exports found */
|
786 |
+
/***/ (function(module, exports, __webpack_require__) {
|
787 |
+
|
788 |
+
"use strict";
|
789 |
+
eval("/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nvar ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ \"./node_modules/prop-types/lib/ReactPropTypesSecret.js\");\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n\n\n//# sourceURL=webpack:///./node_modules/prop-types/factoryWithThrowingShims.js?");
|
790 |
+
|
791 |
+
/***/ }),
|
792 |
+
|
793 |
+
/***/ "./node_modules/prop-types/factoryWithTypeCheckers.js":
|
794 |
+
/*!************************************************************!*\
|
795 |
+
!*** ./node_modules/prop-types/factoryWithTypeCheckers.js ***!
|
796 |
+
\************************************************************/
|
797 |
+
/*! no static exports found */
|
798 |
+
/***/ (function(module, exports, __webpack_require__) {
|
799 |
+
|
800 |
+
"use strict";
|
801 |
+
eval("/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nvar ReactIs = __webpack_require__(/*! react-is */ \"./node_modules/react-is/index.js\");\nvar assign = __webpack_require__(/*! object-assign */ \"./node_modules/object-assign/index.js\");\n\nvar ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ \"./node_modules/prop-types/lib/ReactPropTypesSecret.js\");\nvar checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ \"./node_modules/prop-types/checkPropTypes.js\");\n\nvar has = Function.call.bind(Object.prototype.hasOwnProperty);\nvar printWarning = function() {};\n\nif (undefined !== 'production') {\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n}\n\nfunction emptyFunctionThatReturnsNull() {\n return null;\n}\n\nmodule.exports = function(isValidElement, throwOnDirectAccess) {\n /* global Symbol */\n var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.\n\n /**\n * Returns the iterator method function contained on the iterable object.\n *\n * Be sure to invoke the function with the iterable as context:\n *\n * var iteratorFn = getIteratorFn(myIterable);\n * if (iteratorFn) {\n * var iterator = iteratorFn.call(myIterable);\n * ...\n * }\n *\n * @param {?object} maybeIterable\n * @return {?function}\n */\n function getIteratorFn(maybeIterable) {\n var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n /**\n * Collection of methods that allow declaration and validation of props that are\n * supplied to React components. Example usage:\n *\n * var Props = require('ReactPropTypes');\n * var MyArticle = React.createClass({\n * propTypes: {\n * // An optional string prop named \"description\".\n * description: Props.string,\n *\n * // A required enum prop named \"category\".\n * category: Props.oneOf(['News','Photos']).isRequired,\n *\n * // A prop named \"dialog\" that requires an instance of Dialog.\n * dialog: Props.instanceOf(Dialog).isRequired\n * },\n * render: function() { ... }\n * });\n *\n * A more formal specification of how these methods are used:\n *\n * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)\n * decl := ReactPropTypes.{type}(.isRequired)?\n *\n * Each and every declaration produces a function with the same signature. This\n * allows the creation of custom validation functions. For example:\n *\n * var MyLink = React.createClass({\n * propTypes: {\n * // An optional string or URI prop named \"href\".\n * href: function(props, propName, componentName) {\n * var propValue = props[propName];\n * if (propValue != null && typeof propValue !== 'string' &&\n * !(propValue instanceof URI)) {\n * return new Error(\n * 'Expected a string or an URI for ' + propName + ' in ' +\n * componentName\n * );\n * }\n * }\n * },\n * render: function() {...}\n * });\n *\n * @internal\n */\n\n var ANONYMOUS = '<<anonymous>>';\n\n // Important!\n // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.\n var ReactPropTypes = {\n array: createPrimitiveTypeChecker('array'),\n bool: createPrimitiveTypeChecker('boolean'),\n func: createPrimitiveTypeChecker('function'),\n number: createPrimitiveTypeChecker('number'),\n object: createPrimitiveTypeChecker('object'),\n string: createPrimitiveTypeChecker('string'),\n symbol: createPrimitiveTypeChecker('symbol'),\n\n any: createAnyTypeChecker(),\n arrayOf: createArrayOfTypeChecker,\n element: createElementTypeChecker(),\n elementType: createElementTypeTypeChecker(),\n instanceOf: createInstanceTypeChecker,\n node: createNodeChecker(),\n objectOf: createObjectOfTypeChecker,\n oneOf: createEnumTypeChecker,\n oneOfType: createUnionTypeChecker,\n shape: createShapeTypeChecker,\n exact: createStrictShapeTypeChecker,\n };\n\n /**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\n /*eslint-disable no-self-compare*/\n function is(x, y) {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n return x !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n }\n /*eslint-enable no-self-compare*/\n\n /**\n * We use an Error-like object for backward compatibility as people may call\n * PropTypes directly and inspect their output. However, we don't use real\n * Errors anymore. We don't inspect their stack anyway, and creating them\n * is prohibitively expensive if they are created too often, such as what\n * happens in oneOfType() for any type before the one that matched.\n */\n function PropTypeError(message) {\n this.message = message;\n this.stack = '';\n }\n // Make `instanceof Error` still work for returned errors.\n PropTypeError.prototype = Error.prototype;\n\n function createChainableTypeChecker(validate) {\n if (undefined !== 'production') {\n var manualPropTypeCallCache = {};\n var manualPropTypeWarningCount = 0;\n }\n function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {\n componentName = componentName || ANONYMOUS;\n propFullName = propFullName || propName;\n\n if (secret !== ReactPropTypesSecret) {\n if (throwOnDirectAccess) {\n // New behavior only for users of `prop-types` package\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use `PropTypes.checkPropTypes()` to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n } else if (undefined !== 'production' && typeof console !== 'undefined') {\n // Old behavior for people using React.PropTypes\n var cacheKey = componentName + ':' + propName;\n if (\n !manualPropTypeCallCache[cacheKey] &&\n // Avoid spamming the console because they are often not actionable except for lib authors\n manualPropTypeWarningCount < 3\n ) {\n printWarning(\n 'You are manually calling a React.PropTypes validation ' +\n 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +\n 'and will throw in the standalone `prop-types` package. ' +\n 'You may be seeing this warning due to a third-party PropTypes ' +\n 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'\n );\n manualPropTypeCallCache[cacheKey] = true;\n manualPropTypeWarningCount++;\n }\n }\n }\n if (props[propName] == null) {\n if (isRequired) {\n if (props[propName] === null) {\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));\n }\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));\n }\n return null;\n } else {\n return validate(props, propName, componentName, location, propFullName);\n }\n }\n\n var chainedCheckType = checkType.bind(null, false);\n chainedCheckType.isRequired = checkType.bind(null, true);\n\n return chainedCheckType;\n }\n\n function createPrimitiveTypeChecker(expectedType) {\n function validate(props, propName, componentName, location, propFullName, secret) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== expectedType) {\n // `propValue` being instance of, say, date/regexp, pass the 'object'\n // check, but we can offer a more precise error message here rather than\n // 'of type `object`'.\n var preciseType = getPreciseType(propValue);\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createAnyTypeChecker() {\n return createChainableTypeChecker(emptyFunctionThatReturnsNull);\n }\n\n function createArrayOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');\n }\n var propValue = props[propName];\n if (!Array.isArray(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));\n }\n for (var i = 0; i < propValue.length; i++) {\n var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!isValidElement(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!ReactIs.isValidElementType(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createInstanceTypeChecker(expectedClass) {\n function validate(props, propName, componentName, location, propFullName) {\n if (!(props[propName] instanceof expectedClass)) {\n var expectedClassName = expectedClass.name || ANONYMOUS;\n var actualClassName = getClassName(props[propName]);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createEnumTypeChecker(expectedValues) {\n if (!Array.isArray(expectedValues)) {\n if (undefined !== 'production') {\n if (arguments.length > 1) {\n printWarning(\n 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +\n 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'\n );\n } else {\n printWarning('Invalid argument supplied to oneOf, expected an array.');\n }\n }\n return emptyFunctionThatReturnsNull;\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n for (var i = 0; i < expectedValues.length; i++) {\n if (is(propValue, expectedValues[i])) {\n return null;\n }\n }\n\n var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {\n var type = getPreciseType(value);\n if (type === 'symbol') {\n return String(value);\n }\n return value;\n });\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createObjectOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');\n }\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));\n }\n for (var key in propValue) {\n if (has(propValue, key)) {\n var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createUnionTypeChecker(arrayOfTypeCheckers) {\n if (!Array.isArray(arrayOfTypeCheckers)) {\n undefined !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;\n return emptyFunctionThatReturnsNull;\n }\n\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (typeof checker !== 'function') {\n printWarning(\n 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +\n 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'\n );\n return emptyFunctionThatReturnsNull;\n }\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {\n return null;\n }\n }\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createNodeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n if (!isNode(props[propName])) {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n for (var key in shapeTypes) {\n var checker = shapeTypes[key];\n if (!checker) {\n continue;\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createStrictShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n // We need to check all keys in case some are required but missing from\n // props.\n var allKeys = assign({}, props[propName], shapeTypes);\n for (var key in allKeys) {\n var checker = shapeTypes[key];\n if (!checker) {\n return new PropTypeError(\n 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +\n '\\nBad object: ' + JSON.stringify(props[propName], null, ' ') +\n '\\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')\n );\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n\n return createChainableTypeChecker(validate);\n }\n\n function isNode(propValue) {\n switch (typeof propValue) {\n case 'number':\n case 'string':\n case 'undefined':\n return true;\n case 'boolean':\n return !propValue;\n case 'object':\n if (Array.isArray(propValue)) {\n return propValue.every(isNode);\n }\n if (propValue === null || isValidElement(propValue)) {\n return true;\n }\n\n var iteratorFn = getIteratorFn(propValue);\n if (iteratorFn) {\n var iterator = iteratorFn.call(propValue);\n var step;\n if (iteratorFn !== propValue.entries) {\n while (!(step = iterator.next()).done) {\n if (!isNode(step.value)) {\n return false;\n }\n }\n } else {\n // Iterator will provide entry [k,v] tuples rather than values.\n while (!(step = iterator.next()).done) {\n var entry = step.value;\n if (entry) {\n if (!isNode(entry[1])) {\n return false;\n }\n }\n }\n }\n } else {\n return false;\n }\n\n return true;\n default:\n return false;\n }\n }\n\n function isSymbol(propType, propValue) {\n // Native Symbol.\n if (propType === 'symbol') {\n return true;\n }\n\n // falsy value can't be a Symbol\n if (!propValue) {\n return false;\n }\n\n // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'\n if (propValue['@@toStringTag'] === 'Symbol') {\n return true;\n }\n\n // Fallback for non-spec compliant Symbols which are polyfilled.\n if (typeof Symbol === 'function' && propValue instanceof Symbol) {\n return true;\n }\n\n return false;\n }\n\n // Equivalent of `typeof` but with special handling for array and regexp.\n function getPropType(propValue) {\n var propType = typeof propValue;\n if (Array.isArray(propValue)) {\n return 'array';\n }\n if (propValue instanceof RegExp) {\n // Old webkits (at least until Android 4.0) return 'function' rather than\n // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n // passes PropTypes.object.\n return 'object';\n }\n if (isSymbol(propType, propValue)) {\n return 'symbol';\n }\n return propType;\n }\n\n // This handles more types than `getPropType`. Only used for error messages.\n // See `createPrimitiveTypeChecker`.\n function getPreciseType(propValue) {\n if (typeof propValue === 'undefined' || propValue === null) {\n return '' + propValue;\n }\n var propType = getPropType(propValue);\n if (propType === 'object') {\n if (propValue instanceof Date) {\n return 'date';\n } else if (propValue instanceof RegExp) {\n return 'regexp';\n }\n }\n return propType;\n }\n\n // Returns a string that is postfixed to a warning about an invalid type.\n // For example, \"undefined\" or \"of type array\"\n function getPostfixForTypeWarning(value) {\n var type = getPreciseType(value);\n switch (type) {\n case 'array':\n case 'object':\n return 'an ' + type;\n case 'boolean':\n case 'date':\n case 'regexp':\n return 'a ' + type;\n default:\n return type;\n }\n }\n\n // Returns class name of the object, if any.\n function getClassName(propValue) {\n if (!propValue.constructor || !propValue.constructor.name) {\n return ANONYMOUS;\n }\n return propValue.constructor.name;\n }\n\n ReactPropTypes.checkPropTypes = checkPropTypes;\n ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n\n\n//# sourceURL=webpack:///./node_modules/prop-types/factoryWithTypeCheckers.js?");
|
802 |
+
|
803 |
+
/***/ }),
|
804 |
+
|
805 |
+
/***/ "./node_modules/prop-types/index.js":
|
806 |
+
/*!******************************************!*\
|
807 |
+
!*** ./node_modules/prop-types/index.js ***!
|
808 |
+
\******************************************/
|
809 |
+
/*! no static exports found */
|
810 |
+
/***/ (function(module, exports, __webpack_require__) {
|
811 |
+
|
812 |
+
eval("/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (undefined !== 'production') {\n var ReactIs = __webpack_require__(/*! react-is */ \"./node_modules/react-is/index.js\");\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = __webpack_require__(/*! ./factoryWithTypeCheckers */ \"./node_modules/prop-types/factoryWithTypeCheckers.js\")(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = __webpack_require__(/*! ./factoryWithThrowingShims */ \"./node_modules/prop-types/factoryWithThrowingShims.js\")();\n}\n\n\n//# sourceURL=webpack:///./node_modules/prop-types/index.js?");
|
813 |
+
|
814 |
+
/***/ }),
|
815 |
+
|
816 |
+
/***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js":
|
817 |
+
/*!*************************************************************!*\
|
818 |
+
!*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***!
|
819 |
+
\*************************************************************/
|
820 |
+
/*! no static exports found */
|
821 |
+
/***/ (function(module, exports, __webpack_require__) {
|
822 |
+
|
823 |
+
"use strict";
|
824 |
+
eval("/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n\n\n//# sourceURL=webpack:///./node_modules/prop-types/lib/ReactPropTypesSecret.js?");
|
825 |
+
|
826 |
+
/***/ }),
|
827 |
+
|
828 |
+
/***/ "./node_modules/react-is/cjs/react-is.development.js":
|
829 |
+
/*!***********************************************************!*\
|
830 |
+
!*** ./node_modules/react-is/cjs/react-is.development.js ***!
|
831 |
+
\***********************************************************/
|
832 |
+
/*! no static exports found */
|
833 |
+
/***/ (function(module, exports, __webpack_require__) {
|
834 |
+
|
835 |
+
"use strict";
|
836 |
+
eval("/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\n\n\nif (undefined !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n\n\n//# sourceURL=webpack:///./node_modules/react-is/cjs/react-is.development.js?");
|
837 |
+
|
838 |
+
/***/ }),
|
839 |
+
|
840 |
+
/***/ "./node_modules/react-is/cjs/react-is.production.min.js":
|
841 |
+
/*!**************************************************************!*\
|
842 |
+
!*** ./node_modules/react-is/cjs/react-is.production.min.js ***!
|
843 |
+
\**************************************************************/
|
844 |
+
/*! no static exports found */
|
845 |
+
/***/ (function(module, exports, __webpack_require__) {
|
846 |
+
|
847 |
+
"use strict";
|
848 |
+
eval("/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n\n\n//# sourceURL=webpack:///./node_modules/react-is/cjs/react-is.production.min.js?");
|
849 |
+
|
850 |
+
/***/ }),
|
851 |
+
|
852 |
+
/***/ "./node_modules/react-is/index.js":
|
853 |
+
/*!****************************************!*\
|
854 |
+
!*** ./node_modules/react-is/index.js ***!
|
855 |
+
\****************************************/
|
856 |
+
/*! no static exports found */
|
857 |
+
/***/ (function(module, exports, __webpack_require__) {
|
858 |
+
|
859 |
+
"use strict";
|
860 |
+
eval("\n\nif (undefined === 'production') {\n module.exports = __webpack_require__(/*! ./cjs/react-is.production.min.js */ \"./node_modules/react-is/cjs/react-is.production.min.js\");\n} else {\n module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ \"./node_modules/react-is/cjs/react-is.development.js\");\n}\n\n\n//# sourceURL=webpack:///./node_modules/react-is/index.js?");
|
861 |
+
|
862 |
+
/***/ }),
|
863 |
+
|
864 |
+
/***/ "./node_modules/uuid/dist/esm-browser/bytesToUuid.js":
|
865 |
+
/*!***********************************************************!*\
|
866 |
+
!*** ./node_modules/uuid/dist/esm-browser/bytesToUuid.js ***!
|
867 |
+
\***********************************************************/
|
868 |
+
/*! exports provided: default */
|
869 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
870 |
+
|
871 |
+
"use strict";
|
872 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction bytesToUuid(buf, offset_) {\n var offset = offset_ || 0; // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n\n return (byteToHex[buf[offset + 0]] + byteToHex[buf[offset + 1]] + byteToHex[buf[offset + 2]] + byteToHex[buf[offset + 3]] + '-' + byteToHex[buf[offset + 4]] + byteToHex[buf[offset + 5]] + '-' + byteToHex[buf[offset + 6]] + byteToHex[buf[offset + 7]] + '-' + byteToHex[buf[offset + 8]] + byteToHex[buf[offset + 9]] + '-' + byteToHex[buf[offset + 10]] + byteToHex[buf[offset + 11]] + byteToHex[buf[offset + 12]] + byteToHex[buf[offset + 13]] + byteToHex[buf[offset + 14]] + byteToHex[buf[offset + 15]]).toLowerCase();\n}\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (bytesToUuid);\n\n//# sourceURL=webpack:///./node_modules/uuid/dist/esm-browser/bytesToUuid.js?");
|
873 |
+
|
874 |
+
/***/ }),
|
875 |
+
|
876 |
+
/***/ "./node_modules/uuid/dist/esm-browser/index.js":
|
877 |
+
/*!*****************************************************!*\
|
878 |
+
!*** ./node_modules/uuid/dist/esm-browser/index.js ***!
|
879 |
+
\*****************************************************/
|
880 |
+
/*! exports provided: v1, v3, v4, v5 */
|
881 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
882 |
+
|
883 |
+
"use strict";
|
884 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _v1_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./v1.js */ \"./node_modules/uuid/dist/esm-browser/v1.js\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"v1\", function() { return _v1_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]; });\n\n/* harmony import */ var _v3_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./v3.js */ \"./node_modules/uuid/dist/esm-browser/v3.js\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"v3\", function() { return _v3_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]; });\n\n/* harmony import */ var _v4_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./v4.js */ \"./node_modules/uuid/dist/esm-browser/v4.js\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"v4\", function() { return _v4_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]; });\n\n/* harmony import */ var _v5_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./v5.js */ \"./node_modules/uuid/dist/esm-browser/v5.js\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"v5\", function() { return _v5_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]; });\n\n\n\n\n\n\n//# sourceURL=webpack:///./node_modules/uuid/dist/esm-browser/index.js?");
|
885 |
+
|
886 |
+
/***/ }),
|
887 |
+
|
888 |
+
/***/ "./node_modules/uuid/dist/esm-browser/md5.js":
|
889 |
+
/*!***************************************************!*\
|
890 |
+
!*** ./node_modules/uuid/dist/esm-browser/md5.js ***!
|
891 |
+
\***************************************************/
|
892 |
+
/*! exports provided: default */
|
893 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
894 |
+
|
895 |
+
"use strict";
|
896 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/*\n * Browser-compatible JavaScript MD5\n *\n * Modification of JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\nfunction md5(bytes) {\n if (typeof bytes === 'string') {\n var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = new Uint8Array(msg.length);\n\n for (var i = 0; i < msg.length; ++i) {\n bytes[i] = msg.charCodeAt(i);\n }\n }\n\n return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));\n}\n/*\n * Convert an array of little-endian words to an array of bytes\n */\n\n\nfunction md5ToHexEncodedArray(input) {\n var output = [];\n var length32 = input.length * 32;\n var hexTab = '0123456789abcdef';\n\n for (var i = 0; i < length32; i += 8) {\n var x = input[i >> 5] >>> i % 32 & 0xff;\n var hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);\n output.push(hex);\n }\n\n return output;\n}\n/**\n * Calculate output length with padding and bit length\n */\n\n\nfunction getOutputLength(inputLength8) {\n return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;\n}\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\n\n\nfunction wordsToMd5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << len % 32;\n x[getOutputLength(len) - 1] = len;\n var a = 1732584193;\n var b = -271733879;\n var c = -1732584194;\n var d = 271733878;\n\n for (var i = 0; i < x.length; i += 16) {\n var olda = a;\n var oldb = b;\n var oldc = c;\n var oldd = d;\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n\n return [a, b, c, d];\n}\n/*\n * Convert an array bytes to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\n\n\nfunction bytesToWords(input) {\n if (input.length === 0) {\n return [];\n }\n\n var length8 = input.length * 8;\n var output = new Uint32Array(getOutputLength(length8));\n\n for (var i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;\n }\n\n return output;\n}\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\n\n\nfunction safeAdd(x, y) {\n var lsw = (x & 0xffff) + (y & 0xffff);\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return msw << 16 | lsw & 0xffff;\n}\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\n\n\nfunction bitRotateLeft(num, cnt) {\n return num << cnt | num >>> 32 - cnt;\n}\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\n\n\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn(b & c | ~b & d, a, b, x, s, t);\n}\n\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn(b & d | c & ~d, a, b, x, s, t);\n}\n\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (md5);\n\n//# sourceURL=webpack:///./node_modules/uuid/dist/esm-browser/md5.js?");
|
897 |
+
|
898 |
+
/***/ }),
|
899 |
+
|
900 |
+
/***/ "./node_modules/uuid/dist/esm-browser/rng.js":
|
901 |
+
/*!***************************************************!*\
|
902 |
+
!*** ./node_modules/uuid/dist/esm-browser/rng.js ***!
|
903 |
+
\***************************************************/
|
904 |
+
/*! exports provided: default */
|
905 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
906 |
+
|
907 |
+
"use strict";
|
908 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return rng; });\n// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n// find the complete implementation of crypto (msCrypto) on IE11.\nvar getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\nvar rnds8 = new Uint8Array(16);\nfunction rng() {\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n\n return getRandomValues(rnds8);\n}\n\n//# sourceURL=webpack:///./node_modules/uuid/dist/esm-browser/rng.js?");
|
909 |
+
|
910 |
+
/***/ }),
|
911 |
+
|
912 |
+
/***/ "./node_modules/uuid/dist/esm-browser/sha1.js":
|
913 |
+
/*!****************************************************!*\
|
914 |
+
!*** ./node_modules/uuid/dist/esm-browser/sha1.js ***!
|
915 |
+
\****************************************************/
|
916 |
+
/*! exports provided: default */
|
917 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
918 |
+
|
919 |
+
"use strict";
|
920 |
+
eval("__webpack_require__.r(__webpack_exports__);\n// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n switch (s) {\n case 0:\n return x & y ^ ~x & z;\n\n case 1:\n return x ^ y ^ z;\n\n case 2:\n return x & y ^ x & z ^ y & z;\n\n case 3:\n return x ^ y ^ z;\n }\n}\n\nfunction ROTL(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n if (typeof bytes === 'string') {\n var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = [];\n\n for (var i = 0; i < msg.length; ++i) {\n bytes.push(msg.charCodeAt(i));\n }\n }\n\n bytes.push(0x80);\n var l = bytes.length / 4 + 2;\n var N = Math.ceil(l / 16);\n var M = new Array(N);\n\n for (var _i = 0; _i < N; ++_i) {\n var arr = new Uint32Array(16);\n\n for (var j = 0; j < 16; ++j) {\n arr[j] = bytes[_i * 64 + j * 4] << 24 | bytes[_i * 64 + j * 4 + 1] << 16 | bytes[_i * 64 + j * 4 + 2] << 8 | bytes[_i * 64 + j * 4 + 3];\n }\n\n M[_i] = arr;\n }\n\n M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n M[N - 1][14] = Math.floor(M[N - 1][14]);\n M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n for (var _i2 = 0; _i2 < N; ++_i2) {\n var W = new Uint32Array(80);\n\n for (var t = 0; t < 16; ++t) {\n W[t] = M[_i2][t];\n }\n\n for (var _t = 16; _t < 80; ++_t) {\n W[_t] = ROTL(W[_t - 3] ^ W[_t - 8] ^ W[_t - 14] ^ W[_t - 16], 1);\n }\n\n var a = H[0];\n var b = H[1];\n var c = H[2];\n var d = H[3];\n var e = H[4];\n\n for (var _t2 = 0; _t2 < 80; ++_t2) {\n var s = Math.floor(_t2 / 20);\n var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[_t2] >>> 0;\n e = d;\n d = c;\n c = ROTL(b, 30) >>> 0;\n b = a;\n a = T;\n }\n\n H[0] = H[0] + a >>> 0;\n H[1] = H[1] + b >>> 0;\n H[2] = H[2] + c >>> 0;\n H[3] = H[3] + d >>> 0;\n H[4] = H[4] + e >>> 0;\n }\n\n return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (sha1);\n\n//# sourceURL=webpack:///./node_modules/uuid/dist/esm-browser/sha1.js?");
|
921 |
+
|
922 |
+
/***/ }),
|
923 |
+
|
924 |
+
/***/ "./node_modules/uuid/dist/esm-browser/v1.js":
|
925 |
+
/*!**************************************************!*\
|
926 |
+
!*** ./node_modules/uuid/dist/esm-browser/v1.js ***!
|
927 |
+
\**************************************************/
|
928 |
+
/*! exports provided: default */
|
929 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
930 |
+
|
931 |
+
"use strict";
|
932 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rng.js */ \"./node_modules/uuid/dist/esm-browser/rng.js\");\n/* harmony import */ var _bytesToUuid_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bytesToUuid.js */ \"./node_modules/uuid/dist/esm-browser/bytesToUuid.js\");\n\n // **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\n\nvar _clockseq; // Previous uuid creation time\n\n\nvar _lastMSecs = 0;\nvar _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || new Array(16);\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n\n if (node == null || clockseq == null) {\n var seedBytes = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n }\n\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n var msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n\n\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n if (nsecs >= 10000) {\n throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n msecs += 12219292800000; // `time_low`\n\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff; // `time_mid`\n\n var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff; // `time_high_and_version`\n\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n b[i++] = clockseq & 0xff; // `node`\n\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf || Object(_bytesToUuid_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(b);\n}\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (v1);\n\n//# sourceURL=webpack:///./node_modules/uuid/dist/esm-browser/v1.js?");
|
933 |
+
|
934 |
+
/***/ }),
|
935 |
+
|
936 |
+
/***/ "./node_modules/uuid/dist/esm-browser/v3.js":
|
937 |
+
/*!**************************************************!*\
|
938 |
+
!*** ./node_modules/uuid/dist/esm-browser/v3.js ***!
|
939 |
+
\**************************************************/
|
940 |
+
/*! exports provided: default */
|
941 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
942 |
+
|
943 |
+
"use strict";
|
944 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _v35_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./v35.js */ \"./node_modules/uuid/dist/esm-browser/v35.js\");\n/* harmony import */ var _md5_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./md5.js */ \"./node_modules/uuid/dist/esm-browser/md5.js\");\n\n\nvar v3 = Object(_v35_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])('v3', 0x30, _md5_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ __webpack_exports__[\"default\"] = (v3);\n\n//# sourceURL=webpack:///./node_modules/uuid/dist/esm-browser/v3.js?");
|
945 |
+
|
946 |
+
/***/ }),
|
947 |
+
|
948 |
+
/***/ "./node_modules/uuid/dist/esm-browser/v35.js":
|
949 |
+
/*!***************************************************!*\
|
950 |
+
!*** ./node_modules/uuid/dist/esm-browser/v35.js ***!
|
951 |
+
\***************************************************/
|
952 |
+
/*! exports provided: DNS, URL, default */
|
953 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
954 |
+
|
955 |
+
"use strict";
|
956 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"DNS\", function() { return DNS; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"URL\", function() { return URL; });\n/* harmony import */ var _bytesToUuid_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bytesToUuid.js */ \"./node_modules/uuid/dist/esm-browser/bytesToUuid.js\");\n\n\nfunction uuidToBytes(uuid) {\n // Note: We assume we're being passed a valid uuid string\n var bytes = [];\n uuid.replace(/[a-fA-F0-9]{2}/g, function (hex) {\n bytes.push(parseInt(hex, 16));\n });\n return bytes;\n}\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n var bytes = [];\n\n for (var i = 0; i < str.length; ++i) {\n bytes.push(str.charCodeAt(i));\n }\n\n return bytes;\n}\n\nvar DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nvar URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\n/* harmony default export */ __webpack_exports__[\"default\"] = (function (name, version, hashfunc) {\n function generateUUID(value, namespace, buf, offset) {\n if (typeof value === 'string') {\n value = stringToBytes(value);\n }\n\n if (typeof namespace === 'string') {\n namespace = uuidToBytes(namespace);\n }\n\n if (!Array.isArray(value)) {\n throw TypeError('value must be an array of bytes');\n }\n\n if (!Array.isArray(namespace) || namespace.length !== 16) {\n throw TypeError('namespace must be uuid string or an Array of 16 byte values');\n } // Per 4.3\n\n\n var bytes = hashfunc(namespace.concat(value));\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = bytes[i];\n }\n\n return buf;\n }\n\n return Object(_bytesToUuid_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(bytes);\n } // Function#name is not settable on some platforms (#270)\n\n\n try {\n generateUUID.name = name; // eslint-disable-next-line no-empty\n } catch (err) {} // For CommonJS default export support\n\n\n generateUUID.DNS = DNS;\n generateUUID.URL = URL;\n return generateUUID;\n});\n\n//# sourceURL=webpack:///./node_modules/uuid/dist/esm-browser/v35.js?");
|
957 |
+
|
958 |
+
/***/ }),
|
959 |
+
|
960 |
+
/***/ "./node_modules/uuid/dist/esm-browser/v4.js":
|
961 |
+
/*!**************************************************!*\
|
962 |
+
!*** ./node_modules/uuid/dist/esm-browser/v4.js ***!
|
963 |
+
\**************************************************/
|
964 |
+
/*! exports provided: default */
|
965 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
966 |
+
|
967 |
+
"use strict";
|
968 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rng.js */ \"./node_modules/uuid/dist/esm-browser/rng.js\");\n/* harmony import */ var _bytesToUuid_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bytesToUuid.js */ \"./node_modules/uuid/dist/esm-browser/bytesToUuid.js\");\n\n\n\nfunction v4(options, buf, offset) {\n options = options || {};\n var rnds = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return Object(_bytesToUuid_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(rnds);\n}\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (v4);\n\n//# sourceURL=webpack:///./node_modules/uuid/dist/esm-browser/v4.js?");
|
969 |
+
|
970 |
+
/***/ }),
|
971 |
+
|
972 |
+
/***/ "./node_modules/uuid/dist/esm-browser/v5.js":
|
973 |
+
/*!**************************************************!*\
|
974 |
+
!*** ./node_modules/uuid/dist/esm-browser/v5.js ***!
|
975 |
+
\**************************************************/
|
976 |
+
/*! exports provided: default */
|
977 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
978 |
+
|
979 |
+
"use strict";
|
980 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _v35_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./v35.js */ \"./node_modules/uuid/dist/esm-browser/v35.js\");\n/* harmony import */ var _sha1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sha1.js */ \"./node_modules/uuid/dist/esm-browser/sha1.js\");\n\n\nvar v5 = Object(_v35_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])('v5', 0x50, _sha1_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ __webpack_exports__[\"default\"] = (v5);\n\n//# sourceURL=webpack:///./node_modules/uuid/dist/esm-browser/v5.js?");
|
981 |
+
|
982 |
+
/***/ }),
|
983 |
+
|
984 |
+
/***/ "@babel/runtime/regenerator":
|
985 |
+
/*!**********************************************!*\
|
986 |
+
!*** external {"this":"regeneratorRuntime"} ***!
|
987 |
+
\**********************************************/
|
988 |
+
/*! no static exports found */
|
989 |
+
/***/ (function(module, exports) {
|
990 |
+
|
991 |
+
eval("(function() { module.exports = this[\"regeneratorRuntime\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%22regeneratorRuntime%22%7D?");
|
992 |
+
|
993 |
+
/***/ }),
|
994 |
+
|
995 |
+
/***/ "@wordpress/api-fetch":
|
996 |
+
/*!*******************************************!*\
|
997 |
+
!*** external {"this":["wp","apiFetch"]} ***!
|
998 |
+
\*******************************************/
|
999 |
+
/*! no static exports found */
|
1000 |
+
/***/ (function(module, exports) {
|
1001 |
+
|
1002 |
+
eval("(function() { module.exports = this[\"wp\"][\"apiFetch\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22apiFetch%22%5D%7D?");
|
1003 |
+
|
1004 |
+
/***/ }),
|
1005 |
+
|
1006 |
+
/***/ "@wordpress/block-editor":
|
1007 |
+
/*!**********************************************!*\
|
1008 |
+
!*** external {"this":["wp","blockEditor"]} ***!
|
1009 |
+
\**********************************************/
|
1010 |
+
/*! no static exports found */
|
1011 |
+
/***/ (function(module, exports) {
|
1012 |
+
|
1013 |
+
eval("(function() { module.exports = this[\"wp\"][\"blockEditor\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22blockEditor%22%5D%7D?");
|
1014 |
+
|
1015 |
+
/***/ }),
|
1016 |
+
|
1017 |
+
/***/ "@wordpress/blocks":
|
1018 |
+
/*!*****************************************!*\
|
1019 |
+
!*** external {"this":["wp","blocks"]} ***!
|
1020 |
+
\*****************************************/
|
1021 |
+
/*! no static exports found */
|
1022 |
+
/***/ (function(module, exports) {
|
1023 |
+
|
1024 |
+
eval("(function() { module.exports = this[\"wp\"][\"blocks\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22blocks%22%5D%7D?");
|
1025 |
+
|
1026 |
+
/***/ }),
|
1027 |
+
|
1028 |
+
/***/ "@wordpress/components":
|
1029 |
+
/*!*********************************************!*\
|
1030 |
+
!*** external {"this":["wp","components"]} ***!
|
1031 |
+
\*********************************************/
|
1032 |
+
/*! no static exports found */
|
1033 |
+
/***/ (function(module, exports) {
|
1034 |
+
|
1035 |
+
eval("(function() { module.exports = this[\"wp\"][\"components\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22components%22%5D%7D?");
|
1036 |
+
|
1037 |
+
/***/ }),
|
1038 |
+
|
1039 |
+
/***/ "@wordpress/data":
|
1040 |
+
/*!***************************************!*\
|
1041 |
+
!*** external {"this":["wp","data"]} ***!
|
1042 |
+
\***************************************/
|
1043 |
+
/*! no static exports found */
|
1044 |
+
/***/ (function(module, exports) {
|
1045 |
+
|
1046 |
+
eval("(function() { module.exports = this[\"wp\"][\"data\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22data%22%5D%7D?");
|
1047 |
+
|
1048 |
+
/***/ }),
|
1049 |
+
|
1050 |
+
/***/ "@wordpress/element":
|
1051 |
+
/*!******************************************!*\
|
1052 |
+
!*** external {"this":["wp","element"]} ***!
|
1053 |
+
\******************************************/
|
1054 |
+
/*! no static exports found */
|
1055 |
+
/***/ (function(module, exports) {
|
1056 |
+
|
1057 |
+
eval("(function() { module.exports = this[\"wp\"][\"element\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22element%22%5D%7D?");
|
1058 |
+
|
1059 |
+
/***/ }),
|
1060 |
+
|
1061 |
+
/***/ "@wordpress/html-entities":
|
1062 |
+
/*!***********************************************!*\
|
1063 |
+
!*** external {"this":["wp","htmlEntities"]} ***!
|
1064 |
+
\***********************************************/
|
1065 |
+
/*! no static exports found */
|
1066 |
+
/***/ (function(module, exports) {
|
1067 |
+
|
1068 |
+
eval("(function() { module.exports = this[\"wp\"][\"htmlEntities\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22htmlEntities%22%5D%7D?");
|
1069 |
+
|
1070 |
+
/***/ }),
|
1071 |
+
|
1072 |
+
/***/ "@wordpress/i18n":
|
1073 |
+
/*!***************************************!*\
|
1074 |
+
!*** external {"this":["wp","i18n"]} ***!
|
1075 |
+
\***************************************/
|
1076 |
+
/*! no static exports found */
|
1077 |
+
/***/ (function(module, exports) {
|
1078 |
+
|
1079 |
+
eval("(function() { module.exports = this[\"wp\"][\"i18n\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22i18n%22%5D%7D?");
|
1080 |
+
|
1081 |
+
/***/ }),
|
1082 |
+
|
1083 |
+
/***/ "lodash":
|
1084 |
+
/*!**********************************!*\
|
1085 |
+
!*** external {"this":"lodash"} ***!
|
1086 |
+
\**********************************/
|
1087 |
+
/*! no static exports found */
|
1088 |
+
/***/ (function(module, exports) {
|
1089 |
+
|
1090 |
+
eval("(function() { module.exports = this[\"lodash\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%22lodash%22%7D?");
|
1091 |
+
|
1092 |
+
/***/ }),
|
1093 |
+
|
1094 |
+
/***/ "react":
|
1095 |
+
/*!*********************************!*\
|
1096 |
+
!*** external {"this":"React"} ***!
|
1097 |
+
\*********************************/
|
1098 |
+
/*! no static exports found */
|
1099 |
+
/***/ (function(module, exports) {
|
1100 |
+
|
1101 |
+
eval("(function() { module.exports = this[\"React\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%22React%22%7D?");
|
1102 |
+
|
1103 |
+
/***/ })
|
1104 |
+
|
1105 |
+
/******/ })));
|
build/poll.asset.php
ADDED
@@ -0,0 +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' => '19040f949bb94f9aeb7ecf8fa8948e7e');
|
build/poll.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
@keyframes crowdsignal-forms-animation__pop{0%{transform:scale(0)}50%{transform:scale(1.2)}100%{transform:scale(1)}}@keyframes crowdsignal-forms-animation__pulse{0%{opacity:0.4}50%{opacity:0.7}100%{opacity:0.4}}.wp-block-crowdsignal-forms-poll{border-color:var(--crowdsignal-forms-border-color);border-style:solid;border-width:var(--crowdsignal-forms-border-width);margin-top:1.25em;margin-bottom:1.25em;position:relative;text-align:left}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll{border-left-width:0;border-right-width:0}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question{margin:0 0 28px}.wp-block-crowdsignal-forms-poll h3.wp-block-crowdsignal-forms-poll__question:first-child{margin-top:0}.wp-block-crowdsignal-forms-poll p.wp-block-crowdsignal-forms-poll__note{font-style:italic;margin:0 0 32px}.wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:40px 24px 16px 24px}.entry-content .alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{margin:0 auto;max-width:var(--crowdsignal-forms-content-wide-width)}@media screen and (min-width: 660px){.alignwide.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content,.alignfull.crowdsignal-poll-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__content{padding:80px}}.wp-block-crowdsignal-forms-poll.is-closed .wp-block-crowdsignal-forms-poll__form{opacity:0.5}.wp-block-crowdsignal-forms-poll.is-hidden{opacity:0.5}.wp-block-crowdsignal-forms-poll.has-font-family .wp-block-crowdsignal-forms-poll__answer-label-wrapper,.wp-block-crowdsignal-forms-poll.has-font-family .wp-block-crowdsignal-forms-poll__question,.wp-block-crowdsignal-forms-poll.has-font-family .wp-block-crowdsignal-forms-poll__note{font-family:var(--crowdsignal-forms-font-family)}.wp-block-crowdsignal-forms-poll.has-text-color{color:var(--crowdsignal-forms-text-color)}.wp-block-crowdsignal-forms-poll.has-bg-color{background-color:var(--crowdsignal-forms-bg-color)}.wp-block-crowdsignal-forms-poll.has-border-radius{border-radius:var(--crowdsignal-forms-border-radius);overflow:hidden}.wp-block-crowdsignal-forms-poll.has-box-shadow{box-shadow:0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23)}.wp-block-crowdsignal-forms-poll__submit-button:disabled{opacity:0.7}.wp-block-crowdsignal-forms-poll.has-submit-button-bg-color .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{background-color:var(--crowdsignal-forms-submit-button-bg-color)}.wp-block-crowdsignal-forms-poll.has-submit-button-text-color .wp-block-crowdsignal-forms-poll__submit-button.wp-block-button__link{color:var(--crowdsignal-forms-submit-button-text-color)}.wp-block-crowdsignal-forms-poll__answer{cursor:pointer;display:flex;font-size:inherit;font-weight:600;margin:0 0 16px;padding:0 2px;position:relative}.wp-block-crowdsignal-forms-poll__answer:hover,.wp-block-crowdsignal-forms-poll__answer.is-focused{color:var(--crowdsignal-forms-submit-button-bg-color)}.has-voted .wp-block-crowdsignal-forms-poll__answer{opacity:0.5}input[type="checkbox"].wp-block-crowdsignal-forms-poll__input,input[type="radio"].wp-block-crowdsignal-forms-poll__input{height:0;opacity:0;position:absolute;width:0}.wp-block-crowdsignal-forms-poll__check{display:inline-block;height:1em;margin:0 10px 0 0;position:relative;width:1em}.wp-block-crowdsignal-forms-poll__check::before{background-color:transparent;border:1.5px solid var(--crowdsignal-forms-text-color);border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;transition:background-color 0.3s, border-color 0.3s;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::before{border-radius:3px}.wp-block-crowdsignal-forms-poll__answer.is-multiple-choice.is-selected .wp-block-crowdsignal-forms-poll__check::before{border-color:var(--crowdsignal-forms-border-color);background-color:var(--crowdsignal-forms-border-color)}.wp-block-crowdsignal-forms-poll__answer.is-selected:not(.is-multiple-choice) .wp-block-crowdsignal-forms-poll__check::after{animation-duration:0.3s;animation-name:crowdsignal-forms-animation__pop;animation-iteration-count:1;background-clip:padding-box;background-color:var(--crowdsignal-forms-border-color);border:4.5px solid transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:100%;position:absolute;left:0;top:0;width:100%}.wp-block-crowdsignal-forms-poll__answer.is-selected.is-multiple-choice .wp-block-crowdsignal-forms-poll__check::after{border-color:var(--crowdsignal-forms-submit-button-text-color);border-style:solid;border-width:0 0 2px 2px;box-sizing:border-box;content:"";display:block;height:25%;margin:-0.1em 0 0 -0.2em;position:absolute;left:50%;top:50%;transform:rotateZ(-45deg);width:50%}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper{flex:1;word-break:break-word}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label{line-height:1;vertical-align:top}div.wp-block-crowdsignal-forms-poll__answer-label-wrapper span.wp-block-crowdsignal-forms-poll__answer-label span::after{vertical-align:top}.wp-block-crowdsignal-forms-poll__button{border:0;padding:0}.wp-block-crowdsignal-forms-poll__actions{display:flex;justify-content:flex-end}.wp-block-crowdsignal-forms-poll__actions .wp-block-button{margin:0}.editor-styles-wrapper .wp-block-crowdsignal-forms-poll .wp-block-crowdsignal-forms-poll__actions .wp-block-button.wp-block-crowdsignal-forms-poll__block-button{margin:0}.wp-block-crowdsignal-forms-poll__closed-banner{background-color:var(--crowdsignal-forms-border-color);box-sizing:border-box;display:flex;color:var(--crowdsignal-forms-submit-button-text-color);font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;justify-content:center;padding:calc(var(--crowdsignal-forms-border-width) + 0.2em) 0 0.2em;width:100%}.is-hidden .wp-block-crowdsignal-forms-poll__closed-banner{font-style:italic}.wp-block-crowdsignal-forms-poll__error{color:red}.wp-block-crowdsignal-forms-poll__results-list{margin:0 0 1em;position:relative}.wp-block-crowdsignal-forms-poll__answer-results{display:flex;flex-direction:column;margin:0 0 16px;width:100%}.wp-block-crowdsignal-forms-poll__answer-results:last-child{margin:0}.wp-block-crowdsignal-forms-poll__answer-results-labels{align-items:flex-end;display:flex;margin:0 0 8px;width:100%;word-break:break-word}.wp-block-crowdsignal-forms-poll__answer-results-answer{flex:1;font-size:1em;font-weight:600}.wp-block-crowdsignal-forms-poll__answer-results-votes{font-size:0.75em;line-height:2}.wp-block-crowdsignal-forms-poll__answer-results-percent{font-weight:600;line-height:1.6}.wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results-percent{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;margin-left:20px;transition:opacity 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-percent{display:none}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse;background-color:var(--crowdsignal-forms-text-color);font-size:0.7em;height:1em;width:50px}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-votes:last-child,.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-percent:last-child{width:40px}.wp-block-crowdsignal-forms-poll__answer-results-progress-track{border:1px solid;border-color:rgba(var(--crowdsignal-forms-text-color-properties), 0.3);box-sizing:border-box;height:1em;width:100%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-track{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:crowdsignal-forms-animation__pulse}.wp-block-crowdsignal-forms-poll__answer-results-progress-bar{animation-fill-mode:forwards;background-color:var(--crowdsignal-forms-submit-button-bg-color);height:100%;transition:background-color 0.3s, width 0.3s}.wp-block-crowdsignal-forms-poll__answer-results.is-error .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:0}.wp-block-crowdsignal-forms-poll__answer-results.is-loading .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{background-color:var(--crowdsignal-forms-text-color);width:25%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+1) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:40%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+2) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:75%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+3) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:50%}.wp-block-crowdsignal-forms-poll__answer-results.is-loading:nth-child(5n+4) .wp-block-crowdsignal-forms-poll__answer-results-progress-bar{width:60%}.wp-block-crowdsignal-forms-poll__results-footer{display:flex;flex-direction:column;justify-content:space-between;width:100%;font-size:0.9em}.wp-block-crowdsignal-forms-poll__results-total{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;position:relative;text-align:right;width:100%;margin-bottom:1em}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total{color:transparent}.wp-block-crowdsignal-forms-poll__results.is-loading .wp-block-crowdsignal-forms-poll__results-total::before{animation-name:crowdsignal-forms-animation__pulse;animation-duration:1.5s;animation-iteration-count:infinite;background-color:var(--crowdsignal-forms-text-color);content:"";display:block;position:absolute;right:0;height:1em;width:150px}.wp-block-crowdsignal-forms-poll__footer-branding{display:flex;justify-content:space-between;align-items:center;width:100%}.wp-block-crowdsignal-forms-poll__footer-branding img.wp-block-crowdsignal-forms-poll__footer-branding-logo{width:50px;height:50px;margin-left:0;margin-right:0}.wp-block-crowdsignal-forms-poll__footer-cs-link{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:16px;text-decoration:none;text-transform:uppercase}.wp-block-crowdsignal-forms-poll__footer-cs-link:not(:hover){color:var(--crowdsignal-forms-text-color);opacity:0.4}.wp-block-crowdsignal-forms-poll__error-banner{font-family:-apple-system,blinkmacsystemfont,"Segoe UI",roboto,oxygen-sans,ubuntu,cantarell,"Helvetica Neue",sans-serif;font-size:13px;margin-top:24px;padding:18px 24px;color:#d82e20;border-left:4px solid #d82e20;background:#f8dad8}.wp-block-crowdsignal-forms-poll__submit-message-container{position:absolute;background-color:#fff;left:0;top:0;width:100%;height:100%;overflow:hidden}.wp-block-crowdsignal-forms-poll__submit-message{position:relative}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message{position:absolute;right:0;top:0;background-color:transparent;color:#000;text-decoration:none;border:none}.wp-block-crowdsignal-forms-poll__submit-message button.wp-block-crowdsignal-forms-poll__dismiss-submit-message:hover{background:inherit}.wp-block-crowdsignal-forms-poll__submit-message-footer{position:absolute;bottom:0;left:0;padding:16px 24px;width:100%;background-color:#fff}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker{right:25px;top:66px}.wp-block-crowdsignal-forms-poll__thank-you-sticker{right:132px;top:12px}.wp-block-crowdsignal-forms-poll__thank-you-cs-sticker,.wp-block-crowdsignal-forms-poll__thank-you-sticker{filter:drop-shadow(0 1px 2px rgba(0,0,0,0.2));width:100px;height:100px;position:absolute}.wp-block-crowdsignal-forms-poll__custom-message-check{color:var(--crowdsignal-forms-submit-button-bg-color);padding-left:24px;padding-top:24px}.wp-block-crowdsignal-forms-poll__custom-message{font-weight:600;padding:16px 24px}.wp_block-crowdsignal-forms-poll__vote-branding{margin-top:16px}.crowdsignal-forms__style-probe{display:none}
|
build/poll.js
ADDED
@@ -0,0 +1,1011 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(e, a) { for(var i in a) e[i] = a[i]; }(window, /******/ (function(modules) { // webpackBootstrap
|
2 |
+
/******/ // The module cache
|
3 |
+
/******/ var installedModules = {};
|
4 |
+
/******/
|
5 |
+
/******/ // The require function
|
6 |
+
/******/ function __webpack_require__(moduleId) {
|
7 |
+
/******/
|
8 |
+
/******/ // Check if module is in cache
|
9 |
+
/******/ if(installedModules[moduleId]) {
|
10 |
+
/******/ return installedModules[moduleId].exports;
|
11 |
+
/******/ }
|
12 |
+
/******/ // Create a new module (and put it into the cache)
|
13 |
+
/******/ var module = installedModules[moduleId] = {
|
14 |
+
/******/ i: moduleId,
|
15 |
+
/******/ l: false,
|
16 |
+
/******/ exports: {}
|
17 |
+
/******/ };
|
18 |
+
/******/
|
19 |
+
/******/ // Execute the module function
|
20 |
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21 |
+
/******/
|
22 |
+
/******/ // Flag the module as loaded
|
23 |
+
/******/ module.l = true;
|
24 |
+
/******/
|
25 |
+
/******/ // Return the exports of the module
|
26 |
+
/******/ return module.exports;
|
27 |
+
/******/ }
|
28 |
+
/******/
|
29 |
+
/******/
|
30 |
+
/******/ // expose the modules object (__webpack_modules__)
|
31 |
+
/******/ __webpack_require__.m = modules;
|
32 |
+
/******/
|
33 |
+
/******/ // expose the module cache
|
34 |
+
/******/ __webpack_require__.c = installedModules;
|
35 |
+
/******/
|
36 |
+
/******/ // define getter function for harmony exports
|
37 |
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
38 |
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
39 |
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
40 |
+
/******/ }
|
41 |
+
/******/ };
|
42 |
+
/******/
|
43 |
+
/******/ // define __esModule on exports
|
44 |
+
/******/ __webpack_require__.r = function(exports) {
|
45 |
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
46 |
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
47 |
+
/******/ }
|
48 |
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
49 |
+
/******/ };
|
50 |
+
/******/
|
51 |
+
/******/ // create a fake namespace object
|
52 |
+
/******/ // mode & 1: value is a module id, require it
|
53 |
+
/******/ // mode & 2: merge all properties of value into the ns
|
54 |
+
/******/ // mode & 4: return value when already ns object
|
55 |
+
/******/ // mode & 8|1: behave like require
|
56 |
+
/******/ __webpack_require__.t = function(value, mode) {
|
57 |
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
58 |
+
/******/ if(mode & 8) return value;
|
59 |
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
60 |
+
/******/ var ns = Object.create(null);
|
61 |
+
/******/ __webpack_require__.r(ns);
|
62 |
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
63 |
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
64 |
+
/******/ return ns;
|
65 |
+
/******/ };
|
66 |
+
/******/
|
67 |
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
68 |
+
/******/ __webpack_require__.n = function(module) {
|
69 |
+
/******/ var getter = module && module.__esModule ?
|
70 |
+
/******/ function getDefault() { return module['default']; } :
|
71 |
+
/******/ function getModuleExports() { return module; };
|
72 |
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
73 |
+
/******/ return getter;
|
74 |
+
/******/ };
|
75 |
+
/******/
|
76 |
+
/******/ // Object.prototype.hasOwnProperty.call
|
77 |
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
78 |
+
/******/
|
79 |
+
/******/ // __webpack_public_path__
|
80 |
+
/******/ __webpack_require__.p = "";
|
81 |
+
/******/
|
82 |
+
/******/
|
83 |
+
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./client/poll.js");
|
85 |
+
/******/ })
|
86 |
+
/************************************************************************/
|
87 |
+
/******/ ({
|
88 |
+
|
89 |
+
/***/ "./client/blocks/poll/constants.js":
|
90 |
+
/*!*****************************************!*\
|
91 |
+
!*** ./client/blocks/poll/constants.js ***!
|
92 |
+
\*****************************************/
|
93 |
+
/*! exports provided: ConfirmMessageType, FontFamilyType, FontFamilyMap, PollStatus, ClosedPollState */
|
94 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
+
|
96 |
+
"use strict";
|
97 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConfirmMessageType\", function() { return ConfirmMessageType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FontFamilyType\", function() { return FontFamilyType; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"FontFamilyMap\", function() { return FontFamilyMap; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PollStatus\", function() { return PollStatus; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ClosedPollState\", function() { return ClosedPollState; });\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);\n\n\nvar _Object$freeze;\n\nvar ConfirmMessageType = Object.freeze({\n THANK_YOU: 'thank-you',\n CUSTOM_TEXT: 'custom-text',\n REDIRECT: 'redirect',\n RESULTS: 'results'\n});\nvar FontFamilyType = Object.freeze({\n THEME_DEFAULT: 'theme-default',\n GEORGIA: 'georgia',\n PALATINO: 'palatino',\n TIMES_NEW_ROMAN: 'times-new-roman',\n ARIAL: 'arial',\n IMPACT: 'impact',\n LUCIDA: 'lucida',\n TAHOMA: 'tahoma',\n TREBUCHET: 'trebuchet',\n VERDANA: 'verdana',\n COURIER: 'courier'\n});\nvar FontFamilyMap = Object.freeze((_Object$freeze = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.THEME_DEFAULT, null), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.GEORGIA, 'Georgia, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.PALATINO, '\"Palatino Linotype\", \"Book Antiqua\", Palatino, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TIMES_NEW_ROMAN, '\"Times New Roman\", Times, serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.ARIAL, 'Arial, Helvetica, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.IMPACT, 'Impact, Charcoal, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.LUCIDA, '\"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TAHOMA, 'Tahoma, Geneva, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.TREBUCHET, '\"Trebuchet MS\", Helvetica, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.VERDANA, 'Verdana, Geneva, sans-serif'), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_Object$freeze, FontFamilyType.COURIER, '\"Courier New\", Courier, monospace'), _Object$freeze));\nvar PollStatus = Object.freeze({\n OPEN: 'open',\n CLOSED: 'closed',\n CLOSED_AFTER: 'closed-after'\n});\nvar ClosedPollState = Object.freeze({\n SHOW_RESULTS: 'show-results',\n SHOW_CLOSED_BANNER: 'show-closed-banner',\n HIDDEN: 'hidden'\n});\n\n//# sourceURL=webpack:///./client/blocks/poll/constants.js?");
|
98 |
+
|
99 |
+
/***/ }),
|
100 |
+
|
101 |
+
/***/ "./client/blocks/poll/util.js":
|
102 |
+
/*!************************************!*\
|
103 |
+
!*** ./client/blocks/poll/util.js ***!
|
104 |
+
\************************************/
|
105 |
+
/*! exports provided: addAnswer, getFontFamilyFromType, getStyleVars, extractRGBColorProperties, hexToRGB, getBlockCssClasses, isPollClosed, pollIdExistsInPageContent */
|
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, fallbackColors) {\n var _attributes$borderCol, _extractRGBColorPrope;\n\n var textColor = Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"isEmpty\"])(attributes.textColor) ? fallbackColors.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 : fallbackColors.accent,\n borderRadius: \"\".concat(attributes.borderRadius, \"px\"),\n borderWidth: \"\".concat(attributes.borderWidth, \"px\"),\n bgColor: attributes.backgroundColor,\n fontFamily: getFontFamilyFromType(attributes.fontFamily),\n submitButtonBgColor: attributes.submitButtonBackgroundColor || fallbackColors.accent,\n submitButtonTextColor: attributes.submitButtonTextColor || fallbackColors.textInverted,\n textColor: textColor,\n textColorProperties: (_extractRGBColorPrope = extractRGBColorProperties(textColor)) !== null && _extractRGBColorPrope !== void 0 ? _extractRGBColorPrope : '0, 0, 0',\n contentWideWidth: fallbackColors.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-font-family': attributes.fontFamily && _constants__WEBPACK_IMPORTED_MODULE_3__[\"FontFamilyType\"].THEME_DEFAULT !== attributes.fontFamily,\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 |
+
|
113 |
+
/***/ "./client/components/icon/check-circle.js":
|
114 |
+
/*!************************************************!*\
|
115 |
+
!*** ./client/components/icon/check-circle.js ***!
|
116 |
+
\************************************************/
|
117 |
+
/*! exports provided: default */
|
118 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
119 |
+
|
120 |
+
"use strict";
|
121 |
+
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\n/* harmony default export */ __webpack_exports__[\"default\"] = (function () {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"svg\", {\n width: \"34\",\n height: \"34\",\n viewBox: \"0 0 34 34\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n d: \"M16.6667 0C7.46667 0 0 7.46667 0 16.6667C0 25.8667 7.46667 33.3333 16.6667 33.3333C25.8667 33.3333 33.3333 25.8667 33.3333 16.6667C33.3333 7.46667 25.8667 0 16.6667 0ZM16.6667 30C9.31667 30 3.33333 24.0167 3.33333 16.6667C3.33333 9.31667 9.31667 3.33333 16.6667 3.33333C24.0167 3.33333 30 9.31667 30 16.6667C30 24.0167 24.0167 30 16.6667 30ZM13.3333 20.2833L24.3167 9.3L26.6667 11.6667L13.3333 25L6.66667 18.3333L9.01667 15.9833L13.3333 20.2833Z\",\n fill: \"var(--crowdsignal-forms-submit-button-bg-color)\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"mask\", {\n id: \"maskCheck\",\n \"mask-type\": \"alpha\",\n maskUnits: \"userSpaceOnUse\",\n x: \"0\",\n y: \"0\",\n width: \"34\",\n height: \"34\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n d: \"M16.6667 0C7.46667 0 0 7.46667 0 16.6667C0 25.8667 7.46667 33.3333 16.6667 33.3333C25.8667 33.3333 33.3333 25.8667 33.3333 16.6667C33.3333 7.46667 25.8667 0 16.6667 0ZM16.6667 30C9.31667 30 3.33333 24.0167 3.33333 16.6667C3.33333 9.31667 9.31667 3.33333 16.6667 3.33333C24.0167 3.33333 30 9.31667 30 16.6667C30 24.0167 24.0167 30 16.6667 30ZM13.3333 20.2833L24.3167 9.3L26.6667 11.6667L13.3333 25L6.66667 18.3333L9.01667 15.9833L13.3333 20.2833Z\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"g\", {\n mask: \"url(#maskCheck)\"\n }));\n});\n\n//# sourceURL=webpack:///./client/components/icon/check-circle.js?");
|
122 |
+
|
123 |
+
/***/ }),
|
124 |
+
|
125 |
+
/***/ "./client/components/icon/close.js":
|
126 |
+
/*!*****************************************!*\
|
127 |
+
!*** ./client/components/icon/close.js ***!
|
128 |
+
\*****************************************/
|
129 |
+
/*! exports provided: default */
|
130 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
131 |
+
|
132 |
+
"use strict";
|
133 |
+
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\n/* harmony default export */ __webpack_exports__[\"default\"] = (function () {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"svg\", {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12Z\",\n fill: \"white\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"mask\", {\n id: \"maskClose\",\n \"mask-type\": \"alpha\",\n maskUnits: \"userSpaceOnUse\",\n x: \"5\",\n y: \"5\",\n width: \"14\",\n height: \"14\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z\",\n fill: \"white\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"g\", {\n mask: \"url(#maskClose)\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"rect\", {\n width: \"24\",\n height: \"24\",\n fill: \"black\"\n })));\n});\n\n//# sourceURL=webpack:///./client/components/icon/close.js?");
|
134 |
+
|
135 |
+
/***/ }),
|
136 |
+
|
137 |
+
/***/ "./client/components/icon/thank-you.js":
|
138 |
+
/*!*********************************************!*\
|
139 |
+
!*** ./client/components/icon/thank-you.js ***!
|
140 |
+
\*********************************************/
|
141 |
+
/*! exports provided: default */
|
142 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
143 |
+
|
144 |
+
"use strict";
|
145 |
+
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\n/* harmony default export */ __webpack_exports__[\"default\"] = (function (_ref) {\n var className = _ref.className;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"svg\", {\n width: \"88\",\n height: \"88\",\n viewBox: \"0 0 88 88\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\",\n className: className\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"g\", {\n filter: \"url(#filterThankYou)\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M44 80C66.0914 80 84 62.0914 84 40C84 17.9086 66.0914 0 44 0C21.9086 0 4 17.9086 4 40C4 62.0914 21.9086 80 44 80Z\",\n fill: \"#384869\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n d: \"M26.0226 27.1047L27.2135 22.9517L28.6403 23.3609L29.0032 22.0954L24.5573 20.8206L24.1945 22.086L25.6214 22.4952L24.4305 26.6481L26.0226 27.1047ZM33.0856 29.1299L34.6393 23.7116L33.0472 23.2551L32.4572 25.3128L30.5497 24.7658L31.1397 22.7081L29.5476 22.2516L27.9939 27.6699L29.586 28.1265L30.1868 26.0312L32.0943 26.5782L31.4935 28.6734L33.0856 29.1299ZM37.4113 30.3703L39.1085 30.857L38.8937 24.9315L36.896 24.3587L33.5738 29.2699L35.1959 29.7351L35.7865 28.7381L37.4387 29.2119L37.4113 30.3703ZM37.4837 25.8804L37.5138 25.889L37.4715 28.0063L36.3976 27.6983L37.4837 25.8804ZM41.0986 31.4276L41.9169 28.5739L41.947 28.5825L43.2352 32.0403L44.4556 32.3902L46.0092 26.9719L44.5073 26.5412L43.7019 29.3499L43.6719 29.3412L42.3857 25.9328L41.1504 25.5786L39.5967 30.997L41.0986 31.4276ZM46.7986 33.0621L47.2056 31.6427L47.7936 31.1936L48.4057 33.5229L50.2569 34.0537L49.2542 30.5072L51.728 28.6117L50.0571 28.1325L47.7234 29.9504L47.6934 29.9417L48.3523 27.6437L46.7602 27.1872L45.2065 32.6056L46.7986 33.0621ZM55.281 35.4944L55.7731 33.7784L58.6859 30.6068L57.0225 30.1298L55.4426 32.0541L55.4125 32.0455L55.0924 29.5764L53.3914 29.0887L54.181 33.3218L53.6889 35.0378L55.281 35.4944ZM61.4239 31.2903C59.7492 30.8101 58.3861 31.5815 57.8897 33.3125C57.3934 35.0435 58.1379 36.4152 59.8163 36.8964C61.491 37.3767 62.853 36.6091 63.3494 34.878C63.8458 33.147 63.0986 31.7705 61.4239 31.2903ZM61.0599 32.5595C61.7246 32.7501 61.9964 33.4742 61.7273 34.4129C61.4592 35.3479 60.8486 35.8189 60.1803 35.6273C59.5119 35.4356 59.2438 34.7126 59.5119 33.7776C59.781 32.8389 60.3953 32.3689 61.0599 32.5595ZM66.3384 32.8012L64.7463 32.3446L63.7461 35.833C63.3918 37.0683 64.1232 38.1314 65.5539 38.5417C66.9845 38.9519 68.1681 38.4379 68.5223 37.2025L69.5226 33.7142L67.9305 33.2577L66.9809 36.5695C66.8172 37.1403 66.4462 37.3712 65.9318 37.2237C65.4174 37.0762 65.2251 36.6838 65.3888 36.113L66.3384 32.8012ZM36.4693 42.5838L37.0195 40.665L39.0246 41.24L39.367 40.0459L37.3619 39.4709L37.6601 38.4308L39.8755 39.0661L40.2384 37.8007L36.4309 36.7089L34.8772 42.1273L36.4693 42.5838ZM43.4269 38.6134C41.7522 38.1332 40.3892 38.9045 39.8928 40.6356C39.3964 42.3666 40.141 43.7382 41.8194 44.2195C43.4941 44.6997 44.8561 43.9321 45.3525 42.2011C45.8488 40.4701 45.1016 39.0936 43.4269 38.6134ZM43.063 39.8826C43.7276 40.0731 43.9995 40.7972 43.7303 41.7359C43.4622 42.6709 42.8517 43.142 42.1833 42.9503C41.515 42.7587 41.2468 42.0357 41.5149 41.1007C41.7841 40.162 42.3984 39.692 43.063 39.8826ZM48.0045 41.2995L48.6654 41.489C49.0934 41.6117 49.2996 41.9838 49.1844 42.3856C49.0671 42.7948 48.7144 42.9904 48.2675 42.8622L47.6104 42.6738L48.0045 41.2995ZM47.3089 43.7252L47.8309 43.8748L48.1659 45.9377L49.9457 46.4481L49.5058 44.0991C50.1503 43.9913 50.6348 43.4638 50.8179 42.8255C51.1506 41.6652 50.602 40.7724 49.1563 40.3579L46.7494 39.6677L45.1957 45.086L46.7878 45.5426L47.3089 43.7252ZM26.5905 52.2347L29.7888 47.2879L28.0315 46.784L26.0433 50.4442L26.0133 50.4356L26.2667 46.278L24.4343 45.7525L24.5253 51.6425L26.5905 52.2347ZM32.7521 48.036C31.0774 47.5558 29.7143 48.3272 29.218 50.0582C28.7216 51.7892 29.4661 53.1608 31.1446 53.6421C32.8193 54.1223 34.1813 53.3547 34.6776 51.6237C35.174 49.8927 34.4268 48.5162 32.7521 48.036ZM32.3882 49.3052C33.0528 49.4958 33.3247 50.2199 33.0555 51.1586C32.7874 52.0936 32.1769 52.5646 31.5085 52.373C30.8401 52.1813 30.572 51.4583 30.8401 50.5233C31.1093 49.5846 31.7236 49.1146 32.3882 49.3052ZM37.0705 55.2398L38.2613 51.0868L39.6882 51.496L40.0511 50.2306L35.6052 48.9557L35.2424 50.2211L36.6692 50.6303L35.4784 54.7832L37.0705 55.2398ZM40.6339 56.2616L42.1876 50.8432L40.5955 50.3867L39.0418 55.805L40.6339 56.2616ZM42.8869 56.9076L43.7052 54.0538L43.7352 54.0625L45.0234 57.5202L46.2438 57.8702L47.7975 52.4518L46.2955 52.0211L45.4901 54.8298L45.4601 54.8212L44.174 51.4128L42.9386 51.0585L41.3849 56.4769L42.8869 56.9076ZM52.7701 57.2465L52.9747 56.533L50.6166 55.8569L50.3129 56.9157L51.139 57.1526L51.11 57.2256C50.94 57.6482 50.4891 57.8318 49.9709 57.6832C49.2725 57.483 48.9872 56.7632 49.2704 55.7756C49.5471 54.8106 50.1045 54.369 50.7804 54.5628C51.2385 54.6942 51.5209 55.0556 51.5119 55.4837L53.0777 55.9327C53.2763 54.7868 52.4918 53.6963 51.1325 53.3065C49.4615 52.8274 48.1511 53.5569 47.6418 55.333C47.1261 57.1316 47.854 58.4335 49.5738 58.9266C51.1471 59.3778 52.3448 58.7297 52.7701 57.2465ZM54.5376 54.3845L53.6262 58.0731L54.9329 58.4477L56.1146 54.8367L54.5376 54.3845ZM53.7294 60.1792C54.1649 60.3041 54.6201 60.077 54.7407 59.6564C54.8603 59.2396 54.5945 58.8058 54.159 58.681C53.7159 58.5539 53.2644 58.782 53.1449 59.1988C53.0243 59.6194 53.2863 60.0521 53.7294 60.1792Z\",\n fill: \"white\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"path\", {\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n d: \"M44 75.2C63.4405 75.2 79.2 59.4404 79.2 40C79.2 20.5596 63.4405 4.80002 44 4.80002C24.5596 4.80002 8.80005 20.5596 8.80005 40C8.80005 59.4404 24.5596 75.2 44 75.2Z\",\n stroke: \"white\",\n strokeWidth: \"2\",\n strokeLinecap: \"round\",\n strokeDasharray: \"0.1 4\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"defs\", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"filter\", {\n id: \"filterThankYou\",\n x: \"0\",\n y: \"0\",\n width: \"88\",\n height: \"88\",\n filterUnits: \"userSpaceOnUse\",\n colorInterpolationFilters: \"sRGB\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"feFlood\", {\n floodOpacity: \"0\",\n result: \"BackgroundImageFix\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"feColorMatrix\", {\n in: \"SourceAlpha\",\n type: \"matrix\",\n values: \"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"feOffset\", {\n dy: \"4\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"feGaussianBlur\", {\n stdDeviation: \"2\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"feColorMatrix\", {\n type: \"matrix\",\n values: \"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"feBlend\", {\n mode: \"normal\",\n in2: \"BackgroundImageFix\",\n result: \"effect1_dropShadow\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"feBlend\", {\n mode: \"normal\",\n in: \"SourceGraphic\",\n in2: \"effect1_dropShadow\",\n result: \"shape\"\n }))));\n});\n\n//# sourceURL=webpack:///./client/components/icon/thank-you.js?");
|
146 |
+
|
147 |
+
/***/ }),
|
148 |
+
|
149 |
+
/***/ "./client/components/poll/answer-results.js":
|
150 |
+
/*!**************************************************!*\
|
151 |
+
!*** ./client/components/poll/answer-results.js ***!
|
152 |
+
\**************************************************/
|
153 |
+
/*! exports provided: default */
|
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()('wp-block-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: \"wp-block-crowdsignal-forms-poll__answer-results-labels\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"wp-block-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: \"wp-block-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: \"wp-block-crowdsignal-forms-poll__answer-results-percent\"\n }, showResults && \"\".concat(answerShare.toFixed(2), \"%\"))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__answer-results-progress-track\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-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 |
+
|
161 |
+
/***/ "./client/components/poll/answer.js":
|
162 |
+
/*!******************************************!*\
|
163 |
+
!*** ./client/components/poll/answer.js ***!
|
164 |
+
\******************************************/
|
165 |
+
/*! exports provided: default */
|
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()('wp-block-crowdsignal-forms-poll__answer', {\n 'is-multiple-choice': isMultipleChoice,\n 'is-selected': isSelected,\n 'is-focused': isFocused\n });\n var answerElementId = \"poll-answer-\".concat(answerIdFromApi);\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: \"wp-block-crowdsignal-forms-poll__input\",\n id: answerElementId,\n name: \"answer\",\n onChange: handleSelect,\n selected: isSelected,\n type: isMultipleChoice ? 'checkbox' : 'radio',\n value: 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: \"wp-block-crowdsignal-forms-poll__check\"\n }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__answer-label-wrapper\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"wp-block-crowdsignal-forms-poll__answer-label\"\n }, Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__[\"decodeEntities\"])(text))));\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 |
+
|
173 |
+
/***/ "./client/components/poll/closed-banner.js":
|
174 |
+
/*!*************************************************!*\
|
175 |
+
!*** ./client/components/poll/closed-banner.js ***!
|
176 |
+
\*************************************************/
|
177 |
+
/*! exports provided: default */
|
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 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 ClosedBanner = function ClosedBanner(_ref) {\n var hasVoted = _ref.hasVoted,\n isPollClosed = _ref.isPollClosed,\n isPollHidden = _ref.isPollHidden;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__closed-banner\"\n }, isPollHidden && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('This Poll is Hidden'), isPollClosed && !isPollHidden && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('This Poll is Closed'), hasVoted && Object(lib_i18n__WEBPACK_IMPORTED_MODULE_2__[\"__\"])('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 |
+
|
185 |
+
/***/ "./client/components/poll/error-banner.js":
|
186 |
+
/*!************************************************!*\
|
187 |
+
!*** ./client/components/poll/error-banner.js ***!
|
188 |
+
\************************************************/
|
189 |
+
/*! exports provided: default */
|
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: \"wp-block-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 |
+
|
197 |
+
/***/ "./client/components/poll/footer-branding.js":
|
198 |
+
/*!***************************************************!*\
|
199 |
+
!*** ./client/components/poll/footer-branding.js ***!
|
200 |
+
\***************************************************/
|
201 |
+
/*! exports provided: default */
|
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: \"wp-block-crowdsignal-forms-poll__footer-branding\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"a\", {\n className: \"wp-block-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: \"wp-block-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 |
+
|
209 |
+
/***/ "./client/components/poll/index.js":
|
210 |
+
/*!*****************************************!*\
|
211 |
+
!*** ./client/components/poll/index.js ***!
|
212 |
+
\*****************************************/
|
213 |
+
/*! exports provided: default */
|
214 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
215 |
+
|
216 |
+
"use strict";
|
217 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var seedrandom__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! seedrandom */ \"./node_modules/seedrandom/index.js\");\n/* harmony import */ var seedrandom__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(seedrandom__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/html-entities */ \"@wordpress/html-entities\");\n/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var blocks_poll_util__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! blocks/poll/util */ \"./client/blocks/poll/util.js\");\n/* harmony import */ var blocks_poll_constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! blocks/poll/constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! components/with-fallback-styles */ \"./client/components/with-fallback-styles/index.js\");\n/* harmony import */ var _closed_banner__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./closed-banner */ \"./client/components/poll/closed-banner.js\");\n/* harmony import */ var _results__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./results */ \"./client/components/poll/results.js\");\n/* harmony import */ var _vote__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./vote */ \"./client/components/poll/vote.js\");\n/* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./styles */ \"./client/components/poll/styles.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./util */ \"./client/components/poll/util.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n/* harmony import */ var data_hooks__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! data/hooks */ \"./client/data/hooks/index.js\");\n/* harmony import */ var data_poll__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! data/poll */ \"./client/data/poll/index.js\");\n/* harmony import */ var _error_banner__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./error-banner */ \"./client/components/poll/error-banner.js\");\n/* harmony import */ var _submit_message__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./submit-message */ \"./client/components/poll/submit-message.js\");\n\n\n\n\n\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n/**\n * External dependencies\n */\n\n\n\n/**\n * WordPress dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar Poll = function Poll(_ref) {\n var attributes = _ref.attributes,\n fallbackStyles = _ref.fallbackStyles,\n renderStyleProbe = _ref.renderStyleProbe;\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_6__[\"useState\"])(Math.random()),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4___default()(_useState, 1),\n randomAnswerSeed = _useState2[0];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_6__[\"useState\"])(''),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4___default()(_useState3, 2),\n errorMessage = _useState4[0],\n setErrorMessage = _useState4[1];\n\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_6__[\"useState\"])(false),\n _useState6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_4___default()(_useState5, 2),\n dismissSubmitMessage = _useState6[0],\n setDismissSubmitMessage = _useState6[1];\n\n var apiPollData = attributes.apiPollData;\n var pollIdFromApi = apiPollData.id;\n\n var _usePollVote = Object(data_hooks__WEBPACK_IMPORTED_MODULE_19__[\"usePollVote\"])(pollIdFromApi, attributes.hasOneResponsePerComputer),\n hasVoted = _usePollVote.hasVoted,\n isVoting = _usePollVote.isVoting,\n vote = _usePollVote.vote;\n\n var handleSubmit = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee(selectedAnswerIds) {\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n setErrorMessage('');\n setDismissSubmitMessage(false);\n _context.next = 5;\n return vote(selectedAnswerIds);\n\n case 5:\n if (blocks_poll_constants__WEBPACK_IMPORTED_MODULE_11__[\"ConfirmMessageType\"].REDIRECT === attributes.confirmMessageType) {\n window.open(attributes.redirectAddress);\n }\n\n _context.next = 11;\n break;\n\n case 8:\n _context.prev = 8;\n _context.t0 = _context[\"catch\"](0);\n\n if (_context.t0 instanceof data_poll__WEBPACK_IMPORTED_MODULE_20__[\"CrowdsignalFormsError\"]) {\n setErrorMessage(_context.t0.message);\n } else {\n setErrorMessage(Object(lib_i18n__WEBPACK_IMPORTED_MODULE_18__[\"__\"])('Server error. Please try again.'));\n }\n\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[0, 8]]);\n }));\n\n return function handleSubmit(_x) {\n return _ref2.apply(this, arguments);\n };\n }();\n\n var isClosed = Object(blocks_poll_util__WEBPACK_IMPORTED_MODULE_10__[\"isPollClosed\"])(attributes.pollStatus, attributes.closedAfterDateTime);\n\n if (isClosed && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_11__[\"ClosedPollState\"].HIDDEN === attributes.closedPollState) {\n return null;\n }\n\n var showResults = isClosed && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_11__[\"ClosedPollState\"].SHOW_RESULTS === attributes.closedPollState || hasVoted && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_11__[\"ConfirmMessageType\"].RESULTS === attributes.confirmMessageType;\n var showSubmitMessage = hasVoted && !showResults && !dismissSubmitMessage && blocks_poll_constants__WEBPACK_IMPORTED_MODULE_11__[\"ConfirmMessageType\"].REDIRECT !== attributes.confirmMessageType;\n var classes = Object(blocks_poll_util__WEBPACK_IMPORTED_MODULE_10__[\"getBlockCssClasses\"])(attributes, attributes.className, 'wp-block-crowdsignal-forms-poll', {\n 'has-voted': hasVoted,\n 'is-closed': isClosed,\n 'is-voting': isVoting\n });\n var answerClientIdMap = Object(lodash__WEBPACK_IMPORTED_MODULE_8__[\"reduce\"])(apiPollData.answers, function (accum, answer) {\n accum[answer.client_id] = answer.id;\n return accum;\n }, {});\n var answersWithIds = Object(lodash__WEBPACK_IMPORTED_MODULE_8__[\"map\"])(attributes.answers, function (answerWithoutIdFromApi) {\n var answerIdFromApi = answerClientIdMap[answerWithoutIdFromApi.answerId];\n return _objectSpread({}, answerWithoutIdFromApi, {\n answerIdFromApi: answerIdFromApi\n });\n });\n var answers = Object(_util__WEBPACK_IMPORTED_MODULE_17__[\"shuffleWithGenerator\"])(Object(lodash__WEBPACK_IMPORTED_MODULE_8__[\"filter\"])(answersWithIds, function (answer) {\n return !!answer.text;\n }), attributes.randomizeAnswers ? new seedrandom__WEBPACK_IMPORTED_MODULE_7___default.a(randomAnswerSeed) : function () {\n return 1;\n });\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(\"div\", {\n className: classes,\n style: Object(blocks_poll_util__WEBPACK_IMPORTED_MODULE_10__[\"getStyleVars\"])(attributes, fallbackStyles)\n }, errorMessage && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_error_banner__WEBPACK_IMPORTED_MODULE_21__[\"default\"], null, errorMessage), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__content\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(\"h3\", {\n className: \"wp-block-crowdsignal-forms-poll__question\"\n }, Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_9__[\"decodeEntities\"])(attributes.question)), attributes.note && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(\"p\", {\n className: \"wp-block-crowdsignal-forms-poll__note\"\n }, Object(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_9__[\"decodeEntities\"])(attributes.note)), !showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_vote__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n answers: answers,\n isMultipleChoice: attributes.isMultipleChoice,\n onSubmit: handleSubmit,\n submitButtonLabel: attributes.submitButtonLabel,\n hasVoted: hasVoted,\n isVoting: isVoting,\n hideBranding: attributes.hideBranding\n }), showResults && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_results__WEBPACK_IMPORTED_MODULE_14__[\"default\"], {\n pollIdFromApi: pollIdFromApi,\n answers: answers,\n setErrorMessage: setErrorMessage,\n hideBranding: attributes.hideBranding\n })), showSubmitMessage && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_submit_message__WEBPACK_IMPORTED_MODULE_22__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, attributes, {\n setDismissSubmitMessage: setDismissSubmitMessage\n })), (isClosed || hasVoted) && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__[\"createElement\"])(_closed_banner__WEBPACK_IMPORTED_MODULE_13__[\"default\"], {\n isPollClosed: isClosed,\n hasVoted: hasVoted\n }), renderStyleProbe());\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Object(components_with_fallback_styles__WEBPACK_IMPORTED_MODULE_12__[\"withFallbackStyles\"])(_styles__WEBPACK_IMPORTED_MODULE_16__[\"PollStyles\"], _styles__WEBPACK_IMPORTED_MODULE_16__[\"getPollStyles\"])(Poll));\n\n//# sourceURL=webpack:///./client/components/poll/index.js?");
|
218 |
+
|
219 |
+
/***/ }),
|
220 |
+
|
221 |
+
/***/ "./client/components/poll/results.js":
|
222 |
+
/*!*******************************************!*\
|
223 |
+
!*** ./client/components/poll/results.js ***!
|
224 |
+
\*******************************************/
|
225 |
+
/*! exports provided: default */
|
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()('wp-block-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: \"wp-block-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: \"wp-block-crowdsignal-forms-poll__results-footer\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"span\", {\n className: \"wp-block-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 |
+
|
233 |
+
/***/ "./client/components/poll/styles.js":
|
234 |
+
/*!******************************************!*\
|
235 |
+
!*** ./client/components/poll/styles.js ***!
|
236 |
+
\******************************************/
|
237 |
+
/*! exports provided: getPollStyles, PollStyles */
|
238 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
239 |
+
|
240 |
+
"use strict";
|
241 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getPollStyles\", function() { return getPollStyles; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PollStyles\", function() { return PollStyles; });\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! components/with-fallback-styles/util */ \"./client/components/with-fallback-styles/util.js\");\n\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\nvar getPollStyles = function getPollStyles(node) {\n if (null === node) {\n return {};\n }\n\n var buttonNode = node.querySelector('.wp-block-button__link');\n var textNode = node.querySelector('p');\n var wideContentNode = node.querySelector('.alignwide');\n return {\n accent: Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(buttonNode),\n surface: Object(components_with_fallback_styles_util__WEBPACK_IMPORTED_MODULE_2__[\"getBackgroundColor\"])(textNode),\n text: window.getComputedStyle(textNode).color,\n textInverted: window.getComputedStyle(buttonNode).color,\n contentWideWidth: window.getComputedStyle(wideContentNode).maxWidth\n };\n};\nvar PollStyles = function PollStyles() {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"p\", null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-button__link\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"entry-content\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"alignwide\"\n })));\n};\n\n//# sourceURL=webpack:///./client/components/poll/styles.js?");
|
242 |
+
|
243 |
+
/***/ }),
|
244 |
+
|
245 |
+
/***/ "./client/components/poll/submit-message.js":
|
246 |
+
/*!**************************************************!*\
|
247 |
+
!*** ./client/components/poll/submit-message.js ***!
|
248 |
+
\**************************************************/
|
249 |
+
/*! exports provided: default */
|
250 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
251 |
+
|
252 |
+
"use strict";
|
253 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! blocks/poll/constants */ \"./client/blocks/poll/constants.js\");\n/* harmony import */ var components_icon_close__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! components/icon/close */ \"./client/components/icon/close.js\");\n/* harmony import */ var components_icon_check_circle__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! components/icon/check-circle */ \"./client/components/icon/check-circle.js\");\n/* harmony import */ var components_icon_thank_you__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! components/icon/thank-you */ \"./client/components/icon/thank-you.js\");\n/* harmony import */ var _footer_branding__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./footer-branding */ \"./client/components/poll/footer-branding.js\");\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n\n\n\n\n\n\nvar toggleAnimationPlayPause = function toggleAnimationPlayPause(event) {\n var player = event.target;\n\n if (!player) {\n return;\n }\n\n if (player.paused) {\n player.play();\n } else {\n player.pause();\n }\n};\n\nvar SubmitMessage = function SubmitMessage(_ref) {\n var confirmMessageType = _ref.confirmMessageType,\n customConfirmMessage = _ref.customConfirmMessage,\n setDismissSubmitMessage = _ref.setDismissSubmitMessage,\n hideBranding = _ref.hideBranding;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__submit-message-container\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__submit-message\"\n }, blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__[\"ConfirmMessageType\"].THANK_YOU === confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"video\", {\n muted: true,\n autoPlay: true,\n loop: true,\n playsInline: true,\n poster: \"https://crowdsignal.files.wordpress.com/2020/02/thumbs-up-video-placeholder.jpg\",\n width: \"100%\",\n onClick: toggleAnimationPlayPause\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"source\", {\n src: \"https://crowdsignal.files.wordpress.com/2019/08/thumbs-up-cs.mp4\",\n type: \"video/mp4\"\n })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(components_icon_thank_you__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n className: \"wp-block-crowdsignal-forms-poll__thank-you-sticker\"\n }), !hideBranding && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"img\", {\n className: \"wp-block-crowdsignal-forms-poll__thank-you-cs-sticker\",\n src: \"https://app.crowdsignal.com/images/svg/cs-logo-dots.svg\",\n alt: \"Crowdsignal sticker\"\n })), blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__[\"ConfirmMessageType\"].CUSTOM_TEXT === confirmMessageType && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__custom-message-check\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(components_icon_check_circle__WEBPACK_IMPORTED_MODULE_4__[\"default\"], null)), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__custom-message\"\n }, Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"isEmpty\"])(customConfirmMessage) ? Object(lib_i18n__WEBPACK_IMPORTED_MODULE_7__[\"__\"])('Thank you for your submission!') : customConfirmMessage)), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"button\", {\n className: \"wp-block-crowdsignal-forms-poll__dismiss-submit-message\",\n onClick: function onClick() {\n return setDismissSubmitMessage(true);\n }\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(components_icon_close__WEBPACK_IMPORTED_MODULE_3__[\"default\"], null))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__submit-message-footer\"\n }, !hideBranding && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(_footer_branding__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n showLogo: blocks_poll_constants__WEBPACK_IMPORTED_MODULE_2__[\"ConfirmMessageType\"].THANK_YOU !== confirmMessageType\n })));\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (SubmitMessage);\n\n//# sourceURL=webpack:///./client/components/poll/submit-message.js?");
|
254 |
+
|
255 |
+
/***/ }),
|
256 |
+
|
257 |
+
/***/ "./client/components/poll/util.js":
|
258 |
+
/*!****************************************!*\
|
259 |
+
!*** ./client/components/poll/util.js ***!
|
260 |
+
\****************************************/
|
261 |
+
/*! exports provided: addApiAnswerIds, shuffleWithGenerator, isAnswerEmpty */
|
262 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
263 |
+
|
264 |
+
"use strict";
|
265 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"addApiAnswerIds\", function() { return addApiAnswerIds; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"shuffleWithGenerator\", function() { return shuffleWithGenerator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isAnswerEmpty\", function() { return isAnswerEmpty; });\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n/**\n * External dependencies\n */\n\n/**\n * Adds api answer ids to the answer objects (when they are available).\n *\n * @param {Array} answers Answers array\n * @param {Array} answerIdMap A json object with client answer ids as keys, and API answer ids as values.\n * @return {Array} Updated answers array\n */\n\nvar addApiAnswerIds = function addApiAnswerIds(answers, answerIdMap) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"map\"])(answers, function (answer) {\n if (typeof answer.answerIdFromApi !== 'undefined') {\n return answer;\n }\n\n return _objectSpread({}, answer, {\n answerIdFromApi: answerIdMap[answer.answerId]\n });\n });\n};\n/**\n * Fisher-Yates algorithm shuffle implementation.\n * Provides a predictable way of shuffling array items given a seed.\n *\n * @param {Array} toShuffle The array to shuffle.\n * @param {Function} randomNumberGenerator A function that generates a random number (like `seedrandom`).\n * @return {Array} The shuffled array.\n */\n\nvar shuffleWithGenerator = function shuffleWithGenerator(toShuffle, randomNumberGenerator) {\n var shuffled = toShuffle.slice();\n\n for (var i = shuffled.length - 1; i > 0; i--) {\n var j = Math.floor(randomNumberGenerator() * i);\n var tmp = shuffled[i];\n shuffled[i] = shuffled[j];\n shuffled[j] = tmp;\n }\n\n return shuffled;\n};\n/**\n * Determines if an answer is considered \"empty\", based on if text is set and blank or object has no values.\n *\n * @param {*} answer The answer object.\n */\n\nvar isAnswerEmpty = function isAnswerEmpty(answer) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"isEmpty\"])(answer) || 'undefined' === typeof answer.text || null === answer.text || '' === answer.text;\n};\n\n//# sourceURL=webpack:///./client/components/poll/util.js?");
|
266 |
+
|
267 |
+
/***/ }),
|
268 |
+
|
269 |
+
/***/ "./client/components/poll/vote.js":
|
270 |
+
/*!****************************************!*\
|
271 |
+
!*** ./client/components/poll/vote.js ***!
|
272 |
+
\****************************************/
|
273 |
+
/*! exports provided: default */
|
274 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
275 |
+
|
276 |
+
"use strict";
|
277 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ \"./node_modules/@babel/runtime/helpers/toConsumableArray.js\");\n/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ \"@wordpress/element\");\n/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _answer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./answer */ \"./client/components/poll/answer.js\");\n/* harmony import */ var _footer_branding__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./footer-branding */ \"./client/components/poll/footer-branding.js\");\n\n\n\n\n\n/**\n * External dependencies\n */\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\n\nvar PollVote = function PollVote(_ref) {\n var answers = _ref.answers,\n hasVoted = _ref.hasVoted,\n isMultipleChoice = _ref.isMultipleChoice,\n isVoting = _ref.isVoting,\n onSubmit = _ref.onSubmit,\n submitButtonLabel = _ref.submitButtonLabel,\n hideBranding = _ref.hideBranding;\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useState\"])([]),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2),\n selected = _useState2[0],\n setSelected = _useState2[1];\n\n var handleSelect = function handleSelect(answerId) {\n if (!isMultipleChoice) {\n return setSelected([answerId]);\n }\n\n if (Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"includes\"])(selected, answerId)) {\n return setSelected(Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"without\"])(selected, answerId));\n }\n\n setSelected([].concat(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1___default()(selected), [answerId]));\n };\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_4__[\"useState\"])([]),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState3, 2),\n focused = _useState4[0],\n setFocused = _useState4[1];\n\n var handleFocus = function handleFocus(answerId) {\n return setFocused([answerId]);\n };\n\n var handleSubmit = function handleSubmit(event) {\n event.preventDefault();\n onSubmit(selected);\n };\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"form\", {\n className: \"wp-block-crowdsignal-forms-poll__form\",\n onSubmit: handleSubmit\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms__options\"\n }, Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"map\"])(answers, function (answer, index) {\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_answer__WEBPACK_IMPORTED_MODULE_7__[\"default\"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({\n key: \"poll-answer-\".concat(index),\n isMultipleChoice: isMultipleChoice,\n isSelected: Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"includes\"])(selected, answer.answerIdFromApi),\n isFocused: Object(lodash__WEBPACK_IMPORTED_MODULE_6__[\"includes\"])(focused, answer.answerIdFromApi),\n onSelect: handleSelect,\n onFocus: handleFocus,\n hasVoted: hasVoted,\n isVoting: isVoting\n }, answer));\n })), !hasVoted && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-crowdsignal-forms-poll__actions\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp-block-button\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"input\", {\n type: \"submit\",\n className: \"wp-block-button__link wp-block-crowdsignal-forms-poll__submit-button\",\n disabled: isVoting || !selected.length,\n value: submitButtonLabel\n }))), !hideBranding && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(\"div\", {\n className: \"wp_block-crowdsignal-forms-poll__vote-branding\"\n }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"])(_footer_branding__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n showLogo: false\n })));\n};\n\nPollVote.propTypes = {\n answers: prop_types__WEBPACK_IMPORTED_MODULE_5___default.a.array.isRequired,\n isMultipleChoice: prop_types__WEBPACK_IMPORTED_MODULE_5___default.a.bool,\n onSubmit: prop_types__WEBPACK_IMPORTED_MODULE_5___default.a.func.isRequired,\n submitButtonLabel: prop_types__WEBPACK_IMPORTED_MODULE_5___default.a.string.isRequired\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (PollVote);\n\n//# sourceURL=webpack:///./client/components/poll/vote.js?");
|
278 |
+
|
279 |
+
/***/ }),
|
280 |
+
|
281 |
+
/***/ "./client/components/with-fallback-styles/index.js":
|
282 |
+
/*!*********************************************************!*\
|
283 |
+
!*** ./client/components/with-fallback-styles/index.js ***!
|
284 |
+
\*********************************************************/
|
285 |
+
/*! exports provided: withFallbackStyles */
|
286 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
287 |
+
|
288 |
+
"use strict";
|
289 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"withFallbackStyles\", function() { return withFallbackStyles; });\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_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/objectWithoutProperties */ \"./node_modules/@babel/runtime/helpers/objectWithoutProperties.js\");\n/* harmony import */ var _babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_objectWithoutProperties__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 react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ \"@wordpress/components\");\n/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__);\n\n\n\n\n/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\n\n\n\nvar StyleProbe = function StyleProbe(_ref) {\n var children = _ref.children;\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(\"div\", {\n className: \"crowdsignal-forms__style-probe\"\n }, children);\n};\n\nvar withFallbackStyles = function withFallbackStyles(VirtualComponent, getStyles) {\n return function (WrappedComponent) {\n var getFallbackStyles = Object(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__[\"withFallbackStyles\"])(function (node) {\n return {\n fallbackStyles: getStyles(node.querySelector('.crowdsignal-forms__style-probe'))\n };\n });\n return getFallbackStyles(function (_ref2) {\n var fallbackStyles = _ref2.fallbackStyles,\n props = _babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1___default()(_ref2, [\"fallbackStyles\"]);\n\n var renderProbe = function renderProbe() {\n if (fallbackStyles) {\n return null;\n }\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(StyleProbe, null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(VirtualComponent, null));\n };\n\n return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__[\"createElement\"])(WrappedComponent, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({\n fallbackStyles: fallbackStyles || {},\n renderStyleProbe: renderProbe\n }, props));\n });\n };\n};\n\n//# sourceURL=webpack:///./client/components/with-fallback-styles/index.js?");
|
290 |
+
|
291 |
+
/***/ }),
|
292 |
+
|
293 |
+
/***/ "./client/components/with-fallback-styles/util.js":
|
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 |
+
|
305 |
+
/***/ "./client/data/hooks/index.js":
|
306 |
+
/*!************************************!*\
|
307 |
+
!*** ./client/data/hooks/index.js ***!
|
308 |
+
\************************************/
|
309 |
+
/*! exports provided: usePollResults, usePollVote, useIsCsConnected */
|
310 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
311 |
+
|
312 |
+
"use strict";
|
313 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"usePollResults\", function() { return usePollResults; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"usePollVote\", function() { return usePollVote; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"useIsCsConnected\", function() { return useIsCsConnected; });\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! js-cookie */ \"./node_modules/js-cookie/src/js.cookie.js\");\n/* harmony import */ var js_cookie__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(js_cookie__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var data_poll__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! data/poll */ \"./client/data/poll/index.js\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util */ \"./client/data/hooks/util.js\");\n\n\n\n\n/**\n * External dependencies\n */\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar usePollResults = function usePollResults(pollId) {\n var _useFetch = Object(_util__WEBPACK_IMPORTED_MODULE_6__[\"useFetch\"])(function () {\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestResults\"])(pollId);\n }, [pollId]),\n data = _useFetch.data,\n error = _useFetch.error,\n loading = _useFetch.loading;\n\n return {\n error: error,\n loading: loading,\n results: data\n };\n};\n/**\n * React Hook that returns state variables for voting status and a function to perform a vote.\n *\n * @param {number} pollId ID of the poll being loaded.\n * @param {boolean} enableVoteRestriction sets whether or not the vote cookie is read and set\n */\n\nvar usePollVote = function usePollVote(pollId) {\n var enableVoteRestriction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var cookieName = \"cs-poll-\".concat(pollId);\n\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(false),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState, 2),\n isVoting = _useState2[0],\n setIsVoting = _useState2[1];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(false),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState3, 2),\n hasVoted = _useState4[0],\n setHasVoted = _useState4[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useEffect\"])(function () {\n if (enableVoteRestriction && undefined !== js_cookie__WEBPACK_IMPORTED_MODULE_4___default.a.get(cookieName)) {\n setHasVoted(true);\n }\n }, []);\n\n var vote = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(selectedAnswerIds) {\n var nonce;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n setIsVoting(true);\n _context.next = 4;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestVoteNonce\"])(pollId);\n\n case 4:\n nonce = _context.sent;\n _context.next = 7;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestVote\"])(nonce, pollId, selectedAnswerIds);\n\n case 7:\n setHasVoted(true);\n\n if (enableVoteRestriction) {\n js_cookie__WEBPACK_IMPORTED_MODULE_4___default.a.set(cookieName, new Date().getTime(), {\n sameSite: 'Strict',\n expires: 365\n });\n }\n\n case 9:\n _context.prev = 9;\n setIsVoting(false);\n return _context.finish(9);\n\n case 12:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[0,, 9, 12]]);\n }));\n\n return function vote(_x) {\n return _ref.apply(this, arguments);\n };\n }();\n\n return {\n hasVoted: hasVoted,\n isVoting: isVoting,\n vote: vote\n };\n};\nvar useIsCsConnected = function useIsCsConnected() {\n /* assume connection is enabled, so placeholder doesn't flash while we add a block and wait for the request */\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useState\"])(true),\n _useState6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_2___default()(_useState5, 2),\n isConnected = _useState6[0],\n setIsConnected = _useState6[1];\n\n var checkIsConnected = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() {\n var isEnabled;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return Object(data_poll__WEBPACK_IMPORTED_MODULE_5__[\"requestIsCsConnected\"])();\n\n case 2:\n isEnabled = _context2.sent;\n setIsConnected(isEnabled);\n return _context2.abrupt(\"return\", isEnabled);\n\n case 5:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n return function checkIsConnected() {\n return _ref2.apply(this, arguments);\n };\n }();\n\n Object(react__WEBPACK_IMPORTED_MODULE_3__[\"useEffect\"])(function () {\n checkIsConnected();\n }, []);\n return {\n isConnected: isConnected,\n checkIsConnected: checkIsConnected\n };\n};\n\n//# sourceURL=webpack:///./client/data/hooks/index.js?");
|
314 |
+
|
315 |
+
/***/ }),
|
316 |
+
|
317 |
+
/***/ "./client/data/hooks/util.js":
|
318 |
+
/*!***********************************!*\
|
319 |
+
!*** ./client/data/hooks/util.js ***!
|
320 |
+
\***********************************/
|
321 |
+
/*! exports provided: useFetch */
|
322 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
323 |
+
|
324 |
+
"use strict";
|
325 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"useFetch\", function() { return useFetch; });\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__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\nvar useFetch = function useFetch(fetchCallback, watchProps) {\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_1__[\"useState\"])(null),\n _useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_useState, 2),\n data = _useState2[0],\n setData = _useState2[1];\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_1__[\"useState\"])(null),\n _useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_useState3, 2),\n error = _useState4[0],\n setError = _useState4[1];\n\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_1__[\"useState\"])(true),\n _useState6 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_useState5, 2),\n loading = _useState6[0],\n setLoading = _useState6[1];\n\n Object(react__WEBPACK_IMPORTED_MODULE_1__[\"useEffect\"])(function () {\n setLoading(true);\n setError(null);\n setData(null);\n fetchCallback().then(setData).catch(setError).finally(function () {\n return setLoading(false);\n });\n }, watchProps);\n return {\n data: data,\n error: error,\n loading: loading\n };\n};\n\n//# sourceURL=webpack:///./client/data/hooks/util.js?");
|
326 |
+
|
327 |
+
/***/ }),
|
328 |
+
|
329 |
+
/***/ "./client/data/poll/index.js":
|
330 |
+
/*!***********************************!*\
|
331 |
+
!*** ./client/data/poll/index.js ***!
|
332 |
+
\***********************************/
|
333 |
+
/*! exports provided: requestResults, requestVoteNonce, requestVote, CrowdsignalFormsError, CrowdsignalFormsServerError, requestIsCsConnected */
|
334 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
335 |
+
|
336 |
+
"use strict";
|
337 |
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestResults\", function() { return requestResults; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestVoteNonce\", function() { return requestVoteNonce; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestVote\", function() { return requestVote; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrowdsignalFormsError\", function() { return CrowdsignalFormsError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CrowdsignalFormsServerError\", function() { return CrowdsignalFormsServerError; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"requestIsCsConnected\", function() { return requestIsCsConnected; });\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\");\n/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ \"./node_modules/@babel/runtime/helpers/inherits.js\");\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ \"./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js\");\n/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ \"./node_modules/@babel/runtime/helpers/getPrototypeOf.js\");\n/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ \"./node_modules/@babel/runtime/helpers/wrapNativeSuper.js\");\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/regenerator */ \"@babel/runtime/regenerator\");\n/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime/helpers/asyncToGenerator.js\");\n/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/api-fetch */ \"@wordpress/api-fetch\");\n/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var lib_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib/i18n */ \"./client/lib/i18n/index.js\");\n\n\n\n\n\n\n\n\nfunction _createSuper(Derived) { return function () { var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3___default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2___default()(this, result); }; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\n\n\n/**\n * Fetch the poll results for the given pollId\n *\n * @param {number} pollId Poll ID.\n * @return {Promise} Promise that resolves to a key-value object with answer IDs and vote counts.\n */\n\nvar requestResults = /*#__PURE__*/function () {\n var _ref = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee(pollId) {\n var baseUrl;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n baseUrl = 'https://api.crowdsignal.com/v3/polls';\n return _context.abrupt(\"return\", window.fetch(\"\".concat(baseUrl, \"/\").concat(pollId, \"/results\"), {\n method: 'GET',\n headers: {\n 'content-type': 'application/json'\n }\n }).then(function (response) {\n if (response.status >= 200 && response.status < 300) {\n return response.json();\n }\n\n throw response;\n }).then(function (response) {\n if (404 === response.status) {\n // poll doesn't exist on the platform yet, return an empty result\n return {};\n } else if (response.error) {\n throw new Error(response.message);\n }\n\n return response.results.votes_by_answer;\n }));\n\n case 2:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function requestResults(_x) {\n return _ref.apply(this, arguments);\n };\n}();\nvar requestVoteNonce = /*#__PURE__*/function () {\n var _ref2 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee2(pollId) {\n var hash, timestamp, respNonce, jsonNonce;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n hash = '5430eeac3911395001d731d9702fc38b'; // hash not used when format=json is passed\n\n timestamp = new Date().getTime();\n _context2.next = 4;\n return window.fetch(\"https://polldaddy.com/n/\".concat(hash, \"/\").concat(pollId, \"?\").concat(timestamp, \"&format=json\"));\n\n case 4:\n respNonce = _context2.sent;\n\n if (respNonce.ok) {\n _context2.next = 7;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 7:\n _context2.next = 9;\n return respNonce.json();\n\n case 9:\n jsonNonce = _context2.sent;\n\n if (jsonNonce.nonce) {\n _context2.next = 12;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 12:\n return _context2.abrupt(\"return\", jsonNonce.nonce);\n\n case 13:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n return function requestVoteNonce(_x2) {\n return _ref2.apply(this, arguments);\n };\n}();\nvar requestVote = /*#__PURE__*/function () {\n var _ref3 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee3(nonce, pollId, selectedAnswerIds) {\n var answerString, respVote, jsonVote;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n answerString = selectedAnswerIds.join(',');\n _context3.next = 3;\n return window.fetch(\"https://polls.polldaddy.com/vote-js.php?format=json&p=\".concat(pollId, \"&b=1&a=\").concat(answerString, \"&o=&va=16&cookie=0&n=\").concat(nonce, \"&url=\").concat(encodeURIComponent(window.location)));\n\n case 3:\n respVote = _context3.sent;\n\n if (respVote.ok) {\n _context3.next = 6;\n break;\n }\n\n throw new CrowdsignalFormsServerError();\n\n case 6:\n _context3.next = 8;\n return respVote.json();\n\n case 8:\n jsonVote = _context3.sent;\n\n if (!('error' === jsonVote.status)) {\n _context3.next = 11;\n break;\n }\n\n throw new CrowdsignalFormsError(jsonVote.error);\n\n case 11:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n\n return function requestVote(_x3, _x4, _x5) {\n return _ref3.apply(this, arguments);\n };\n}();\nvar CrowdsignalFormsError = /*#__PURE__*/function (_Error) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(CrowdsignalFormsError, _Error);\n\n var _super = _createSuper(CrowdsignalFormsError);\n\n function CrowdsignalFormsError() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CrowdsignalFormsError);\n\n return _super.apply(this, arguments);\n }\n\n return CrowdsignalFormsError;\n}( /*#__PURE__*/_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_4___default()(Error));\nvar CrowdsignalFormsServerError = /*#__PURE__*/function (_CrowdsignalFormsErro) {\n _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_1___default()(CrowdsignalFormsServerError, _CrowdsignalFormsErro);\n\n var _super2 = _createSuper(CrowdsignalFormsServerError);\n\n function CrowdsignalFormsServerError() {\n _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, CrowdsignalFormsServerError);\n\n return _super2.call(this, Object(lib_i18n__WEBPACK_IMPORTED_MODULE_8__[\"__\"])('Server error. Please try again.'));\n }\n\n return CrowdsignalFormsServerError;\n}(CrowdsignalFormsError);\nvar requestIsCsConnected = /*#__PURE__*/function () {\n var _ref4 = _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_6___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.mark(function _callee4() {\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default.a.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n _context4.next = 2;\n return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_7___default()({\n path: \"/crowdsignal-forms/v1/account/connected\",\n method: 'GET'\n });\n\n case 2:\n return _context4.abrupt(\"return\", _context4.sent);\n\n case 3:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n\n return function requestIsCsConnected() {\n return _ref4.apply(this, arguments);\n };\n}();\n\n//# sourceURL=webpack:///./client/data/poll/index.js?");
|
338 |
+
|
339 |
+
/***/ }),
|
340 |
+
|
341 |
+
/***/ "./client/lib/i18n/index.js":
|
342 |
+
/*!**********************************!*\
|
343 |
+
!*** ./client/lib/i18n/index.js ***!
|
344 |
+
\**********************************/
|
345 |
+
/*! exports provided: __, _n, sprintf */
|
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__, \"__\", function() { return __; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_n\", function() { return _n; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"sprintf\", function() { return sprintf; });\n/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ \"@wordpress/i18n\");\n/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);\n/**\n * WordPress dependencies\n */\n\nvar __ = function __(text) {\n return Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__[\"__\"])(text, 'crowdsignal-forms');\n};\nvar _n = function _n(singular, plural, count) {\n return Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__[\"_n\"])(singular, plural, count, 'crowdsignal-forms');\n};\nvar sprintf = _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__[\"sprintf\"];\n\n//# sourceURL=webpack:///./client/lib/i18n/index.js?");
|
350 |
+
|
351 |
+
/***/ }),
|
352 |
+
|
353 |
+
/***/ "./client/poll.js":
|
354 |
+
/*!************************!*\
|
355 |
+
!*** ./client/poll.js ***!
|
356 |
+
\************************/
|
357 |
+
/*! no exports provided */
|
358 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
359 |
+
|
360 |
+
"use strict";
|
361 |
+
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 react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ \"react-dom\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__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 components_poll__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! components/poll */ \"./client/components/poll/index.js\");\n\n\n/**\n * External dependencies\n */\n\n\n\n/**\n * Internal dependencies\n */\n\n\n\nvar initPolls = function initPolls() {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_3__[\"forEach\"])(document.querySelectorAll('div[data-crowdsignal-poll]'), function (element) {\n // Try-catch potentially prevents other polls from breaking\n // when there's more then one on the page\n try {\n var attributes = JSON.parse(element.dataset.crowdsignalPoll);\n element.removeAttribute('data-crowdsignal-poll');\n Object(react_dom__WEBPACK_IMPORTED_MODULE_2__[\"render\"])(Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(components_poll__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n attributes: attributes\n }), element);\n } catch (error) {\n // eslint-disable-next-line\n console.error('Crowdsignal Forms: Failed to parse poll data for: %s', element.dataset.crowdsignalPoll);\n }\n });\n};\n\nvar pollObserver = function pollObserver() {\n if (window.isPollObserverObserving) {\n return;\n }\n\n var observer = new window.MutationObserver(initPolls);\n observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['data-crowdsignal-poll'],\n childList: true,\n subtree: true\n });\n window.isPollObserverObserving = true; // Run the first pass on load\n\n initPolls();\n};\n\nif ('complete' === document.readyState) {\n pollObserver();\n} else {\n window.addEventListener('load', pollObserver);\n}\n\n//# sourceURL=webpack:///./client/poll.js?");
|
362 |
+
|
363 |
+
/***/ }),
|
364 |
+
|
365 |
+
/***/ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js":
|
366 |
+
/*!*****************************************************************!*\
|
367 |
+
!*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
|
368 |
+
\*****************************************************************/
|
369 |
+
/*! no static exports found */
|
370 |
+
/***/ (function(module, exports) {
|
371 |
+
|
372 |
+
eval("function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/arrayLikeToArray.js?");
|
373 |
+
|
374 |
+
/***/ }),
|
375 |
+
|
376 |
+
/***/ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js":
|
377 |
+
/*!***************************************************************!*\
|
378 |
+
!*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
|
379 |
+
\***************************************************************/
|
380 |
+
/*! no static exports found */
|
381 |
+
/***/ (function(module, exports) {
|
382 |
+
|
383 |
+
eval("function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/arrayWithHoles.js?");
|
384 |
+
|
385 |
+
/***/ }),
|
386 |
+
|
387 |
+
/***/ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js":
|
388 |
+
/*!******************************************************************!*\
|
389 |
+
!*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
|
390 |
+
\******************************************************************/
|
391 |
+
/*! no static exports found */
|
392 |
+
/***/ (function(module, exports, __webpack_require__) {
|
393 |
+
|
394 |
+
eval("var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ \"./node_modules/@babel/runtime/helpers/arrayLikeToArray.js\");\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js?");
|
395 |
+
|
396 |
+
/***/ }),
|
397 |
+
|
398 |
+
/***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js":
|
399 |
+
/*!**********************************************************************!*\
|
400 |
+
!*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
|
401 |
+
\**********************************************************************/
|
402 |
+
/*! no static exports found */
|
403 |
+
/***/ (function(module, exports) {
|
404 |
+
|
405 |
+
eval("function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/assertThisInitialized.js?");
|
406 |
+
|
407 |
+
/***/ }),
|
408 |
+
|
409 |
+
/***/ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js":
|
410 |
+
/*!*****************************************************************!*\
|
411 |
+
!*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
|
412 |
+
\*****************************************************************/
|
413 |
+
/*! no static exports found */
|
414 |
+
/***/ (function(module, exports) {
|
415 |
+
|
416 |
+
eval("function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js?");
|
417 |
+
|
418 |
+
/***/ }),
|
419 |
+
|
420 |
+
/***/ "./node_modules/@babel/runtime/helpers/classCallCheck.js":
|
421 |
+
/*!***************************************************************!*\
|
422 |
+
!*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
|
423 |
+
\***************************************************************/
|
424 |
+
/*! no static exports found */
|
425 |
+
/***/ (function(module, exports) {
|
426 |
+
|
427 |
+
eval("function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/classCallCheck.js?");
|
428 |
+
|
429 |
+
/***/ }),
|
430 |
+
|
431 |
+
/***/ "./node_modules/@babel/runtime/helpers/construct.js":
|
432 |
+
/*!**********************************************************!*\
|
433 |
+
!*** ./node_modules/@babel/runtime/helpers/construct.js ***!
|
434 |
+
\**********************************************************/
|
435 |
+
/*! no static exports found */
|
436 |
+
/***/ (function(module, exports, __webpack_require__) {
|
437 |
+
|
438 |
+
eval("var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf */ \"./node_modules/@babel/runtime/helpers/setPrototypeOf.js\");\n\nvar isNativeReflectConstruct = __webpack_require__(/*! ./isNativeReflectConstruct */ \"./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js\");\n\nfunction _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n module.exports = _construct = Reflect.construct;\n } else {\n module.exports = _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}\n\nmodule.exports = _construct;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/construct.js?");
|
439 |
+
|
440 |
+
/***/ }),
|
441 |
+
|
442 |
+
/***/ "./node_modules/@babel/runtime/helpers/defineProperty.js":
|
443 |
+
/*!***************************************************************!*\
|
444 |
+
!*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
|
445 |
+
\***************************************************************/
|
446 |
+
/*! no static exports found */
|
447 |
+
/***/ (function(module, exports) {
|
448 |
+
|
449 |
+
eval("function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/defineProperty.js?");
|
450 |
+
|
451 |
+
/***/ }),
|
452 |
+
|
453 |
+
/***/ "./node_modules/@babel/runtime/helpers/extends.js":
|
454 |
+
/*!********************************************************!*\
|
455 |
+
!*** ./node_modules/@babel/runtime/helpers/extends.js ***!
|
456 |
+
\********************************************************/
|
457 |
+
/*! no static exports found */
|
458 |
+
/***/ (function(module, exports) {
|
459 |
+
|
460 |
+
eval("function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/extends.js?");
|
461 |
+
|
462 |
+
/***/ }),
|
463 |
+
|
464 |
+
/***/ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js":
|
465 |
+
/*!***************************************************************!*\
|
466 |
+
!*** ./node_modules/@babel/runtime/helpers/getPrototypeOf.js ***!
|
467 |
+
\***************************************************************/
|
468 |
+
/*! no static exports found */
|
469 |
+
/***/ (function(module, exports) {
|
470 |
+
|
471 |
+
eval("function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/getPrototypeOf.js?");
|
472 |
+
|
473 |
+
/***/ }),
|
474 |
+
|
475 |
+
/***/ "./node_modules/@babel/runtime/helpers/inherits.js":
|
476 |
+
/*!*********************************************************!*\
|
477 |
+
!*** ./node_modules/@babel/runtime/helpers/inherits.js ***!
|
478 |
+
\*********************************************************/
|
479 |
+
/*! no static exports found */
|
480 |
+
/***/ (function(module, exports, __webpack_require__) {
|
481 |
+
|
482 |
+
eval("var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf */ \"./node_modules/@babel/runtime/helpers/setPrototypeOf.js\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/inherits.js?");
|
483 |
+
|
484 |
+
/***/ }),
|
485 |
+
|
486 |
+
/***/ "./node_modules/@babel/runtime/helpers/isNativeFunction.js":
|
487 |
+
/*!*****************************************************************!*\
|
488 |
+
!*** ./node_modules/@babel/runtime/helpers/isNativeFunction.js ***!
|
489 |
+
\*****************************************************************/
|
490 |
+
/*! no static exports found */
|
491 |
+
/***/ (function(module, exports) {
|
492 |
+
|
493 |
+
eval("function _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n}\n\nmodule.exports = _isNativeFunction;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/isNativeFunction.js?");
|
494 |
+
|
495 |
+
/***/ }),
|
496 |
+
|
497 |
+
/***/ "./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js":
|
498 |
+
/*!*************************************************************************!*\
|
499 |
+
!*** ./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js ***!
|
500 |
+
\*************************************************************************/
|
501 |
+
/*! no static exports found */
|
502 |
+
/***/ (function(module, exports) {
|
503 |
+
|
504 |
+
eval("function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nmodule.exports = _isNativeReflectConstruct;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js?");
|
505 |
+
|
506 |
+
/***/ }),
|
507 |
+
|
508 |
+
/***/ "./node_modules/@babel/runtime/helpers/iterableToArray.js":
|
509 |
+
/*!****************************************************************!*\
|
510 |
+
!*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
|
511 |
+
\****************************************************************/
|
512 |
+
/*! no static exports found */
|
513 |
+
/***/ (function(module, exports) {
|
514 |
+
|
515 |
+
eval("function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/iterableToArray.js?");
|
516 |
+
|
517 |
+
/***/ }),
|
518 |
+
|
519 |
+
/***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
|
520 |
+
/*!*********************************************************************!*\
|
521 |
+
!*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
|
522 |
+
\*********************************************************************/
|
523 |
+
/*! no static exports found */
|
524 |
+
/***/ (function(module, exports) {
|
525 |
+
|
526 |
+
eval("function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js?");
|
527 |
+
|
528 |
+
/***/ }),
|
529 |
+
|
530 |
+
/***/ "./node_modules/@babel/runtime/helpers/nonIterableRest.js":
|
531 |
+
/*!****************************************************************!*\
|
532 |
+
!*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
|
533 |
+
\****************************************************************/
|
534 |
+
/*! no static exports found */
|
535 |
+
/***/ (function(module, exports) {
|
536 |
+
|
537 |
+
eval("function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/nonIterableRest.js?");
|
538 |
+
|
539 |
+
/***/ }),
|
540 |
+
|
541 |
+
/***/ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js":
|
542 |
+
/*!******************************************************************!*\
|
543 |
+
!*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
|
544 |
+
\******************************************************************/
|
545 |
+
/*! no static exports found */
|
546 |
+
/***/ (function(module, exports) {
|
547 |
+
|
548 |
+
eval("function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableSpread;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/nonIterableSpread.js?");
|
549 |
+
|
550 |
+
/***/ }),
|
551 |
+
|
552 |
+
/***/ "./node_modules/@babel/runtime/helpers/objectWithoutProperties.js":
|
553 |
+
/*!************************************************************************!*\
|
554 |
+
!*** ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js ***!
|
555 |
+
\************************************************************************/
|
556 |
+
/*! no static exports found */
|
557 |
+
/***/ (function(module, exports, __webpack_require__) {
|
558 |
+
|
559 |
+
eval("var objectWithoutPropertiesLoose = __webpack_require__(/*! ./objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\");\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutProperties;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/objectWithoutProperties.js?");
|
560 |
+
|
561 |
+
/***/ }),
|
562 |
+
|
563 |
+
/***/ "./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js":
|
564 |
+
/*!*****************************************************************************!*\
|
565 |
+
!*** ./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js ***!
|
566 |
+
\*****************************************************************************/
|
567 |
+
/*! no static exports found */
|
568 |
+
/***/ (function(module, exports) {
|
569 |
+
|
570 |
+
eval("function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js?");
|
571 |
+
|
572 |
+
/***/ }),
|
573 |
+
|
574 |
+
/***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
|
575 |
+
/*!**************************************************************************!*\
|
576 |
+
!*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
|
577 |
+
\**************************************************************************/
|
578 |
+
/*! no static exports found */
|
579 |
+
/***/ (function(module, exports, __webpack_require__) {
|
580 |
+
|
581 |
+
eval("var _typeof = __webpack_require__(/*! ../helpers/typeof */ \"./node_modules/@babel/runtime/helpers/typeof.js\");\n\nvar assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized */ \"./node_modules/@babel/runtime/helpers/assertThisInitialized.js\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js?");
|
582 |
+
|
583 |
+
/***/ }),
|
584 |
+
|
585 |
+
/***/ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js":
|
586 |
+
/*!***************************************************************!*\
|
587 |
+
!*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
|
588 |
+
\***************************************************************/
|
589 |
+
/*! no static exports found */
|
590 |
+
/***/ (function(module, exports) {
|
591 |
+
|
592 |
+
eval("function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/setPrototypeOf.js?");
|
593 |
+
|
594 |
+
/***/ }),
|
595 |
+
|
596 |
+
/***/ "./node_modules/@babel/runtime/helpers/slicedToArray.js":
|
597 |
+
/*!**************************************************************!*\
|
598 |
+
!*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
|
599 |
+
\**************************************************************/
|
600 |
+
/*! no static exports found */
|
601 |
+
/***/ (function(module, exports, __webpack_require__) {
|
602 |
+
|
603 |
+
eval("var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles */ \"./node_modules/@babel/runtime/helpers/arrayWithHoles.js\");\n\nvar iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit */ \"./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js\");\n\nvar unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ \"./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js\");\n\nvar nonIterableRest = __webpack_require__(/*! ./nonIterableRest */ \"./node_modules/@babel/runtime/helpers/nonIterableRest.js\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/slicedToArray.js?");
|
604 |
+
|
605 |
+
/***/ }),
|
606 |
+
|
607 |
+
/***/ "./node_modules/@babel/runtime/helpers/toConsumableArray.js":
|
608 |
+
/*!******************************************************************!*\
|
609 |
+
!*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
|
610 |
+
\******************************************************************/
|
611 |
+
/*! no static exports found */
|
612 |
+
/***/ (function(module, exports, __webpack_require__) {
|
613 |
+
|
614 |
+
eval("var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles */ \"./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js\");\n\nvar iterableToArray = __webpack_require__(/*! ./iterableToArray */ \"./node_modules/@babel/runtime/helpers/iterableToArray.js\");\n\nvar unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ \"./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js\");\n\nvar nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread */ \"./node_modules/@babel/runtime/helpers/nonIterableSpread.js\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/toConsumableArray.js?");
|
615 |
+
|
616 |
+
/***/ }),
|
617 |
+
|
618 |
+
/***/ "./node_modules/@babel/runtime/helpers/typeof.js":
|
619 |
+
/*!*******************************************************!*\
|
620 |
+
!*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
|
621 |
+
\*******************************************************/
|
622 |
+
/*! no static exports found */
|
623 |
+
/***/ (function(module, exports) {
|
624 |
+
|
625 |
+
eval("function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/typeof.js?");
|
626 |
+
|
627 |
+
/***/ }),
|
628 |
+
|
629 |
+
/***/ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js":
|
630 |
+
/*!***************************************************************************!*\
|
631 |
+
!*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
|
632 |
+
\***************************************************************************/
|
633 |
+
/*! no static exports found */
|
634 |
+
/***/ (function(module, exports, __webpack_require__) {
|
635 |
+
|
636 |
+
eval("var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ \"./node_modules/@babel/runtime/helpers/arrayLikeToArray.js\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js?");
|
637 |
+
|
638 |
+
/***/ }),
|
639 |
+
|
640 |
+
/***/ "./node_modules/@babel/runtime/helpers/wrapNativeSuper.js":
|
641 |
+
/*!****************************************************************!*\
|
642 |
+
!*** ./node_modules/@babel/runtime/helpers/wrapNativeSuper.js ***!
|
643 |
+
\****************************************************************/
|
644 |
+
/*! no static exports found */
|
645 |
+
/***/ (function(module, exports, __webpack_require__) {
|
646 |
+
|
647 |
+
eval("var getPrototypeOf = __webpack_require__(/*! ./getPrototypeOf */ \"./node_modules/@babel/runtime/helpers/getPrototypeOf.js\");\n\nvar setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf */ \"./node_modules/@babel/runtime/helpers/setPrototypeOf.js\");\n\nvar isNativeFunction = __webpack_require__(/*! ./isNativeFunction */ \"./node_modules/@babel/runtime/helpers/isNativeFunction.js\");\n\nvar construct = __webpack_require__(/*! ./construct */ \"./node_modules/@babel/runtime/helpers/construct.js\");\n\nfunction _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n\n module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n\n _cache.set(Class, Wrapper);\n }\n\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n\n return _wrapNativeSuper(Class);\n}\n\nmodule.exports = _wrapNativeSuper;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/wrapNativeSuper.js?");
|
648 |
+
|
649 |
+
/***/ }),
|
650 |
+
|
651 |
+
/***/ "./node_modules/classnames/index.js":
|
652 |
+
/*!******************************************!*\
|
653 |
+
!*** ./node_modules/classnames/index.js ***!
|
654 |
+
\******************************************/
|
655 |
+
/*! no static exports found */
|
656 |
+
/***/ (function(module, exports, __webpack_require__) {
|
657 |
+
|
658 |
+
eval("var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif ( true && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (true) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n\t\t\treturn classNames;\n\t\t}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else {}\n}());\n\n\n//# sourceURL=webpack:///./node_modules/classnames/index.js?");
|
659 |
+
|
660 |
+
/***/ }),
|
661 |
+
|
662 |
+
/***/ "./node_modules/js-cookie/src/js.cookie.js":
|
663 |
+
/*!*************************************************!*\
|
664 |
+
!*** ./node_modules/js-cookie/src/js.cookie.js ***!
|
665 |
+
\*************************************************/
|
666 |
+
/*! no static exports found */
|
667 |
+
/***/ (function(module, exports, __webpack_require__) {
|
668 |
+
|
669 |
+
eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n * JavaScript Cookie v2.2.1\n * https://github.com/js-cookie/js-cookie\n *\n * Copyright 2006, 2015 Klaus Hartl & Fagner Brack\n * Released under the MIT license\n */\n;(function (factory) {\n\tvar registeredInModuleLoader;\n\tif (true) {\n\t\t!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :\n\t\t\t\t__WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\tregisteredInModuleLoader = true;\n\t}\n\tif (true) {\n\t\tmodule.exports = factory();\n\t\tregisteredInModuleLoader = true;\n\t}\n\tif (!registeredInModuleLoader) {\n\t\tvar OldCookies = window.Cookies;\n\t\tvar api = window.Cookies = factory();\n\t\tapi.noConflict = function () {\n\t\t\twindow.Cookies = OldCookies;\n\t\t\treturn api;\n\t\t};\n\t}\n}(function () {\n\tfunction extend () {\n\t\tvar i = 0;\n\t\tvar result = {};\n\t\tfor (; i < arguments.length; i++) {\n\t\t\tvar attributes = arguments[ i ];\n\t\t\tfor (var key in attributes) {\n\t\t\t\tresult[key] = attributes[key];\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tfunction decode (s) {\n\t\treturn s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);\n\t}\n\n\tfunction init (converter) {\n\t\tfunction api() {}\n\n\t\tfunction set (key, value, attributes) {\n\t\t\tif (typeof document === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tattributes = extend({\n\t\t\t\tpath: '/'\n\t\t\t}, api.defaults, attributes);\n\n\t\t\tif (typeof attributes.expires === 'number') {\n\t\t\t\tattributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);\n\t\t\t}\n\n\t\t\t// We're using \"expires\" because \"max-age\" is not supported by IE\n\t\t\tattributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';\n\n\t\t\ttry {\n\t\t\t\tvar result = JSON.stringify(value);\n\t\t\t\tif (/^[\\{\\[]/.test(result)) {\n\t\t\t\t\tvalue = result;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\n\t\t\tvalue = converter.write ?\n\t\t\t\tconverter.write(value, key) :\n\t\t\t\tencodeURIComponent(String(value))\n\t\t\t\t\t.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);\n\n\t\t\tkey = encodeURIComponent(String(key))\n\t\t\t\t.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)\n\t\t\t\t.replace(/[\\(\\)]/g, escape);\n\n\t\t\tvar stringifiedAttributes = '';\n\t\t\tfor (var attributeName in attributes) {\n\t\t\t\tif (!attributes[attributeName]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tstringifiedAttributes += '; ' + attributeName;\n\t\t\t\tif (attributes[attributeName] === true) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Considers RFC 6265 section 5.2:\n\t\t\t\t// ...\n\t\t\t\t// 3. If the remaining unparsed-attributes contains a %x3B (\";\")\n\t\t\t\t// character:\n\t\t\t\t// Consume the characters of the unparsed-attributes up to,\n\t\t\t\t// not including, the first %x3B (\";\") character.\n\t\t\t\t// ...\n\t\t\t\tstringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n\t\t\t}\n\n\t\t\treturn (document.cookie = key + '=' + value + stringifiedAttributes);\n\t\t}\n\n\t\tfunction get (key, json) {\n\t\t\tif (typeof document === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar jar = {};\n\t\t\t// To prevent the for loop in the first place assign an empty array\n\t\t\t// in case there are no cookies at all.\n\t\t\tvar cookies = document.cookie ? document.cookie.split('; ') : [];\n\t\t\tvar i = 0;\n\n\t\t\tfor (; i < cookies.length; i++) {\n\t\t\t\tvar parts = cookies[i].split('=');\n\t\t\t\tvar cookie = parts.slice(1).join('=');\n\n\t\t\t\tif (!json && cookie.charAt(0) === '\"') {\n\t\t\t\t\tcookie = cookie.slice(1, -1);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tvar name = decode(parts[0]);\n\t\t\t\t\tcookie = (converter.read || converter)(cookie, name) ||\n\t\t\t\t\t\tdecode(cookie);\n\n\t\t\t\t\tif (json) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tcookie = JSON.parse(cookie);\n\t\t\t\t\t\t} catch (e) {}\n\t\t\t\t\t}\n\n\t\t\t\t\tjar[name] = cookie;\n\n\t\t\t\t\tif (key === name) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {}\n\t\t\t}\n\n\t\t\treturn key ? jar[key] : jar;\n\t\t}\n\n\t\tapi.set = set;\n\t\tapi.get = function (key) {\n\t\t\treturn get(key, false /* read as raw */);\n\t\t};\n\t\tapi.getJSON = function (key) {\n\t\t\treturn get(key, true /* read as json */);\n\t\t};\n\t\tapi.remove = function (key, attributes) {\n\t\t\tset(key, '', extend(attributes, {\n\t\t\t\texpires: -1\n\t\t\t}));\n\t\t};\n\n\t\tapi.defaults = {};\n\n\t\tapi.withConverter = init;\n\n\t\treturn api;\n\t}\n\n\treturn init(function () {});\n}));\n\n\n//# sourceURL=webpack:///./node_modules/js-cookie/src/js.cookie.js?");
|
670 |
+
|
671 |
+
/***/ }),
|
672 |
+
|
673 |
+
/***/ "./node_modules/object-assign/index.js":
|
674 |
+
/*!*********************************************!*\
|
675 |
+
!*** ./node_modules/object-assign/index.js ***!
|
676 |
+
\*********************************************/
|
677 |
+
/*! no static exports found */
|
678 |
+
/***/ (function(module, exports, __webpack_require__) {
|
679 |
+
|
680 |
+
"use strict";
|
681 |
+
eval("/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n\n\n//# sourceURL=webpack:///./node_modules/object-assign/index.js?");
|
682 |
+
|
683 |
+
/***/ }),
|
684 |
+
|
685 |
+
/***/ "./node_modules/prop-types/checkPropTypes.js":
|
686 |
+
/*!***************************************************!*\
|
687 |
+
!*** ./node_modules/prop-types/checkPropTypes.js ***!
|
688 |
+
\***************************************************/
|
689 |
+
/*! no static exports found */
|
690 |
+
/***/ (function(module, exports, __webpack_require__) {
|
691 |
+
|
692 |
+
"use strict";
|
693 |
+
eval("/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nvar printWarning = function() {};\n\nif (undefined !== 'production') {\n var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ \"./node_modules/prop-types/lib/ReactPropTypesSecret.js\");\n var loggedTypeFailures = {};\n var has = Function.call.bind(Object.prototype.hasOwnProperty);\n\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n}\n\n/**\n * Assert that the values match with the type specs.\n * Error messages are memorized and will only be shown once.\n *\n * @param {object} typeSpecs Map of name to a ReactPropType\n * @param {object} values Runtime values that need to be type-checked\n * @param {string} location e.g. \"prop\", \"context\", \"child context\"\n * @param {string} componentName Name of the component for error messages.\n * @param {?Function} getStack Returns the component stack.\n * @private\n */\nfunction checkPropTypes(typeSpecs, values, location, componentName, getStack) {\n if (undefined !== 'production') {\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error;\n // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n var err = Error(\n (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +\n 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'\n );\n err.name = 'Invariant Violation';\n throw err;\n }\n error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);\n } catch (ex) {\n error = ex;\n }\n if (error && !(error instanceof Error)) {\n printWarning(\n (componentName || 'React class') + ': type specification of ' +\n location + ' `' + typeSpecName + '` is invalid; the type checker ' +\n 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +\n 'You may have forgotten to pass an argument to the type checker ' +\n 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +\n 'shape all require an argument).'\n );\n }\n if (error instanceof Error && !(error.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error.message] = true;\n\n var stack = getStack ? getStack() : '';\n\n printWarning(\n 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')\n );\n }\n }\n }\n }\n}\n\n/**\n * Resets warning cache when testing.\n *\n * @private\n */\ncheckPropTypes.resetWarningCache = function() {\n if (undefined !== 'production') {\n loggedTypeFailures = {};\n }\n}\n\nmodule.exports = checkPropTypes;\n\n\n//# sourceURL=webpack:///./node_modules/prop-types/checkPropTypes.js?");
|
694 |
+
|
695 |
+
/***/ }),
|
696 |
+
|
697 |
+
/***/ "./node_modules/prop-types/factoryWithThrowingShims.js":
|
698 |
+
/*!*************************************************************!*\
|
699 |
+
!*** ./node_modules/prop-types/factoryWithThrowingShims.js ***!
|
700 |
+
\*************************************************************/
|
701 |
+
/*! no static exports found */
|
702 |
+
/***/ (function(module, exports, __webpack_require__) {
|
703 |
+
|
704 |
+
"use strict";
|
705 |
+
eval("/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nvar ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ \"./node_modules/prop-types/lib/ReactPropTypesSecret.js\");\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n\n\n//# sourceURL=webpack:///./node_modules/prop-types/factoryWithThrowingShims.js?");
|
706 |
+
|
707 |
+
/***/ }),
|
708 |
+
|
709 |
+
/***/ "./node_modules/prop-types/factoryWithTypeCheckers.js":
|
710 |
+
/*!************************************************************!*\
|
711 |
+
!*** ./node_modules/prop-types/factoryWithTypeCheckers.js ***!
|
712 |
+
\************************************************************/
|
713 |
+
/*! no static exports found */
|
714 |
+
/***/ (function(module, exports, __webpack_require__) {
|
715 |
+
|
716 |
+
"use strict";
|
717 |
+
eval("/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nvar ReactIs = __webpack_require__(/*! react-is */ \"./node_modules/react-is/index.js\");\nvar assign = __webpack_require__(/*! object-assign */ \"./node_modules/object-assign/index.js\");\n\nvar ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ \"./node_modules/prop-types/lib/ReactPropTypesSecret.js\");\nvar checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ \"./node_modules/prop-types/checkPropTypes.js\");\n\nvar has = Function.call.bind(Object.prototype.hasOwnProperty);\nvar printWarning = function() {};\n\nif (undefined !== 'production') {\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n}\n\nfunction emptyFunctionThatReturnsNull() {\n return null;\n}\n\nmodule.exports = function(isValidElement, throwOnDirectAccess) {\n /* global Symbol */\n var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.\n\n /**\n * Returns the iterator method function contained on the iterable object.\n *\n * Be sure to invoke the function with the iterable as context:\n *\n * var iteratorFn = getIteratorFn(myIterable);\n * if (iteratorFn) {\n * var iterator = iteratorFn.call(myIterable);\n * ...\n * }\n *\n * @param {?object} maybeIterable\n * @return {?function}\n */\n function getIteratorFn(maybeIterable) {\n var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n /**\n * Collection of methods that allow declaration and validation of props that are\n * supplied to React components. Example usage:\n *\n * var Props = require('ReactPropTypes');\n * var MyArticle = React.createClass({\n * propTypes: {\n * // An optional string prop named \"description\".\n * description: Props.string,\n *\n * // A required enum prop named \"category\".\n * category: Props.oneOf(['News','Photos']).isRequired,\n *\n * // A prop named \"dialog\" that requires an instance of Dialog.\n * dialog: Props.instanceOf(Dialog).isRequired\n * },\n * render: function() { ... }\n * });\n *\n * A more formal specification of how these methods are used:\n *\n * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)\n * decl := ReactPropTypes.{type}(.isRequired)?\n *\n * Each and every declaration produces a function with the same signature. This\n * allows the creation of custom validation functions. For example:\n *\n * var MyLink = React.createClass({\n * propTypes: {\n * // An optional string or URI prop named \"href\".\n * href: function(props, propName, componentName) {\n * var propValue = props[propName];\n * if (propValue != null && typeof propValue !== 'string' &&\n * !(propValue instanceof URI)) {\n * return new Error(\n * 'Expected a string or an URI for ' + propName + ' in ' +\n * componentName\n * );\n * }\n * }\n * },\n * render: function() {...}\n * });\n *\n * @internal\n */\n\n var ANONYMOUS = '<<anonymous>>';\n\n // Important!\n // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.\n var ReactPropTypes = {\n array: createPrimitiveTypeChecker('array'),\n bool: createPrimitiveTypeChecker('boolean'),\n func: createPrimitiveTypeChecker('function'),\n number: createPrimitiveTypeChecker('number'),\n object: createPrimitiveTypeChecker('object'),\n string: createPrimitiveTypeChecker('string'),\n symbol: createPrimitiveTypeChecker('symbol'),\n\n any: createAnyTypeChecker(),\n arrayOf: createArrayOfTypeChecker,\n element: createElementTypeChecker(),\n elementType: createElementTypeTypeChecker(),\n instanceOf: createInstanceTypeChecker,\n node: createNodeChecker(),\n objectOf: createObjectOfTypeChecker,\n oneOf: createEnumTypeChecker,\n oneOfType: createUnionTypeChecker,\n shape: createShapeTypeChecker,\n exact: createStrictShapeTypeChecker,\n };\n\n /**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\n /*eslint-disable no-self-compare*/\n function is(x, y) {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n return x !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n }\n /*eslint-enable no-self-compare*/\n\n /**\n * We use an Error-like object for backward compatibility as people may call\n * PropTypes directly and inspect their output. However, we don't use real\n * Errors anymore. We don't inspect their stack anyway, and creating them\n * is prohibitively expensive if they are created too often, such as what\n * happens in oneOfType() for any type before the one that matched.\n */\n function PropTypeError(message) {\n this.message = message;\n this.stack = '';\n }\n // Make `instanceof Error` still work for returned errors.\n PropTypeError.prototype = Error.prototype;\n\n function createChainableTypeChecker(validate) {\n if (undefined !== 'production') {\n var manualPropTypeCallCache = {};\n var manualPropTypeWarningCount = 0;\n }\n function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {\n componentName = componentName || ANONYMOUS;\n propFullName = propFullName || propName;\n\n if (secret !== ReactPropTypesSecret) {\n if (throwOnDirectAccess) {\n // New behavior only for users of `prop-types` package\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use `PropTypes.checkPropTypes()` to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n } else if (undefined !== 'production' && typeof console !== 'undefined') {\n // Old behavior for people using React.PropTypes\n var cacheKey = componentName + ':' + propName;\n if (\n !manualPropTypeCallCache[cacheKey] &&\n // Avoid spamming the console because they are often not actionable except for lib authors\n manualPropTypeWarningCount < 3\n ) {\n printWarning(\n 'You are manually calling a React.PropTypes validation ' +\n 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +\n 'and will throw in the standalone `prop-types` package. ' +\n 'You may be seeing this warning due to a third-party PropTypes ' +\n 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'\n );\n manualPropTypeCallCache[cacheKey] = true;\n manualPropTypeWarningCount++;\n }\n }\n }\n if (props[propName] == null) {\n if (isRequired) {\n if (props[propName] === null) {\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));\n }\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));\n }\n return null;\n } else {\n return validate(props, propName, componentName, location, propFullName);\n }\n }\n\n var chainedCheckType = checkType.bind(null, false);\n chainedCheckType.isRequired = checkType.bind(null, true);\n\n return chainedCheckType;\n }\n\n function createPrimitiveTypeChecker(expectedType) {\n function validate(props, propName, componentName, location, propFullName, secret) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== expectedType) {\n // `propValue` being instance of, say, date/regexp, pass the 'object'\n // check, but we can offer a more precise error message here rather than\n // 'of type `object`'.\n var preciseType = getPreciseType(propValue);\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createAnyTypeChecker() {\n return createChainableTypeChecker(emptyFunctionThatReturnsNull);\n }\n\n function createArrayOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');\n }\n var propValue = props[propName];\n if (!Array.isArray(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));\n }\n for (var i = 0; i < propValue.length; i++) {\n var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!isValidElement(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!ReactIs.isValidElementType(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createInstanceTypeChecker(expectedClass) {\n function validate(props, propName, componentName, location, propFullName) {\n if (!(props[propName] instanceof expectedClass)) {\n var expectedClassName = expectedClass.name || ANONYMOUS;\n var actualClassName = getClassName(props[propName]);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createEnumTypeChecker(expectedValues) {\n if (!Array.isArray(expectedValues)) {\n if (undefined !== 'production') {\n if (arguments.length > 1) {\n printWarning(\n 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +\n 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'\n );\n } else {\n printWarning('Invalid argument supplied to oneOf, expected an array.');\n }\n }\n return emptyFunctionThatReturnsNull;\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n for (var i = 0; i < expectedValues.length; i++) {\n if (is(propValue, expectedValues[i])) {\n return null;\n }\n }\n\n var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {\n var type = getPreciseType(value);\n if (type === 'symbol') {\n return String(value);\n }\n return value;\n });\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createObjectOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');\n }\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));\n }\n for (var key in propValue) {\n if (has(propValue, key)) {\n var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createUnionTypeChecker(arrayOfTypeCheckers) {\n if (!Array.isArray(arrayOfTypeCheckers)) {\n undefined !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;\n return emptyFunctionThatReturnsNull;\n }\n\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (typeof checker !== 'function') {\n printWarning(\n 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +\n 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'\n );\n return emptyFunctionThatReturnsNull;\n }\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {\n return null;\n }\n }\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createNodeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n if (!isNode(props[propName])) {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n for (var key in shapeTypes) {\n var checker = shapeTypes[key];\n if (!checker) {\n continue;\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createStrictShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n // We need to check all keys in case some are required but missing from\n // props.\n var allKeys = assign({}, props[propName], shapeTypes);\n for (var key in allKeys) {\n var checker = shapeTypes[key];\n if (!checker) {\n return new PropTypeError(\n 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +\n '\\nBad object: ' + JSON.stringify(props[propName], null, ' ') +\n '\\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')\n );\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n\n return createChainableTypeChecker(validate);\n }\n\n function isNode(propValue) {\n switch (typeof propValue) {\n case 'number':\n case 'string':\n case 'undefined':\n return true;\n case 'boolean':\n return !propValue;\n case 'object':\n if (Array.isArray(propValue)) {\n return propValue.every(isNode);\n }\n if (propValue === null || isValidElement(propValue)) {\n return true;\n }\n\n var iteratorFn = getIteratorFn(propValue);\n if (iteratorFn) {\n var iterator = iteratorFn.call(propValue);\n var step;\n if (iteratorFn !== propValue.entries) {\n while (!(step = iterator.next()).done) {\n if (!isNode(step.value)) {\n return false;\n }\n }\n } else {\n // Iterator will provide entry [k,v] tuples rather than values.\n while (!(step = iterator.next()).done) {\n var entry = step.value;\n if (entry) {\n if (!isNode(entry[1])) {\n return false;\n }\n }\n }\n }\n } else {\n return false;\n }\n\n return true;\n default:\n return false;\n }\n }\n\n function isSymbol(propType, propValue) {\n // Native Symbol.\n if (propType === 'symbol') {\n return true;\n }\n\n // falsy value can't be a Symbol\n if (!propValue) {\n return false;\n }\n\n // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'\n if (propValue['@@toStringTag'] === 'Symbol') {\n return true;\n }\n\n // Fallback for non-spec compliant Symbols which are polyfilled.\n if (typeof Symbol === 'function' && propValue instanceof Symbol) {\n return true;\n }\n\n return false;\n }\n\n // Equivalent of `typeof` but with special handling for array and regexp.\n function getPropType(propValue) {\n var propType = typeof propValue;\n if (Array.isArray(propValue)) {\n return 'array';\n }\n if (propValue instanceof RegExp) {\n // Old webkits (at least until Android 4.0) return 'function' rather than\n // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n // passes PropTypes.object.\n return 'object';\n }\n if (isSymbol(propType, propValue)) {\n return 'symbol';\n }\n return propType;\n }\n\n // This handles more types than `getPropType`. Only used for error messages.\n // See `createPrimitiveTypeChecker`.\n function getPreciseType(propValue) {\n if (typeof propValue === 'undefined' || propValue === null) {\n return '' + propValue;\n }\n var propType = getPropType(propValue);\n if (propType === 'object') {\n if (propValue instanceof Date) {\n return 'date';\n } else if (propValue instanceof RegExp) {\n return 'regexp';\n }\n }\n return propType;\n }\n\n // Returns a string that is postfixed to a warning about an invalid type.\n // For example, \"undefined\" or \"of type array\"\n function getPostfixForTypeWarning(value) {\n var type = getPreciseType(value);\n switch (type) {\n case 'array':\n case 'object':\n return 'an ' + type;\n case 'boolean':\n case 'date':\n case 'regexp':\n return 'a ' + type;\n default:\n return type;\n }\n }\n\n // Returns class name of the object, if any.\n function getClassName(propValue) {\n if (!propValue.constructor || !propValue.constructor.name) {\n return ANONYMOUS;\n }\n return propValue.constructor.name;\n }\n\n ReactPropTypes.checkPropTypes = checkPropTypes;\n ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n\n\n//# sourceURL=webpack:///./node_modules/prop-types/factoryWithTypeCheckers.js?");
|
718 |
+
|
719 |
+
/***/ }),
|
720 |
+
|
721 |
+
/***/ "./node_modules/prop-types/index.js":
|
722 |
+
/*!******************************************!*\
|
723 |
+
!*** ./node_modules/prop-types/index.js ***!
|
724 |
+
\******************************************/
|
725 |
+
/*! no static exports found */
|
726 |
+
/***/ (function(module, exports, __webpack_require__) {
|
727 |
+
|
728 |
+
eval("/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (undefined !== 'production') {\n var ReactIs = __webpack_require__(/*! react-is */ \"./node_modules/react-is/index.js\");\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = __webpack_require__(/*! ./factoryWithTypeCheckers */ \"./node_modules/prop-types/factoryWithTypeCheckers.js\")(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = __webpack_require__(/*! ./factoryWithThrowingShims */ \"./node_modules/prop-types/factoryWithThrowingShims.js\")();\n}\n\n\n//# sourceURL=webpack:///./node_modules/prop-types/index.js?");
|
729 |
+
|
730 |
+
/***/ }),
|
731 |
+
|
732 |
+
/***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js":
|
733 |
+
/*!*************************************************************!*\
|
734 |
+
!*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***!
|
735 |
+
\*************************************************************/
|
736 |
+
/*! no static exports found */
|
737 |
+
/***/ (function(module, exports, __webpack_require__) {
|
738 |
+
|
739 |
+
"use strict";
|
740 |
+
eval("/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n\n\n//# sourceURL=webpack:///./node_modules/prop-types/lib/ReactPropTypesSecret.js?");
|
741 |
+
|
742 |
+
/***/ }),
|
743 |
+
|
744 |
+
/***/ "./node_modules/react-is/cjs/react-is.development.js":
|
745 |
+
/*!***********************************************************!*\
|
746 |
+
!*** ./node_modules/react-is/cjs/react-is.development.js ***!
|
747 |
+
\***********************************************************/
|
748 |
+
/*! no static exports found */
|
749 |
+
/***/ (function(module, exports, __webpack_require__) {
|
750 |
+
|
751 |
+
"use strict";
|
752 |
+
eval("/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\n\n\n\nif (undefined !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n\n\n//# sourceURL=webpack:///./node_modules/react-is/cjs/react-is.development.js?");
|
753 |
+
|
754 |
+
/***/ }),
|
755 |
+
|
756 |
+
/***/ "./node_modules/react-is/cjs/react-is.production.min.js":
|
757 |
+
/*!**************************************************************!*\
|
758 |
+
!*** ./node_modules/react-is/cjs/react-is.production.min.js ***!
|
759 |
+
\**************************************************************/
|
760 |
+
/*! no static exports found */
|
761 |
+
/***/ (function(module, exports, __webpack_require__) {
|
762 |
+
|
763 |
+
"use strict";
|
764 |
+
eval("/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n\n\n//# sourceURL=webpack:///./node_modules/react-is/cjs/react-is.production.min.js?");
|
765 |
+
|
766 |
+
/***/ }),
|
767 |
+
|
768 |
+
/***/ "./node_modules/react-is/index.js":
|
769 |
+
/*!****************************************!*\
|
770 |
+
!*** ./node_modules/react-is/index.js ***!
|
771 |
+
\****************************************/
|
772 |
+
/*! no static exports found */
|
773 |
+
/***/ (function(module, exports, __webpack_require__) {
|
774 |
+
|
775 |
+
"use strict";
|
776 |
+
eval("\n\nif (undefined === 'production') {\n module.exports = __webpack_require__(/*! ./cjs/react-is.production.min.js */ \"./node_modules/react-is/cjs/react-is.production.min.js\");\n} else {\n module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ \"./node_modules/react-is/cjs/react-is.development.js\");\n}\n\n\n//# sourceURL=webpack:///./node_modules/react-is/index.js?");
|
777 |
+
|
778 |
+
/***/ }),
|
779 |
+
|
780 |
+
/***/ "./node_modules/seedrandom/index.js":
|
781 |
+
/*!******************************************!*\
|
782 |
+
!*** ./node_modules/seedrandom/index.js ***!
|
783 |
+
\******************************************/
|
784 |
+
/*! no static exports found */
|
785 |
+
/***/ (function(module, exports, __webpack_require__) {
|
786 |
+
|
787 |
+
eval("// A library of seedable RNGs implemented in Javascript.\n//\n// Usage:\n//\n// var seedrandom = require('seedrandom');\n// var random = seedrandom(1); // or any seed.\n// var x = random(); // 0 <= x < 1. Every bit is random.\n// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.\n\n// alea, a 53-bit multiply-with-carry generator by Johannes Baagøe.\n// Period: ~2^116\n// Reported to pass all BigCrush tests.\nvar alea = __webpack_require__(/*! ./lib/alea */ \"./node_modules/seedrandom/lib/alea.js\");\n\n// xor128, a pure xor-shift generator by George Marsaglia.\n// Period: 2^128-1.\n// Reported to fail: MatrixRank and LinearComp.\nvar xor128 = __webpack_require__(/*! ./lib/xor128 */ \"./node_modules/seedrandom/lib/xor128.js\");\n\n// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.\n// Period: 2^192-2^32\n// Reported to fail: CollisionOver, SimpPoker, and LinearComp.\nvar xorwow = __webpack_require__(/*! ./lib/xorwow */ \"./node_modules/seedrandom/lib/xorwow.js\");\n\n// xorshift7, by François Panneton and Pierre L'ecuyer, takes\n// a different approach: it adds robustness by allowing more shifts\n// than Marsaglia's original three. It is a 7-shift generator\n// with 256 bits, that passes BigCrush with no systmatic failures.\n// Period 2^256-1.\n// No systematic BigCrush failures reported.\nvar xorshift7 = __webpack_require__(/*! ./lib/xorshift7 */ \"./node_modules/seedrandom/lib/xorshift7.js\");\n\n// xor4096, by Richard Brent, is a 4096-bit xor-shift with a\n// very long period that also adds a Weyl generator. It also passes\n// BigCrush with no systematic failures. Its long period may\n// be useful if you have many generators and need to avoid\n// collisions.\n// Period: 2^4128-2^32.\n// No systematic BigCrush failures reported.\nvar xor4096 = __webpack_require__(/*! ./lib/xor4096 */ \"./node_modules/seedrandom/lib/xor4096.js\");\n\n// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random\n// number generator derived from ChaCha, a modern stream cipher.\n// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n// Period: ~2^127\n// No systematic BigCrush failures reported.\nvar tychei = __webpack_require__(/*! ./lib/tychei */ \"./node_modules/seedrandom/lib/tychei.js\");\n\n// The original ARC4-based prng included in this library.\n// Period: ~2^1600\nvar sr = __webpack_require__(/*! ./seedrandom */ \"./node_modules/seedrandom/seedrandom.js\");\n\nsr.alea = alea;\nsr.xor128 = xor128;\nsr.xorwow = xorwow;\nsr.xorshift7 = xorshift7;\nsr.xor4096 = xor4096;\nsr.tychei = tychei;\n\nmodule.exports = sr;\n\n\n//# sourceURL=webpack:///./node_modules/seedrandom/index.js?");
|
788 |
+
|
789 |
+
/***/ }),
|
790 |
+
|
791 |
+
/***/ "./node_modules/seedrandom/lib/alea.js":
|
792 |
+
/*!*********************************************!*\
|
793 |
+
!*** ./node_modules/seedrandom/lib/alea.js ***!
|
794 |
+
\*********************************************/
|
795 |
+
/*! no static exports found */
|
796 |
+
/***/ (function(module, exports, __webpack_require__) {
|
797 |
+
|
798 |
+
eval("/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// A port of an algorithm by Johannes Baagøe <baagoe@baagoe.com>, 2010\n// http://baagoe.com/en/RandomMusings/javascript/\n// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror\n// Original work is under MIT license -\n\n// Copyright (C) 2010 by Johannes Baagøe <baagoe@baagoe.org>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n\n\n(function(global, module, define) {\n\nfunction Alea(seed) {\n var me = this, mash = Mash();\n\n me.next = function() {\n var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32\n me.s0 = me.s1;\n me.s1 = me.s2;\n return me.s2 = t - (me.c = t | 0);\n };\n\n // Apply the seeding algorithm from Baagoe.\n me.c = 1;\n me.s0 = mash(' ');\n me.s1 = mash(' ');\n me.s2 = mash(' ');\n me.s0 -= mash(seed);\n if (me.s0 < 0) { me.s0 += 1; }\n me.s1 -= mash(seed);\n if (me.s1 < 0) { me.s1 += 1; }\n me.s2 -= mash(seed);\n if (me.s2 < 0) { me.s2 += 1; }\n mash = null;\n}\n\nfunction copy(f, t) {\n t.c = f.c;\n t.s0 = f.s0;\n t.s1 = f.s1;\n t.s2 = f.s2;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new Alea(seed),\n state = opts && opts.state,\n prng = xg.next;\n prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }\n prng.double = function() {\n return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53\n };\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nfunction Mash() {\n var n = 0xefc8249d;\n\n var mash = function(data) {\n data = String(data);\n for (var i = 0; i < data.length; i++) {\n n += data.charCodeAt(i);\n var h = 0.02519603282416938 * n;\n n = h >>> 0;\n h -= n;\n h *= n;\n n = h >>> 0;\n h -= n;\n n += h * 0x100000000; // 2^32\n }\n return (n >>> 0) * 2.3283064365386963e-10; // 2^-32\n };\n\n return mash;\n}\n\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (__webpack_require__(/*! !webpack amd define */ \"./node_modules/webpack/buildin/amd-define.js\") && __webpack_require__(/*! !webpack amd options */ \"./node_modules/webpack/buildin/amd-options.js\")) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return impl; }).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n} else {\n this.alea = impl;\n}\n\n})(\n this,\n true && module, // present in node.js\n __webpack_require__(/*! !webpack amd define */ \"./node_modules/webpack/buildin/amd-define.js\") // present with an AMD loader\n);\n\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack:///./node_modules/seedrandom/lib/alea.js?");
|
799 |
+
|
800 |
+
/***/ }),
|
801 |
+
|
802 |
+
/***/ "./node_modules/seedrandom/lib/tychei.js":
|
803 |
+
/*!***********************************************!*\
|
804 |
+
!*** ./node_modules/seedrandom/lib/tychei.js ***!
|
805 |
+
\***********************************************/
|
806 |
+
/*! no static exports found */
|
807 |
+
/***/ (function(module, exports, __webpack_require__) {
|
808 |
+
|
809 |
+
eval("/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// A Javascript implementaion of the \"Tyche-i\" prng algorithm by\n// Samuel Neves and Filipe Araujo.\n// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var b = me.b, c = me.c, d = me.d, a = me.a;\n b = (b << 25) ^ (b >>> 7) ^ c;\n c = (c - d) | 0;\n d = (d << 24) ^ (d >>> 8) ^ a;\n a = (a - b) | 0;\n me.b = b = (b << 20) ^ (b >>> 12) ^ c;\n me.c = c = (c - d) | 0;\n me.d = (d << 16) ^ (c >>> 16) ^ a;\n return me.a = (a - b) | 0;\n };\n\n /* The following is non-inverted tyche, which has better internal\n * bit diffusion, but which is about 25% slower than tyche-i in JS.\n me.next = function() {\n var a = me.a, b = me.b, c = me.c, d = me.d;\n a = (me.a + me.b | 0) >>> 0;\n d = me.d ^ a; d = d << 16 ^ d >>> 16;\n c = me.c + d | 0;\n b = me.b ^ c; b = b << 12 ^ d >>> 20;\n me.a = a = a + b | 0;\n d = d ^ a; me.d = d = d << 8 ^ d >>> 24;\n me.c = c = c + d | 0;\n b = b ^ c;\n return me.b = (b << 7 ^ b >>> 25);\n }\n */\n\n me.a = 0;\n me.b = 0;\n me.c = 2654435769 | 0;\n me.d = 1367130551;\n\n if (seed === Math.floor(seed)) {\n // Integer seed.\n me.a = (seed / 0x100000000) | 0;\n me.b = seed | 0;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 20; k++) {\n me.b ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.a = f.a;\n t.b = f.b;\n t.c = f.c;\n t.d = f.d;\n return t;\n};\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (__webpack_require__(/*! !webpack amd define */ \"./node_modules/webpack/buildin/amd-define.js\") && __webpack_require__(/*! !webpack amd options */ \"./node_modules/webpack/buildin/amd-options.js\")) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return impl; }).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n} else {\n this.tychei = impl;\n}\n\n})(\n this,\n true && module, // present in node.js\n __webpack_require__(/*! !webpack amd define */ \"./node_modules/webpack/buildin/amd-define.js\") // present with an AMD loader\n);\n\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack:///./node_modules/seedrandom/lib/tychei.js?");
|
810 |
+
|
811 |
+
/***/ }),
|
812 |
+
|
813 |
+
/***/ "./node_modules/seedrandom/lib/xor128.js":
|
814 |
+
/*!***********************************************!*\
|
815 |
+
!*** ./node_modules/seedrandom/lib/xor128.js ***!
|
816 |
+
\***********************************************/
|
817 |
+
/*! no static exports found */
|
818 |
+
/***/ (function(module, exports, __webpack_require__) {
|
819 |
+
|
820 |
+
eval("/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// A Javascript implementaion of the \"xor128\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n\n // Set up generator function.\n me.next = function() {\n var t = me.x ^ (me.x << 11);\n me.x = me.y;\n me.y = me.z;\n me.z = me.w;\n return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);\n };\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (__webpack_require__(/*! !webpack amd define */ \"./node_modules/webpack/buildin/amd-define.js\") && __webpack_require__(/*! !webpack amd options */ \"./node_modules/webpack/buildin/amd-options.js\")) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return impl; }).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n} else {\n this.xor128 = impl;\n}\n\n})(\n this,\n true && module, // present in node.js\n __webpack_require__(/*! !webpack amd define */ \"./node_modules/webpack/buildin/amd-define.js\") // present with an AMD loader\n);\n\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack:///./node_modules/seedrandom/lib/xor128.js?");
|
821 |
+
|
822 |
+
/***/ }),
|
823 |
+
|
824 |
+
/***/ "./node_modules/seedrandom/lib/xor4096.js":
|
825 |
+
/*!************************************************!*\
|
826 |
+
!*** ./node_modules/seedrandom/lib/xor4096.js ***!
|
827 |
+
\************************************************/
|
828 |
+
/*! no static exports found */
|
829 |
+
/***/ (function(module, exports, __webpack_require__) {
|
830 |
+
|
831 |
+
eval("/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.\n//\n// This fast non-cryptographic random number generator is designed for\n// use in Monte-Carlo algorithms. It combines a long-period xorshift\n// generator with a Weyl generator, and it passes all common batteries\n// of stasticial tests for randomness while consuming only a few nanoseconds\n// for each prng generated. For background on the generator, see Brent's\n// paper: \"Some long-period random number generators using shifts and xors.\"\n// http://arxiv.org/pdf/1004.3115v1.pdf\n//\n// Usage:\n//\n// var xor4096 = require('xor4096');\n// random = xor4096(1); // Seed with int32 or string.\n// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.\n// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.\n//\n// For nonzero numeric keys, this impelementation provides a sequence\n// identical to that by Brent's xorgens 3 implementaion in C. This\n// implementation also provides for initalizing the generator with\n// string seeds, or for saving and restoring the state of the generator.\n//\n// On Chrome, this prng benchmarks about 2.1 times slower than\n// Javascript's built-in Math.random().\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n var w = me.w,\n X = me.X, i = me.i, t, v;\n // Update Weyl generator.\n me.w = w = (w + 0x61c88647) | 0;\n // Update xor generator.\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n // Update Xor generator array state.\n v = X[i] = v ^ t;\n me.i = i;\n // Result is the combination.\n return (v + (w ^ (w >>> 16))) | 0;\n };\n\n function init(me, seed) {\n var t, v, i, j, w, X = [], limit = 128;\n if (seed === (seed | 0)) {\n // Numeric seeds initialize v, which is used to generates X.\n v = seed;\n seed = null;\n } else {\n // String seeds are mixed into v and X one character at a time.\n seed = seed + '\\0';\n v = 0;\n limit = Math.max(limit, seed.length);\n }\n // Initialize circular array and weyl value.\n for (i = 0, j = -32; j < limit; ++j) {\n // Put the unicode characters into the array, and shuffle them.\n if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);\n // After 32 shuffles, take v as the starting w value.\n if (j === 0) w = v;\n v ^= v << 10;\n v ^= v >>> 15;\n v ^= v << 4;\n v ^= v >>> 13;\n if (j >= 0) {\n w = (w + 0x61c88647) | 0; // Weyl.\n t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.\n i = (0 == t) ? i + 1 : 0; // Count zeroes.\n }\n }\n // We have detected all zeroes; make the key nonzero.\n if (i >= 128) {\n X[(seed && seed.length || 0) & 127] = -1;\n }\n // Run the generator 512 times to further mix the state before using it.\n // Factoring this as a function slows the main generator, so it is just\n // unrolled here. The weyl generator is not advanced while warming up.\n i = 127;\n for (j = 4 * 128; j > 0; --j) {\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n X[i] = v ^ t;\n }\n // Storing state as object members is faster than using closure variables.\n me.w = w;\n me.X = X;\n me.i = i;\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.i = f.i;\n t.w = f.w;\n t.X = f.X.slice();\n return t;\n};\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.X) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (__webpack_require__(/*! !webpack amd define */ \"./node_modules/webpack/buildin/amd-define.js\") && __webpack_require__(/*! !webpack amd options */ \"./node_modules/webpack/buildin/amd-options.js\")) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return impl; }).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n} else {\n this.xor4096 = impl;\n}\n\n})(\n this, // window object or global\n true && module, // present in node.js\n __webpack_require__(/*! !webpack amd define */ \"./node_modules/webpack/buildin/amd-define.js\") // present with an AMD loader\n);\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack:///./node_modules/seedrandom/lib/xor4096.js?");
|
832 |
+
|
833 |
+
/***/ }),
|
834 |
+
|
835 |
+
/***/ "./node_modules/seedrandom/lib/xorshift7.js":
|
836 |
+
/*!**************************************************!*\
|
837 |
+
!*** ./node_modules/seedrandom/lib/xorshift7.js ***!
|
838 |
+
\**************************************************/
|
839 |
+
/*! no static exports found */
|
840 |
+
/***/ (function(module, exports, __webpack_require__) {
|
841 |
+
|
842 |
+
eval("/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// A Javascript implementaion of the \"xorshift7\" algorithm by\n// François Panneton and Pierre L'ecuyer:\n// \"On the Xorgshift Random Number Generators\"\n// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n // Update xor generator.\n var X = me.x, i = me.i, t, v, w;\n t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);\n t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);\n t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);\n t = X[(i + 4) & 7]; v ^= t ^ (t << 7);\n t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);\n X[i] = v;\n me.i = (i + 1) & 7;\n return v;\n };\n\n function init(me, seed) {\n var j, w, X = [];\n\n if (seed === (seed | 0)) {\n // Seed state array using a 32-bit integer.\n w = X[0] = seed;\n } else {\n // Seed state using a string.\n seed = '' + seed;\n for (j = 0; j < seed.length; ++j) {\n X[j & 7] = (X[j & 7] << 15) ^\n (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);\n }\n }\n // Enforce an array length of 8, not all zeroes.\n while (X.length < 8) X.push(0);\n for (j = 0; j < 8 && X[j] === 0; ++j);\n if (j == 8) w = X[7] = -1; else w = X[j];\n\n me.x = X;\n me.i = 0;\n\n // Discard an initial 256 values.\n for (j = 256; j > 0; --j) {\n me.next();\n }\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.x = f.x.slice();\n t.i = f.i;\n return t;\n}\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.x) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (__webpack_require__(/*! !webpack amd define */ \"./node_modules/webpack/buildin/amd-define.js\") && __webpack_require__(/*! !webpack amd options */ \"./node_modules/webpack/buildin/amd-options.js\")) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return impl; }).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n} else {\n this.xorshift7 = impl;\n}\n\n})(\n this,\n true && module, // present in node.js\n __webpack_require__(/*! !webpack amd define */ \"./node_modules/webpack/buildin/amd-define.js\") // present with an AMD loader\n);\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack:///./node_modules/seedrandom/lib/xorshift7.js?");
|
843 |
+
|
844 |
+
/***/ }),
|
845 |
+
|
846 |
+
/***/ "./node_modules/seedrandom/lib/xorwow.js":
|
847 |
+
/*!***********************************************!*\
|
848 |
+
!*** ./node_modules/seedrandom/lib/xorwow.js ***!
|
849 |
+
\***********************************************/
|
850 |
+
/*! no static exports found */
|
851 |
+
/***/ (function(module, exports, __webpack_require__) {
|
852 |
+
|
853 |
+
eval("/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// A Javascript implementaion of the \"xorwow\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var t = (me.x ^ (me.x >>> 2));\n me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;\n return (me.d = (me.d + 362437 | 0)) +\n (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;\n };\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n me.v = 0;\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n if (k == strseed.length) {\n me.d = me.x << 10 ^ me.x >>> 4;\n }\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n t.v = f.v;\n t.d = f.d;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (__webpack_require__(/*! !webpack amd define */ \"./node_modules/webpack/buildin/amd-define.js\") && __webpack_require__(/*! !webpack amd options */ \"./node_modules/webpack/buildin/amd-options.js\")) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return impl; }).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n} else {\n this.xorwow = impl;\n}\n\n})(\n this,\n true && module, // present in node.js\n __webpack_require__(/*! !webpack amd define */ \"./node_modules/webpack/buildin/amd-define.js\") // present with an AMD loader\n);\n\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack:///./node_modules/seedrandom/lib/xorwow.js?");
|
854 |
+
|
855 |
+
/***/ }),
|
856 |
+
|
857 |
+
/***/ "./node_modules/seedrandom/seedrandom.js":
|
858 |
+
/*!***********************************************!*\
|
859 |
+
!*** ./node_modules/seedrandom/seedrandom.js ***!
|
860 |
+
\***********************************************/
|
861 |
+
/*! no static exports found */
|
862 |
+
/***/ (function(module, exports, __webpack_require__) {
|
863 |
+
|
864 |
+
eval("var __WEBPACK_AMD_DEFINE_RESULT__;/*\nCopyright 2019 David Bau.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\n(function (global, pool, math) {\n//\n// The following constants are related to IEEE 754 limits.\n//\n\nvar width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n//\n// seedrandom()\n// This is the seedrandom function described above.\n//\nfunction seedrandom(seed, options, callback) {\n var key = [];\n options = (options == true) ? { entropy: true } : (options || {});\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(\n options.entropy ? [seed, tostring(pool)] :\n (seed == null) ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function() {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) { // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) { // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n\n prng.int32 = function() { return arc4.g(4) | 0; }\n prng.quick = function() { return arc4.g(4) / 0x100000000; }\n prng.double = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback ||\n function(prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) { copy(state, arc4); }\n // Only provide the .state method if requested via options.state.\n prng.state = function() { return copy(arc4, {}); }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) { math[rngname] = prng; return seed; }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(\n prng,\n shortseed,\n 'global' in options ? options.global : (this == math),\n options.state);\n}\n\n//\n// ARC4\n//\n// An ARC4 implementation. The constructor takes a key in the form of\n// an array of at most (width) integers that should be 0 <= x < (width).\n//\n// The g(count) method returns a pseudorandom integer that concatenates\n// the next (count) outputs from ARC4. Its return value is a number x\n// that is in the range 0 <= x < (width ^ count).\n//\nfunction ARC4(key) {\n var t, keylen = key.length,\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) { key = [keylen++]; }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n (me.g = function(count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t, r = 0,\n i = me.i, j = me.j, s = me.S;\n while (count--) {\n t = s[i = mask & (i + 1)];\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\n }\n me.i = i; me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n })(width);\n}\n\n//\n// copy()\n// Copies internal state of ARC4 to or from a plain object.\n//\nfunction copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n};\n\n//\n// flatten()\n// Converts an object tree to nested arrays of strings.\n//\nfunction flatten(obj, depth) {\n var result = [], typ = (typeof obj), prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\n }\n }\n return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\n}\n\n//\n// mixkey()\n// Mixes a string seed into a key that is an array of integers, and\n// returns a shortened string seed that is equivalent to the result key.\n//\nfunction mixkey(seed, key) {\n var stringseed = seed + '', smear, j = 0;\n while (j < stringseed.length) {\n key[mask & j] =\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\n }\n return tostring(key);\n}\n\n//\n// autoseed()\n// Returns an object for autoseeding, using window.crypto and Node crypto\n// module if available.\n//\nfunction autoseed() {\n try {\n var out;\n if (nodecrypto && (out = nodecrypto.randomBytes)) {\n // The use of 'out' to remember randomBytes makes tight minified code.\n out = out(width);\n } else {\n out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n }\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date, global, plugins, global.screen, tostring(pool)];\n }\n}\n\n//\n// tostring()\n// Converts an array of charcodes to a string\n//\nfunction tostring(a) {\n return String.fromCharCode.apply(0, a);\n}\n\n//\n// When seedrandom.js is loaded, we immediately mix a few bits\n// from the built-in RNG into the entropy pool. Because we do\n// not want to interfere with deterministic PRNG state later,\n// seedrandom will not call math.random on its own again after\n// initialization.\n//\nmixkey(math.random(), pool);\n\n//\n// Nodejs and AMD support: export the implementation as a module using\n// either convention.\n//\nif ( true && module.exports) {\n module.exports = seedrandom;\n // When in node.js, try using crypto package for autoseeding.\n try {\n nodecrypto = __webpack_require__(/*! crypto */ 0);\n } catch (ex) {}\n} else if (true) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return seedrandom; }).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n} else {}\n\n\n// End anonymous scope, and pass initial values.\n})(\n // global: `self` in browsers (including strict mode and web workers),\n // otherwise `this` in Node and other environments\n (typeof self !== 'undefined') ? self : this,\n [], // pool: entropy pool starts empty\n Math // math: package containing random, pow, and seedrandom\n);\n\n\n//# sourceURL=webpack:///./node_modules/seedrandom/seedrandom.js?");
|
865 |
+
|
866 |
+
/***/ }),
|
867 |
+
|
868 |
+
/***/ "./node_modules/webpack/buildin/amd-define.js":
|
869 |
+
/*!***************************************!*\
|
870 |
+
!*** (webpack)/buildin/amd-define.js ***!
|
871 |
+
\***************************************/
|
872 |
+
/*! no static exports found */
|
873 |
+
/***/ (function(module, exports) {
|
874 |
+
|
875 |
+
eval("module.exports = function() {\n\tthrow new Error(\"define cannot be used indirect\");\n};\n\n\n//# sourceURL=webpack:///(webpack)/buildin/amd-define.js?");
|
876 |
+
|
877 |
+
/***/ }),
|
878 |
+
|
879 |
+
/***/ "./node_modules/webpack/buildin/amd-options.js":
|
880 |
+
/*!****************************************!*\
|
881 |
+
!*** (webpack)/buildin/amd-options.js ***!
|
882 |
+
\****************************************/
|
883 |
+
/*! no static exports found */
|
884 |
+
/***/ (function(module, exports) {
|
885 |
+
|
886 |
+
eval("/* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {/* globals __webpack_amd_options__ */\nmodule.exports = __webpack_amd_options__;\n\n/* WEBPACK VAR INJECTION */}.call(this, {}))\n\n//# sourceURL=webpack:///(webpack)/buildin/amd-options.js?");
|
887 |
+
|
888 |
+
/***/ }),
|
889 |
+
|
890 |
+
/***/ "./node_modules/webpack/buildin/module.js":
|
891 |
+
/*!***********************************!*\
|
892 |
+
!*** (webpack)/buildin/module.js ***!
|
893 |
+
\***********************************/
|
894 |
+
/*! no static exports found */
|
895 |
+
/***/ (function(module, exports) {
|
896 |
+
|
897 |
+
eval("module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n\n\n//# sourceURL=webpack:///(webpack)/buildin/module.js?");
|
898 |
+
|
899 |
+
/***/ }),
|
900 |
+
|
901 |
+
/***/ 0:
|
902 |
+
/*!************************!*\
|
903 |
+
!*** crypto (ignored) ***!
|
904 |
+
\************************/
|
905 |
+
/*! no static exports found */
|
906 |
+
/***/ (function(module, exports) {
|
907 |
+
|
908 |
+
eval("/* (ignored) */\n\n//# sourceURL=webpack:///crypto_(ignored)?");
|
909 |
+
|
910 |
+
/***/ }),
|
911 |
+
|
912 |
+
/***/ "@babel/runtime/regenerator":
|
913 |
+
/*!**********************************************!*\
|
914 |
+
!*** external {"this":"regeneratorRuntime"} ***!
|
915 |
+
\**********************************************/
|
916 |
+
/*! no static exports found */
|
917 |
+
/***/ (function(module, exports) {
|
918 |
+
|
919 |
+
eval("(function() { module.exports = this[\"regeneratorRuntime\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%22regeneratorRuntime%22%7D?");
|
920 |
+
|
921 |
+
/***/ }),
|
922 |
+
|
923 |
+
/***/ "@wordpress/api-fetch":
|
924 |
+
/*!*******************************************!*\
|
925 |
+
!*** external {"this":["wp","apiFetch"]} ***!
|
926 |
+
\*******************************************/
|
927 |
+
/*! no static exports found */
|
928 |
+
/***/ (function(module, exports) {
|
929 |
+
|
930 |
+
eval("(function() { module.exports = this[\"wp\"][\"apiFetch\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22apiFetch%22%5D%7D?");
|
931 |
+
|
932 |
+
/***/ }),
|
933 |
+
|
934 |
+
/***/ "@wordpress/components":
|
935 |
+
/*!*********************************************!*\
|
936 |
+
!*** external {"this":["wp","components"]} ***!
|
937 |
+
\*********************************************/
|
938 |
+
/*! no static exports found */
|
939 |
+
/***/ (function(module, exports) {
|
940 |
+
|
941 |
+
eval("(function() { module.exports = this[\"wp\"][\"components\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22components%22%5D%7D?");
|
942 |
+
|
943 |
+
/***/ }),
|
944 |
+
|
945 |
+
/***/ "@wordpress/element":
|
946 |
+
/*!******************************************!*\
|
947 |
+
!*** external {"this":["wp","element"]} ***!
|
948 |
+
\******************************************/
|
949 |
+
/*! no static exports found */
|
950 |
+
/***/ (function(module, exports) {
|
951 |
+
|
952 |
+
eval("(function() { module.exports = this[\"wp\"][\"element\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22element%22%5D%7D?");
|
953 |
+
|
954 |
+
/***/ }),
|
955 |
+
|
956 |
+
/***/ "@wordpress/html-entities":
|
957 |
+
/*!***********************************************!*\
|
958 |
+
!*** external {"this":["wp","htmlEntities"]} ***!
|
959 |
+
\***********************************************/
|
960 |
+
/*! no static exports found */
|
961 |
+
/***/ (function(module, exports) {
|
962 |
+
|
963 |
+
eval("(function() { module.exports = this[\"wp\"][\"htmlEntities\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22htmlEntities%22%5D%7D?");
|
964 |
+
|
965 |
+
/***/ }),
|
966 |
+
|
967 |
+
/***/ "@wordpress/i18n":
|
968 |
+
/*!***************************************!*\
|
969 |
+
!*** external {"this":["wp","i18n"]} ***!
|
970 |
+
\***************************************/
|
971 |
+
/*! no static exports found */
|
972 |
+
/***/ (function(module, exports) {
|
973 |
+
|
974 |
+
eval("(function() { module.exports = this[\"wp\"][\"i18n\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%5B%22wp%22,%22i18n%22%5D%7D?");
|
975 |
+
|
976 |
+
/***/ }),
|
977 |
+
|
978 |
+
/***/ "lodash":
|
979 |
+
/*!**********************************!*\
|
980 |
+
!*** external {"this":"lodash"} ***!
|
981 |
+
\**********************************/
|
982 |
+
/*! no static exports found */
|
983 |
+
/***/ (function(module, exports) {
|
984 |
+
|
985 |
+
eval("(function() { module.exports = this[\"lodash\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%22lodash%22%7D?");
|
986 |
+
|
987 |
+
/***/ }),
|
988 |
+
|
989 |
+
/***/ "react":
|
990 |
+
/*!*********************************!*\
|
991 |
+
!*** external {"this":"React"} ***!
|
992 |
+
\*********************************/
|
993 |
+
/*! no static exports found */
|
994 |
+
/***/ (function(module, exports) {
|
995 |
+
|
996 |
+
eval("(function() { module.exports = this[\"React\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%22React%22%7D?");
|
997 |
+
|
998 |
+
/***/ }),
|
999 |
+
|
1000 |
+
/***/ "react-dom":
|
1001 |
+
/*!************************************!*\
|
1002 |
+
!*** external {"this":"ReactDOM"} ***!
|
1003 |
+
\************************************/
|
1004 |
+
/*! no static exports found */
|
1005 |
+
/***/ (function(module, exports) {
|
1006 |
+
|
1007 |
+
eval("(function() { module.exports = this[\"ReactDOM\"]; }());\n\n//# sourceURL=webpack:///external_%7B%22this%22:%22ReactDOM%22%7D?");
|
1008 |
+
|
1009 |
+
/***/ })
|
1010 |
+
|
1011 |
+
/******/ })));
|
changelog.txt
ADDED
File without changes
|
crowdsignal-forms.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The plugin bootstrap file
|
4 |
+
*
|
5 |
+
* This file is read by WordPress to generate the plugin information in the plugin
|
6 |
+
* admin area. This file also includes all of the dependencies used by the plugin,
|
7 |
+
* registers the activation and deactivation functions, and defines a function
|
8 |
+
* that starts the plugin.
|
9 |
+
*
|
10 |
+
* @link https://automattic.com
|
11 |
+
* @since 0.9.0
|
12 |
+
* @package Crowdsignal_Forms
|
13 |
+
*
|
14 |
+
* @wordpress-plugin
|
15 |
+
* Plugin Name: Crowdsignal Forms
|
16 |
+
* Plugin URI: https://crowdsignal.com/crowdsignal-forms/
|
17 |
+
* Description: Crowdsignal Form Blocks
|
18 |
+
* Version: 0.9.0
|
19 |
+
* Author: Automattic
|
20 |
+
* Author URI: https://automattic.com/
|
21 |
+
* License: GPL-2.0+
|
22 |
+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
|
23 |
+
* Text Domain: crowdsignal-forms
|
24 |
+
* Domain Path: /languages
|
25 |
+
*/
|
26 |
+
|
27 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
28 |
+
die;
|
29 |
+
}
|
30 |
+
|
31 |
+
define( 'CROWDSIGNAL_FORMS_VERSION', '0.9' );
|
32 |
+
define( 'CROWDSIGNAL_FORMS_PLUGIN_FILE', __FILE__ );
|
33 |
+
define( 'CROWDSIGNAL_FORMS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
34 |
+
|
35 |
+
$crowdsignal_forms_plugin_dir = dirname( __FILE__ );
|
36 |
+
|
37 |
+
require_once $crowdsignal_forms_plugin_dir . '/includes/class-autoloader.php';
|
38 |
+
|
39 |
+
Crowdsignal_Forms\Autoloader::get_instance()
|
40 |
+
->set_plugin_dir( $crowdsignal_forms_plugin_dir )
|
41 |
+
->register();
|
42 |
+
|
43 |
+
Crowdsignal_Forms\Crowdsignal_Forms::init();
|
44 |
+
|
includes/admin/admin-styles.css
ADDED
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@font-face {
|
2 |
+
font-family: Recoleta;
|
3 |
+
src: url( "https://s1.wp.com/i/fonts/recoleta/400.woff2" );
|
4 |
+
}
|
5 |
+
|
6 |
+
@font-face {
|
7 |
+
font-family: Recoleta;
|
8 |
+
src: url( "https://s1.wp.com/i/fonts/recoleta/500.woff2" );
|
9 |
+
font-weight: 500;
|
10 |
+
}
|
11 |
+
|
12 |
+
@font-face {
|
13 |
+
font-family: Recoleta;
|
14 |
+
src: url( "https://s1.wp.com/i/fonts/recoleta/700.woff2" );
|
15 |
+
font-weight: 700;
|
16 |
+
}
|
17 |
+
|
18 |
+
.wrap {
|
19 |
+
margin: 0;
|
20 |
+
}
|
21 |
+
|
22 |
+
.crowdsignal-setup__header {
|
23 |
+
background-color: #fff;
|
24 |
+
text-align: center;
|
25 |
+
box-shadow: 0 1px 0 #ccd0d4,0 1px 1px 1px rgba(0,0,0,0.04);
|
26 |
+
margin-left: -20px;
|
27 |
+
}
|
28 |
+
|
29 |
+
.crowdsignal-setup__header-container {
|
30 |
+
display: flex;
|
31 |
+
flex-wrap: wrap;
|
32 |
+
margin: 0 auto;
|
33 |
+
max-width: 65rem;
|
34 |
+
padding-bottom: .375rem;
|
35 |
+
padding-left: 16px;
|
36 |
+
}
|
37 |
+
|
38 |
+
.crowdsignal-setup__logo-container {
|
39 |
+
flex-grow: 0;
|
40 |
+
flex-shrink: 0;
|
41 |
+
padding: .6875rem 0 0;
|
42 |
+
display: inline-block;
|
43 |
+
}
|
44 |
+
|
45 |
+
.crowdsignal-setup__email-activation {
|
46 |
+
font-size: 16px !important;
|
47 |
+
font-style: italic;
|
48 |
+
}
|
49 |
+
|
50 |
+
.crowdsignal-setup__footer {
|
51 |
+
text-align: center;
|
52 |
+
margin: 100px 0 2rem;
|
53 |
+
}
|
54 |
+
|
55 |
+
.crowdsignal-setup__footer-container {
|
56 |
+
margin-bottom: .5rem;
|
57 |
+
}
|
58 |
+
|
59 |
+
.crowdsignal-setup__footer-attr {
|
60 |
+
width: 11.25rem;
|
61 |
+
}
|
62 |
+
|
63 |
+
.crowdsignal-setup__footer-links {
|
64 |
+
border-top: 1px #e1e1e1 solid;
|
65 |
+
border-bottom: 1px #e1e1e1 solid;
|
66 |
+
margin-top: 0;
|
67 |
+
margin-bottom: 1rem;
|
68 |
+
}
|
69 |
+
|
70 |
+
.crowdsignal-setup__footer-item {
|
71 |
+
display: inline-block;
|
72 |
+
margin-bottom: 0;
|
73 |
+
}
|
74 |
+
|
75 |
+
.crowdsignal-setup__footer-link {
|
76 |
+
padding: 1rem .5rem;
|
77 |
+
color: #888;
|
78 |
+
display: inline-block;
|
79 |
+
cursor: pointer;
|
80 |
+
}
|
81 |
+
|
82 |
+
.crowdsignal-setup__main {
|
83 |
+
background-color: #fff;
|
84 |
+
display: flex;
|
85 |
+
flex-direction: column;
|
86 |
+
align-content: center;
|
87 |
+
max-width: 65rem;
|
88 |
+
margin: 24px auto 0;
|
89 |
+
border: 1px solid rgba(213, 213, 213, 0.5);
|
90 |
+
}
|
91 |
+
|
92 |
+
.crowdsignal-setup__main img {
|
93 |
+
width: 100%;
|
94 |
+
height: auto;
|
95 |
+
max-height: 150px;
|
96 |
+
}
|
97 |
+
|
98 |
+
.crowdsignal-setup__content {
|
99 |
+
padding: 0 20px 20px;
|
100 |
+
text-align: center;
|
101 |
+
display: flex;
|
102 |
+
flex-direction: column;
|
103 |
+
justify-content: space-around;
|
104 |
+
min-height: 400px;
|
105 |
+
margin: 40px 0;
|
106 |
+
}
|
107 |
+
|
108 |
+
.crowdsignal-setup__content p {
|
109 |
+
font-size: 18px;
|
110 |
+
max-width: 800px;
|
111 |
+
margin: 0 auto;
|
112 |
+
}
|
113 |
+
|
114 |
+
.crowdsignal-setup__content h3,
|
115 |
+
.crowdsignal-setup__content h4 {
|
116 |
+
font-family: Recoleta, sans-serif;
|
117 |
+
font-weight: 700;
|
118 |
+
font-size: 40px;
|
119 |
+
line-height: 150%;
|
120 |
+
margin: 0;
|
121 |
+
}
|
122 |
+
|
123 |
+
.crowdsignal-setup__content h4 {
|
124 |
+
font-size: 34px;
|
125 |
+
line-height: 140%;
|
126 |
+
}
|
127 |
+
|
128 |
+
.crowdsignal-setup__button {
|
129 |
+
margin: 0 auto;
|
130 |
+
background-color: #c9356e;
|
131 |
+
border-color: #8c1749;
|
132 |
+
color: #ffffff;
|
133 |
+
font-weight: 500;
|
134 |
+
align-items: center;
|
135 |
+
border-radius: 5px;
|
136 |
+
border-style: solid;
|
137 |
+
border-width: 1px 1px 2px;
|
138 |
+
box-sizing: border-box;
|
139 |
+
cursor: pointer;
|
140 |
+
display: inline-flex;
|
141 |
+
font-size: 14px;
|
142 |
+
height: 32px;
|
143 |
+
justify-content: center;
|
144 |
+
line-height: 24px;
|
145 |
+
outline: 0;
|
146 |
+
padding: 3px 15px 2px;
|
147 |
+
text-align: center;
|
148 |
+
transition: background-color .1s ease-out, border-color .1s ease-out;
|
149 |
+
white-space: nowrap;
|
150 |
+
width: fit-content;
|
151 |
+
min-width: 200px;
|
152 |
+
}
|
153 |
+
|
154 |
+
.crowdsignal-setup__button:hover {
|
155 |
+
background-color: #eb6594;
|
156 |
+
}
|
157 |
+
|
158 |
+
.crowdsignal-setup__support {
|
159 |
+
font-size: 14px;
|
160 |
+
}
|
161 |
+
|
162 |
+
.crowdsignal-setup__top {
|
163 |
+
margin-top: 32px;
|
164 |
+
}
|
165 |
+
|
166 |
+
.crowdsignal-setup__middle {
|
167 |
+
min-height: 100px;
|
168 |
+
margin-right: auto;
|
169 |
+
margin-left: auto;
|
170 |
+
padding-left: 0px;
|
171 |
+
border: 1px none #000;
|
172 |
+
border-radius: 0px;
|
173 |
+
margin-top: 40px;
|
174 |
+
}
|
175 |
+
|
176 |
+
.crowdsignal-setup__middle a {
|
177 |
+
text-decoration: none;
|
178 |
+
}
|
179 |
+
|
180 |
+
.crowdsignal-setup__video-container {
|
181 |
+
display: block;
|
182 |
+
overflow: hidden;
|
183 |
+
position: relative;
|
184 |
+
margin-top: 64px;
|
185 |
+
margin-bottom: 120px;
|
186 |
+
padding-top: 56.25%;
|
187 |
+
width: 100%;
|
188 |
+
}
|
189 |
+
|
190 |
+
.crowdsignal-setup__video {
|
191 |
+
position: absolute;
|
192 |
+
top: 0;
|
193 |
+
left: 0;
|
194 |
+
bottom: 0;
|
195 |
+
right: 0;
|
196 |
+
width: 100%;
|
197 |
+
height: 100%;
|
198 |
+
background-color: #e2e2e2;
|
199 |
+
}
|
200 |
+
|
201 |
+
|
202 |
+
.wrap .error.crowdsignal-message, .wrap .updated.crowdsignal-message {
|
203 |
+
width: calc(100% + 20px);
|
204 |
+
margin-left: -20px;
|
205 |
+
margin-right: -20px;
|
206 |
+
margin-bottom: 5px;
|
207 |
+
box-sizing: border-box;
|
208 |
+
border-right: none;
|
209 |
+
}
|
210 |
+
|
211 |
+
.crowdsignal-settings__main-content {
|
212 |
+
max-width: 65rem;
|
213 |
+
margin-top: 24px;
|
214 |
+
margin-bottom: 48px;
|
215 |
+
margin-right: auto;
|
216 |
+
margin-left: auto;
|
217 |
+
}
|
218 |
+
|
219 |
+
.dops-card {
|
220 |
+
display: block;
|
221 |
+
position: relative;
|
222 |
+
margin: 0 auto 10px;
|
223 |
+
padding: 16px;
|
224 |
+
box-sizing: border-box;
|
225 |
+
background: #fff;
|
226 |
+
box-shadow: 0 0 0 1px #ccd0d4,0 1px 1px 1px rgba(0,0,0,.04);
|
227 |
+
}
|
228 |
+
|
229 |
+
.dops-card.is-compact {
|
230 |
+
margin-bottom: 1px;
|
231 |
+
padding: 16px 24px;
|
232 |
+
}
|
233 |
+
|
234 |
+
.dops-section-header.dops-card {
|
235 |
+
display: flex;
|
236 |
+
flex-wrap: wrap;
|
237 |
+
padding-top: .6875rem;
|
238 |
+
padding-bottom: .6875rem;
|
239 |
+
position: relative;
|
240 |
+
}
|
241 |
+
|
242 |
+
.dops-section-header__label {
|
243 |
+
line-height: 1.75rem;
|
244 |
+
color: #414141;
|
245 |
+
font-size: .875rem;
|
246 |
+
}
|
247 |
+
|
248 |
+
.dops-section-header__label-text {
|
249 |
+
position: relative;
|
250 |
+
margin-right: .5rem;
|
251 |
+
white-space: nowrap;
|
252 |
+
overflow: hidden;
|
253 |
+
width: 100%;
|
254 |
+
padding-right: .5rem;
|
255 |
+
min-width: 0;
|
256 |
+
}
|
257 |
+
|
258 |
+
.crowdsignal-settings__middle {
|
259 |
+
min-height: 100px;
|
260 |
+
padding-left: 0px;
|
261 |
+
border: 1px none #000;
|
262 |
+
border-radius: 0px;
|
263 |
+
}
|
264 |
+
|
265 |
+
.crowdsignal-settings__text {
|
266 |
+
margin-top: 40px;
|
267 |
+
line-height: 150%;
|
268 |
+
font-size: 14px;
|
269 |
+
line-height: 20px;
|
270 |
+
color: #444444;
|
271 |
+
}
|
272 |
+
|
273 |
+
.crowdsignal-settings__bottom {
|
274 |
+
margin-top: 80px;
|
275 |
+
}
|
276 |
+
|
277 |
+
.button.crowdsignal-settings__cta {
|
278 |
+
margin-top: -5px;
|
279 |
+
margin-left: 8px;
|
280 |
+
}
|
281 |
+
|
282 |
+
.crowdsignal-settings__submit {
|
283 |
+
margin-top: 10px;
|
284 |
+
}
|
285 |
+
|
286 |
+
@media screen and (min-width: 782px) {
|
287 |
+
.crowdsignal-settings__submit {
|
288 |
+
margin-top: -45px;
|
289 |
+
display: block;
|
290 |
+
margin-left: 585px;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
@media screen and (max-width: 516px) {
|
295 |
+
.button.crowdsignal-settings__cta {
|
296 |
+
margin-top: 16px;
|
297 |
+
margin-left: 0px;
|
298 |
+
}
|
299 |
+
}
|
300 |
+
|
301 |
+
@media screen and (max-width: 782px) {
|
302 |
+
.wrap .updated.crowdsignal-message {
|
303 |
+
width: auto;
|
304 |
+
margin-left: 0px;
|
305 |
+
margin-right: 0px;
|
306 |
+
margin-bottom: 5px;
|
307 |
+
}
|
308 |
+
}
|
includes/admin/class-admin-hooks.php
ADDED
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains the Admin_Hooks class
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Admin
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Crowdsignal_Forms\Admin;
|
9 |
+
|
10 |
+
use Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin;
|
11 |
+
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;
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Admin_Hooks
|
22 |
+
*/
|
23 |
+
class Admin_Hooks {
|
24 |
+
/**
|
25 |
+
* The poll ids meta key.
|
26 |
+
*/
|
27 |
+
const CROWDSIGNAL_FORMS_POLL_IDS = '_crowdsignal_forms_poll_ids';
|
28 |
+
/**
|
29 |
+
* Is the class hooked.
|
30 |
+
*
|
31 |
+
* @var bool Is the class hooked.
|
32 |
+
*/
|
33 |
+
private $is_hooked = false;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The admin page.
|
37 |
+
*
|
38 |
+
* @var Crowdsignal_Forms_Admin
|
39 |
+
*/
|
40 |
+
private $admin;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Perform any hooks.
|
44 |
+
*
|
45 |
+
* @since 0.9.0
|
46 |
+
*
|
47 |
+
* @return $this
|
48 |
+
*/
|
49 |
+
public function hook() {
|
50 |
+
if ( $this->is_hooked ) {
|
51 |
+
return $this;
|
52 |
+
}
|
53 |
+
$this->is_hooked = true;
|
54 |
+
// Do any hooks required.
|
55 |
+
if ( is_admin() && apply_filters( 'crowdsignal_forms_show_admin', true ) ) {
|
56 |
+
$this->admin = new Crowdsignal_Forms_Admin();
|
57 |
+
|
58 |
+
// admin page.
|
59 |
+
add_action( 'admin_init', array( $this->admin, 'admin_init' ) );
|
60 |
+
add_action( 'admin_menu', array( $this->admin, 'admin_menu' ), 12 );
|
61 |
+
add_action( 'admin_enqueue_scripts', array( $this->admin, 'admin_enqueue_scripts' ) );
|
62 |
+
|
63 |
+
// admin notices.
|
64 |
+
add_action( 'crowdsignal_forms_init_admin_notices', 'Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin_Notices::init_core_notices' );
|
65 |
+
add_action( 'admin_notices', 'Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin_Notices::display_notices' );
|
66 |
+
add_action( 'wp_loaded', 'Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin_Notices::dismiss_notices' );
|
67 |
+
}
|
68 |
+
|
69 |
+
add_action( 'save_post', array( $this, 'save_polls_to_api' ), 10, 3 );
|
70 |
+
|
71 |
+
return $this;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Check if the block has a pollId attr.
|
76 |
+
*
|
77 |
+
* @param array $attrs The attrs.
|
78 |
+
* @since 0.9.0
|
79 |
+
*
|
80 |
+
* @return bool
|
81 |
+
*/
|
82 |
+
private static function is_saved_poll( $attrs ) {
|
83 |
+
return isset( $attrs[ Poll::POLL_ID_BLOCK_ATTRIBUTE ] ) &&
|
84 |
+
! empty( $attrs[ Poll::POLL_ID_BLOCK_ATTRIBUTE ] );
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Return the meta key for a poll block client ID.
|
89 |
+
*
|
90 |
+
* @param string $poll_id_on_block The client id.
|
91 |
+
* @return string
|
92 |
+
*/
|
93 |
+
private function get_poll_meta_key( $poll_id_on_block ) {
|
94 |
+
return '_cs_poll_' . $poll_id_on_block;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Will save any pending polls.
|
99 |
+
*
|
100 |
+
* @param int $post_ID The id.
|
101 |
+
* @param \WP_Post $post The post.
|
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 = new Crowdsignal_Forms_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 |
+
private function process_blocks( $blocks, $post_ID, $gateway, &$poll_ids_present_in_content ) {
|
163 |
+
// search for all poll blocks at top level and nested in other blocks.
|
164 |
+
$poll_blocks = array();
|
165 |
+
$blocks_to_process = $blocks;
|
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 |
+
/**
|
229 |
+
* Archive polls with these ids.
|
230 |
+
*
|
231 |
+
* @param array $poll_ids_to_archive Ids to archive.
|
232 |
+
*/
|
233 |
+
private function archive_polls_with_ids( $poll_ids_to_archive ) {
|
234 |
+
if ( empty( $poll_ids_to_archive ) ) {
|
235 |
+
return;
|
236 |
+
}
|
237 |
+
$gateway = Crowdsignal_Forms::instance()->get_api_gateway();
|
238 |
+
foreach ( $poll_ids_to_archive as $id_to_archive ) {
|
239 |
+
$gateway->archive_poll( $id_to_archive );
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
includes/admin/class-crowdsignal-forms-admin-notices.php
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the class Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin_Notices.
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Admin
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Crowdsignal_Forms\Admin;
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
exit;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Crowdsignal_Forms_Admin_Notices class.
|
16 |
+
*
|
17 |
+
* @since 0.9.0
|
18 |
+
*/
|
19 |
+
class Crowdsignal_Forms_Admin_Notices {
|
20 |
+
const STATE_OPTION = 'crowdsignal_forms_admin_notices';
|
21 |
+
const NOTICE_CORE_SETUP = 'core_setup';
|
22 |
+
const SETUP_SUCCESS = 'setup_success';
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Current notices for admin user.
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
*/
|
29 |
+
private static $notice_state;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Initialize admin notice handling.
|
33 |
+
*/
|
34 |
+
public static function init() {
|
35 |
+
add_action( 'crowdsignal_forms_init_admin_notices', array( __CLASS__, 'init_core_notices' ) );
|
36 |
+
add_action( 'admin_notices', array( __CLASS__, 'display_notices' ) );
|
37 |
+
add_action( 'wp_loaded', array( __CLASS__, 'dismiss_notices' ) );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Add a notice to be displayed in WP admin.
|
42 |
+
*
|
43 |
+
* @since 0.9.0
|
44 |
+
*
|
45 |
+
* @param string $notice Name of the notice.
|
46 |
+
*/
|
47 |
+
public static function add_notice( $notice ) {
|
48 |
+
$notice = sanitize_key( $notice );
|
49 |
+
|
50 |
+
if ( ! in_array( $notice, self::get_notice_state(), true ) ) {
|
51 |
+
self::$notice_state[] = $notice;
|
52 |
+
self::save_notice_state();
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Remove a notice from those displayed in WP admin.
|
58 |
+
*
|
59 |
+
* @since 0.9.0
|
60 |
+
*
|
61 |
+
* @param string $notice Name of the notice.
|
62 |
+
*/
|
63 |
+
public static function remove_notice( $notice ) {
|
64 |
+
$notice_state = self::get_notice_state();
|
65 |
+
$notice = sanitize_key( $notice );
|
66 |
+
|
67 |
+
$notice_key = array_search( $notice, $notice_state, true );
|
68 |
+
if ( false !== $notice_key ) {
|
69 |
+
unset( $notice_state[ $notice_key ] );
|
70 |
+
self::$notice_state = array_values( $notice_state );
|
71 |
+
self::save_notice_state();
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Clears all enqueued notices.
|
77 |
+
*/
|
78 |
+
public static function reset_notices() {
|
79 |
+
self::$notice_state = array();
|
80 |
+
self::save_notice_state();
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Check for a notice to be displayed in WP admin.
|
85 |
+
*
|
86 |
+
* @since 0.9.0
|
87 |
+
*
|
88 |
+
* @param string $notice Name of the notice. Name is not sanitized for this method.
|
89 |
+
* @return bool
|
90 |
+
*/
|
91 |
+
public static function has_notice( $notice ) {
|
92 |
+
$notice_state = self::get_notice_state();
|
93 |
+
return in_array( $notice, $notice_state, true );
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Set up filters for core admin notices.
|
98 |
+
*
|
99 |
+
* Note: For internal use only. Do not call manually.
|
100 |
+
*/
|
101 |
+
public static function init_core_notices() {
|
102 |
+
// core_setup: Notice is used when first activating plugin.
|
103 |
+
add_action( 'crowdsignal_forms_admin_notice_' . self::NOTICE_CORE_SETUP, array( __CLASS__, 'display_core_setup' ) );
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Dismiss notices as requested by user. Inspired by WooCommerce's approach.
|
108 |
+
*/
|
109 |
+
public static function dismiss_notices() {
|
110 |
+
if ( isset( $_GET['crowdsignal_forms_hide_notice'] ) && isset( $_GET['_crowdsignal_forms_notice_nonce'] ) ) {
|
111 |
+
if ( ! wp_verify_nonce( wp_unslash( $_GET['_crowdsignal_forms_notice_nonce'] ), 'crowdsignal_forms_hide_notices_nonce' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Nonce should not be modified.
|
112 |
+
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'crowdsignal-forms' ) );
|
113 |
+
}
|
114 |
+
|
115 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
116 |
+
wp_die( esc_html__( 'You don’t have permission to do this.', 'crowdsignal-forms' ) );
|
117 |
+
}
|
118 |
+
|
119 |
+
$hide_notice = sanitize_key( wp_unslash( $_GET['crowdsignal_forms_hide_notice'] ) );
|
120 |
+
self::remove_notice( $hide_notice );
|
121 |
+
|
122 |
+
wp_safe_redirect( remove_query_arg( array( 'crowdsignal_forms_hide_notice', '_crowdsignal_forms_notice_nonce' ) ) );
|
123 |
+
exit;
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Displays notices in WP admin.
|
129 |
+
*
|
130 |
+
* Note: For internal use only. Do not call manually.
|
131 |
+
*/
|
132 |
+
public static function display_notices() {
|
133 |
+
/**
|
134 |
+
* Allows crowdsignal related plugins to set up their notice hooks.
|
135 |
+
*
|
136 |
+
* @since 0.9.0
|
137 |
+
*/
|
138 |
+
do_action( 'crowdsignal_forms_init_admin_notices' );
|
139 |
+
$notice_state = self::get_notice_state();
|
140 |
+
foreach ( $notice_state as $notice ) {
|
141 |
+
/**
|
142 |
+
* Allows suppression of individual admin notices.
|
143 |
+
*
|
144 |
+
* @since 0.9.0
|
145 |
+
*
|
146 |
+
* @param bool $do_show_notice Set to false to prevent an admin notice from showing up.
|
147 |
+
*/
|
148 |
+
|
149 |
+
if ( ! apply_filters( 'crowdsignal_forms_show_admin_notice_' . $notice, true ) ) {
|
150 |
+
continue;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Handle the display of the admin notice.
|
155 |
+
*
|
156 |
+
* @since 0.9.0
|
157 |
+
*/
|
158 |
+
do_action( 'crowdsignal_forms_admin_notice_' . $notice );
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Helper for display functions to check if current request is for admin on a Crowdsignal screen.
|
164 |
+
*
|
165 |
+
* @param array $additional_screens Screen IDs to also show a notice on.
|
166 |
+
* @return bool
|
167 |
+
*/
|
168 |
+
public static function is_admin_on_standard_crowdsignal_screen( $additional_screens = array() ) {
|
169 |
+
$screen = get_current_screen();
|
170 |
+
$screen_id = $screen ? $screen->id : '';
|
171 |
+
$show_on_screens = array_merge( array( 'crowdsignal-forms' ), $additional_screens );
|
172 |
+
|
173 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
174 |
+
return false;
|
175 |
+
}
|
176 |
+
|
177 |
+
if ( ! in_array( $screen_id, $show_on_screens, true ) ) {
|
178 |
+
return false;
|
179 |
+
}
|
180 |
+
|
181 |
+
return true;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Displays the setup wizard notice when crowdsignal is first activated.
|
186 |
+
*
|
187 |
+
* Note: For internal use only. Do not call manually.
|
188 |
+
*/
|
189 |
+
public static function display_core_setup() {
|
190 |
+
if ( ! self::is_admin_on_standard_crowdsignal_screen( array( 'plugins', 'dashboard' ) ) ) {
|
191 |
+
return;
|
192 |
+
}
|
193 |
+
include dirname( __FILE__ ) . '/views/html-admin-notice-core-setup.php';
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Displays a success notification after API Key setup
|
198 |
+
*/
|
199 |
+
public static function display_setup_success() {
|
200 |
+
include dirname( __FILE__ ) . '/views/html-admin-notice-setup-success.php';
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Gets the current admin notices to be displayed.
|
205 |
+
*
|
206 |
+
* @return array
|
207 |
+
*/
|
208 |
+
private static function get_notice_state() {
|
209 |
+
if ( null === self::$notice_state ) {
|
210 |
+
self::$notice_state = json_decode( get_option( self::STATE_OPTION, '[]' ), true );
|
211 |
+
if ( ! is_array( self::$notice_state ) ) {
|
212 |
+
self::$notice_state = array();
|
213 |
+
}
|
214 |
+
}
|
215 |
+
return self::$notice_state;
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Saves the notice state on shutdown.
|
220 |
+
*/
|
221 |
+
private static function save_notice_state() {
|
222 |
+
if ( null === self::$notice_state ) {
|
223 |
+
return;
|
224 |
+
}
|
225 |
+
|
226 |
+
update_option( self::STATE_OPTION, wp_json_encode( self::get_notice_state() ), false );
|
227 |
+
}
|
228 |
+
}
|
includes/admin/class-crowdsignal-forms-admin.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the class Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin.
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Admin
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Admin;
|
10 |
+
|
11 |
+
use Crowdsignal_Forms\Admin\Crowdsignal_Forms_Setup;
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Handles front admin page for Crowdsignal.
|
19 |
+
*
|
20 |
+
* @since 0.9.0
|
21 |
+
*/
|
22 |
+
class Crowdsignal_Forms_Admin {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The settings class.
|
26 |
+
*
|
27 |
+
* @var Crowdsignal_Forms_Settings
|
28 |
+
* @since 0.9.0
|
29 |
+
*/
|
30 |
+
private $settings_page = null;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The setup page
|
34 |
+
*
|
35 |
+
* @var Crowdsignal_Admin
|
36 |
+
*/
|
37 |
+
private $setup_page = null;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Constructor.
|
41 |
+
*/
|
42 |
+
public function __construct() {
|
43 |
+
|
44 |
+
$this->setup_page = new Crowdsignal_Forms_Setup();
|
45 |
+
$this->settings_page = new Crowdsignal_Forms_Settings();
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Set up actions during admin initialization.
|
50 |
+
*
|
51 |
+
* @todo for future use
|
52 |
+
*/
|
53 |
+
public function admin_init() {
|
54 |
+
add_filter( 'plugin_action_links_' . plugin_basename( CROWDSIGNAL_FORMS_PLUGIN_FILE ), array( $this, 'plugin_action_links' ) );
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Enqueues CSS and JS assets.
|
59 |
+
*
|
60 |
+
* @todo for future use
|
61 |
+
*/
|
62 |
+
public function admin_enqueue_scripts() {
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Adds pages to admin menu.
|
67 |
+
*/
|
68 |
+
public function admin_menu() {
|
69 |
+
$icon_encoded = 'PHN2ZyBpZD0iY29udGVudCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMjg4IDIyMCI+PGRlZnM+PHN0eWxlPi5jbHMtMXtmaWxsOiNGRkZGRkY7fTwvc3R5bGU+PC9kZWZzPjx0aXRsZT5pY29uLWJsdWU8L3RpdGxlPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTI2Mi40MSw4MC4xYy04LjQ3LTIyLjU1LTE5LjA1LTQyLjgzLTI5Ljc5LTU3LjFDMjIwLjc0LDcuMjQsMjEwLC41NywyMDEuNDcsMy43OWExMi4zMiwxMi4zMiwwLDAsMC0zLjcyLDIuM2wtLjA1LS4xNUwxNiwxNzMuOTRsOC4yLDE5LjEyLDMwLjU2LTEuOTJ2MTMuMDVhMTIuNTcsMTIuNTcsMCwwLDAsMTIuNTgsMTIuNTZjLjMzLDAsLjY3LDAsMSwwbDU4Ljg1LTQuNzdhMTIuNjUsMTIuNjUsMCwwLDAsMTEuNTYtMTIuNTNWMTg1Ljg2bDEyMS40NS03LjY0YTEzLjg4LDEzLjg4LDAsMCwwLDIuMDkuMjYsMTIuMywxMi4zLDAsMCwwLDQuNDEtLjhDMjg1LjMzLDE3MC43LDI3OC42MywxMjMuMzEsMjYyLjQxLDgwLjFabS0yLjI2LDg5Ljc3Yy0xMC40OC0zLjI1LTMwLjQ0LTI4LjE1LTQ2LjY4LTcxLjM5LTE1LjcyLTQxLjktMTcuNS03My4yMS0xMi4zNC04My41NGE2LjUyLDYuNTIsMCwwLDEsMy4yMi0zLjQ4LDMuODIsMy44MiwwLDAsMSwxLjQxLS4yNGMzLjg1LDAsMTAuOTQsNC4yNiwyMC4zMSwxNi43MUMyMzYuMzYsNDEuNTksMjQ2LjU0LDYxLjE1LDI1NC43NCw4M2MxOC40NCw0OS4xMiwxNy43NCw4My43OSw5LjEzLDg3QTUuOTMsNS45MywwLDAsMSwyNjAuMTUsMTY5Ljg3Wk0xMzAuNiwxOTkuNDFhNC40LDQuNCwwLDAsMS00LDQuMzdsLTU4Ljg1LDQuNzdBNC4zOSw0LjM5LDAsMCwxLDYzLDIwNC4xOVYxOTAuNjJsNjcuNjEtNC4yNVoiLz48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik02LDE4NS4yNmExMC4yNSwxMC4yNSwwLDAsMCwxMC4yNSwxMC4yNSwxMC4wNSwxMC4wNSwwLDAsMCw0LjM0LTFsLTcuOTQtMTguNzNBMTAuMiwxMC4yLDAsMCwwLDYsMTg1LjI2WiIvPjwvc3ZnPgo=';
|
70 |
+
add_menu_page( __( 'Crowdsignal', 'crowdsignal-forms' ), __( 'Crowdsignal', 'crowdsignal-forms' ), 'manage_options', 'crowdsignal-forms', array( $this->settings_page, 'output' ), 'data:image/svg+xml;base64,' . $icon_encoded );
|
71 |
+
add_submenu_page( 'crowdsignal-forms', __( 'Settings', 'crowdsignal-forms' ), __( 'Settings', 'crowdsignal-forms' ), 'manage_options', 'crowdsignal-forms-settings', array( $this->settings_page, 'output' ) );
|
72 |
+
add_submenu_page( 'crowdsignal-forms', __( 'Getting Started', 'crowdsignal-forms' ), __( 'Getting Started', 'crowdsignal-forms' ), 'manage_options', 'crowdsignal-forms-setup', array( $this->setup_page, 'setup_page' ) );
|
73 |
+
remove_submenu_page( 'crowdsignal-forms', 'crowdsignal-forms' );
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Adds to the Action links in the plugin page.
|
78 |
+
*
|
79 |
+
* @param array $links
|
80 |
+
* @return array
|
81 |
+
*/
|
82 |
+
public function plugin_action_links( $links ) {
|
83 |
+
return array_merge(
|
84 |
+
array(
|
85 |
+
sprintf( '<a href="%s">' . __( 'Getting Started', 'crowdsignal-forms' ) . '</a>', admin_url( 'admin.php?page=crowdsignal-forms-setup' ) ),
|
86 |
+
sprintf( '<a href="%s">' . __( 'Settings', 'crowdsignal-forms' ) . '</a>', admin_url( 'admin.php?page=crowdsignal-forms-settings' ) ),
|
87 |
+
),
|
88 |
+
$links
|
89 |
+
);
|
90 |
+
}
|
91 |
+
}
|
includes/admin/class-crowdsignal-forms-settings.php
ADDED
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the class Crowdsignal_Forms\Admin\Crowdsignal_Forms_Settings.
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Admin
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Admin;
|
10 |
+
|
11 |
+
use Crowdsignal_Forms\Auth\Crowdsignal_Forms_Api_Authenticator;
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Handles the management of plugin settings.
|
19 |
+
*
|
20 |
+
* @since 0.9.0
|
21 |
+
*/
|
22 |
+
class Crowdsignal_Forms_Settings {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Our Settings.
|
26 |
+
*
|
27 |
+
* @var array Settings.
|
28 |
+
*/
|
29 |
+
protected $settings = array();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor.
|
33 |
+
*/
|
34 |
+
public function __construct() {
|
35 |
+
$this->settings_group = 'crowdsignal-forms';
|
36 |
+
add_action( 'admin_init', array( $this, 'update_settings' ) );
|
37 |
+
|
38 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 12 );
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Enqueues scripts for setup page.
|
43 |
+
*/
|
44 |
+
public function admin_enqueue_scripts() {
|
45 |
+
wp_enqueue_style( 'admin-styles', plugin_dir_url( __FILE__ ) . '/admin-styles.css', array(), '0.9' );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get Crowdsignal Settings
|
50 |
+
*
|
51 |
+
* @return array
|
52 |
+
*/
|
53 |
+
public function get_settings() {
|
54 |
+
if ( 0 === count( $this->settings ) ) {
|
55 |
+
$this->init_settings();
|
56 |
+
}
|
57 |
+
return $this->settings;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Initializes the configuration for the plugin's setting fields.
|
62 |
+
*
|
63 |
+
* @access protected
|
64 |
+
*/
|
65 |
+
protected function init_settings() {
|
66 |
+
|
67 |
+
$this->settings = apply_filters(
|
68 |
+
'crowdsignal_forms_settings',
|
69 |
+
array(
|
70 |
+
'general' => array(
|
71 |
+
__( 'General', 'crowdsignal-forms' ),
|
72 |
+
array(
|
73 |
+
array(
|
74 |
+
'name' => 'crowdsignal_api_key',
|
75 |
+
'std' => '',
|
76 |
+
'label' => __( 'Enter Crowdsignal API Key', 'crowdsignal-forms' ),
|
77 |
+
'attributes' => array(),
|
78 |
+
),
|
79 |
+
),
|
80 |
+
),
|
81 |
+
)
|
82 |
+
);
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Registers the plugin's settings with WordPress's Settings API.
|
87 |
+
*/
|
88 |
+
public function register_settings() {
|
89 |
+
$this->init_settings();
|
90 |
+
|
91 |
+
foreach ( $this->settings as $section ) {
|
92 |
+
foreach ( $section[1] as $option ) {
|
93 |
+
if ( isset( $option['std'] ) ) {
|
94 |
+
add_option( $option['name'], $option['std'] );
|
95 |
+
}
|
96 |
+
register_setting( $this->settings_group, $option['name'] );
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Disconnect from Crowdsignal if required.
|
103 |
+
*/
|
104 |
+
public function update_settings() {
|
105 |
+
if ( ! isset( $_GET['page'] ) || 'crowdsignal-forms-settings' !== $_GET['page'] ) {
|
106 |
+
return;
|
107 |
+
}
|
108 |
+
|
109 |
+
if (
|
110 |
+
isset( $_POST['action'] ) &&
|
111 |
+
isset( $_POST['crowdsignal_api_key'] ) &&
|
112 |
+
isset( $_POST['_wpnonce'] )
|
113 |
+
) {
|
114 |
+
$api_auth_provider = new Crowdsignal_Forms_Api_Authenticator();
|
115 |
+
if ( 'update' === $_POST['action'] ) {
|
116 |
+
if ( wp_verify_nonce( sanitize_key( $_POST['_wpnonce'] ), 'add-api-key' ) ) {
|
117 |
+
$api_key = sanitize_key( wp_unslash( $_POST['crowdsignal_api_key'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- got_api_key
|
118 |
+
if ( $api_auth_provider->get_user_code_for_key( $api_key ) ) {
|
119 |
+
$api_auth_provider->set_api_key( $api_key );
|
120 |
+
wp_safe_redirect( admin_url( 'admin.php?page=crowdsignal-forms-settings&msg=api-key-added' ) );
|
121 |
+
} else {
|
122 |
+
wp_safe_redirect( admin_url( 'admin.php?page=crowdsignal-forms-settings&msg=api-key-not-added' ) );
|
123 |
+
}
|
124 |
+
} else {
|
125 |
+
wp_safe_redirect( admin_url( 'admin.php?page=crowdsignal-forms-settings&msg=bad-nonce' ) );
|
126 |
+
}
|
127 |
+
} elseif ( 'disconnect' === $_POST['action'] ) {
|
128 |
+
if ( ! wp_verify_nonce( sanitize_key( $_POST['_wpnonce'] ), 'disconnect-api-key' ) ) {
|
129 |
+
wp_safe_redirect( admin_url( 'admin.php?page=crowdsignal-forms-settings&msg=disconnect-failed' ) );
|
130 |
+
} else {
|
131 |
+
$api_auth_provider->delete_api_key();
|
132 |
+
$api_auth_provider->delete_user_code();
|
133 |
+
wp_safe_redirect( admin_url( 'admin.php?page=crowdsignal-forms-settings&msg=disconnected' ) );
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Shows the plugin's settings page.
|
141 |
+
*/
|
142 |
+
public function output() {
|
143 |
+
$this->init_settings();
|
144 |
+
include dirname( __FILE__ ) . '/views/html-admin-setup-header.php';
|
145 |
+
?>
|
146 |
+
<div class="wrap crowdsignal-settings-wrap">
|
147 |
+
|
148 |
+
<div class="crowdsignal-settings__main-content">
|
149 |
+
<div class="dops-card dops-section-header is-compact">
|
150 |
+
<div class="dops-section-header__label">
|
151 |
+
<span class="dops-section-header__label-text">Settings</span>
|
152 |
+
</div>
|
153 |
+
</div>
|
154 |
+
|
155 |
+
<div class="dops-card dops-section-header is-compact">
|
156 |
+
|
157 |
+
<div class="crowdsignal-settings__middle">
|
158 |
+
<div class="crowdsignal-settings__text">
|
159 |
+
<?php
|
160 |
+
echo wp_kses_post(
|
161 |
+
sprintf(
|
162 |
+
/* translators: %s is a link to the Crowdsignal connection page. */
|
163 |
+
__( 'To collect responses and data with Crowdsignal Forms you need to <a href="%s" target="_blank">connect the plugin with a Crowdsignal account.</a>', 'crowdsignal-forms' ),
|
164 |
+
'/wp-admin/admin.php?page=crowdsignal-forms-setup'
|
165 |
+
)
|
166 |
+
);
|
167 |
+
?>
|
168 |
+
<br>
|
169 |
+
<?php esc_html_e( 'You can do this by entering an API key below:', 'crowdsignal-forms' ); ?>
|
170 |
+
</div>
|
171 |
+
|
172 |
+
<form class="crowdsignal-options" method="post" action="<?php echo esc_url( admin_url( 'admin.php?page=crowdsignal-forms-settings' ) ); ?>">
|
173 |
+
<?php
|
174 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Used for basic flow.
|
175 |
+
if ( ! empty( $_GET['settings-updated'] ) ) {
|
176 |
+
echo '<div class="updated fade crowdsignal-updated"><p>' . esc_html__( 'Settings successfully saved', 'crowdsignal-forms' ) . '</p></div>';
|
177 |
+
}
|
178 |
+
|
179 |
+
$api_auth_provider = new Crowdsignal_Forms_Api_Authenticator();
|
180 |
+
?>
|
181 |
+
<div id="settings-general" class="settings_panel">
|
182 |
+
<table class="form-table settings parent-settings">
|
183 |
+
<tr valign="top" class="">
|
184 |
+
<th scope="row"><label for="setting-crowdsignal_api_key"><?php esc_html_e( 'Enter Crowdsignal API Key', 'crowdsignal-forms' ); ?></a></th>
|
185 |
+
<td><input
|
186 |
+
<?php echo $api_auth_provider->get_api_key() ? 'readonly' : ''; ?>
|
187 |
+
id="setting-crowdsignal_api_key"
|
188 |
+
class="regular-text"
|
189 |
+
type="text"
|
190 |
+
name="crowdsignal_api_key"
|
191 |
+
value="<?php echo esc_attr( $api_auth_provider->get_api_key() ); ?>"
|
192 |
+
/>
|
193 |
+
</td>
|
194 |
+
</tr>
|
195 |
+
</table>
|
196 |
+
</div>
|
197 |
+
|
198 |
+
<div class="crowdsignal-settings__submit">
|
199 |
+
<?php
|
200 |
+
if ( $api_auth_provider->get_api_key() ) {
|
201 |
+
wp_nonce_field( 'disconnect-api-key' );
|
202 |
+
?>
|
203 |
+
<input type="hidden" name="action" value="disconnect" />
|
204 |
+
<input type="submit" class="button-primary" value="<?php esc_attr_e( 'Disconnect', 'crowdsignal-forms' ); ?>" />
|
205 |
+
<?php
|
206 |
+
} else {
|
207 |
+
wp_nonce_field( 'add-api-key' );
|
208 |
+
?>
|
209 |
+
<input type="hidden" name="action" value="update" />
|
210 |
+
<input type="submit" class="button-primary" value="<?php esc_attr_e( 'Connect', 'crowdsignal-forms' ); ?>" />
|
211 |
+
<?php
|
212 |
+
}
|
213 |
+
?>
|
214 |
+
</div>
|
215 |
+
</form>
|
216 |
+
|
217 |
+
<div class="crowdsignal-settings__bottom">
|
218 |
+
<div class="crowdsignal-settings__text">
|
219 |
+
<?php
|
220 |
+
if ( ! get_option( Crowdsignal_Forms_Api_Authenticator::API_KEY_NAME ) ) {
|
221 |
+
esc_html_e( "If you don't have an API key we can help you here:", 'crowdsignal-forms' );
|
222 |
+
echo '<a class="button crowdsignal-settings__cta" rel="noopener noreferrer" href="/wp-admin/admin.php?page=crowdsignal-forms-setup">Get an API Key</a>';
|
223 |
+
}
|
224 |
+
?>
|
225 |
+
|
226 |
+
</div>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
</div>
|
231 |
+
</div>
|
232 |
+
<?php
|
233 |
+
include dirname( __FILE__ ) . '/views/html-admin-setup-footer.php';
|
234 |
+
}
|
235 |
+
}
|
includes/admin/class-crowdsignal-forms-setup.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the class Crowdsignal_Forms_Setup.
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Admin
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Crowdsignal_Forms\Admin;
|
9 |
+
|
10 |
+
use Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin_Notices;
|
11 |
+
use Crowdsignal_Forms\Auth\Crowdsignal_Forms_Api_Authenticator;
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Handles initial environment setup after plugin is first activated.
|
19 |
+
*
|
20 |
+
* @since 0.9.0
|
21 |
+
*/
|
22 |
+
class Crowdsignal_Forms_Setup {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Constructor.
|
26 |
+
*/
|
27 |
+
public function __construct() {
|
28 |
+
add_filter( 'crowdsignal_forms_show_admin_notice_' . Crowdsignal_Forms_Admin_Notices::NOTICE_CORE_SETUP, array( $this, 'show_setup_notice' ) );
|
29 |
+
add_filter( 'crowdsignal_forms_show_admin_notice_' . Crowdsignal_Forms_Admin_Notices::SETUP_SUCCESS, array( $this, 'show_setup_success' ) );
|
30 |
+
Crowdsignal_Forms_Admin_Notices::add_notice( Crowdsignal_Forms_Admin_Notices::SETUP_SUCCESS );
|
31 |
+
|
32 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Input is used safely.
|
33 |
+
if ( isset( $_GET['page'] ) && 'crowdsignal-forms-setup' === $_GET['page'] ) {
|
34 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 12 );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Hides the "Getting Started" admin notice if the plugin is already connected to Crowdsignal.
|
40 |
+
*
|
41 |
+
* @param bool $show to show the notice or not.
|
42 |
+
*/
|
43 |
+
public function show_setup_notice( $show ) {
|
44 |
+
$api_auth_provider = new Crowdsignal_Forms_Api_Authenticator();
|
45 |
+
if ( $api_auth_provider->get_user_code() ) {
|
46 |
+
return false;
|
47 |
+
} else {
|
48 |
+
return true;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Filter admin notice if the plugin has just finished step 3 successfully.
|
54 |
+
*
|
55 |
+
* @param bool $show to show the notice or not.
|
56 |
+
*/
|
57 |
+
public function show_setup_success( $show ) {
|
58 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- readonly, boolean check
|
59 |
+
return isset( $_GET['msg'] ) && 'connect' === $_GET['msg'];
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Enqueues scripts for setup page.
|
64 |
+
*/
|
65 |
+
public function admin_enqueue_scripts() {
|
66 |
+
wp_enqueue_style( 'admin-styles', plugin_dir_url( __FILE__ ) . '/admin-styles.css', array(), '0.9' );
|
67 |
+
wp_enqueue_script( 'videopress', 'https://videopress.com/videopress-iframe.js', array(), '1.0', false );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Handle request to the setup page.
|
72 |
+
*/
|
73 |
+
public function setup_page() {
|
74 |
+
|
75 |
+
$api_auth_provider = new Crowdsignal_Forms_Api_Authenticator();
|
76 |
+
|
77 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- got_api_key check later
|
78 |
+
$step = ! empty( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
|
79 |
+
if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' === $_SERVER['REQUEST_METHOD'] ) {
|
80 |
+
if ( 2 === $step && isset( $_POST['got_api_key'] ) && isset( $_POST['api_key'] ) && get_option( 'crowdsignal_api_key_secret' ) === $_POST['got_api_key'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- got_api_key
|
81 |
+
$api_key = sanitize_key( wp_unslash( $_POST['api_key'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- got_api_key
|
82 |
+
$api_auth_provider->set_api_key( $api_key );
|
83 |
+
$api_auth_provider->get_user_code_for_key( $api_key );
|
84 |
+
delete_option( 'crowdsignal_api_key_secret' );
|
85 |
+
} else {
|
86 |
+
$step = 1; // repeat the setup.
|
87 |
+
}
|
88 |
+
} elseif ( 1 === $step ) {
|
89 |
+
update_option( 'crowdsignal_api_key_secret', md5( time() . wp_rand() ) );
|
90 |
+
|
91 |
+
$existing_api_key = $api_auth_provider->get_api_key();
|
92 |
+
if ( ! $existing_api_key ) {
|
93 |
+
$existing_api_key = get_option( 'polldaddy_api_key' );
|
94 |
+
$api_auth_provider->set_api_key( $existing_api_key );
|
95 |
+
}
|
96 |
+
|
97 |
+
if ( $existing_api_key ) {
|
98 |
+
$existing_user_code = $api_auth_provider->get_user_code_for_key( $existing_api_key );
|
99 |
+
|
100 |
+
if ( $existing_user_code ) {
|
101 |
+
if ( $api_auth_provider->get_user_code() !== $existing_user_code ) {
|
102 |
+
$api_auth_provider->set_user_code( $existing_user_code );
|
103 |
+
}
|
104 |
+
delete_option( 'crowdsignal_api_key_secret' );
|
105 |
+
$step = 3;
|
106 |
+
} else {
|
107 |
+
/**
|
108 |
+
* Cached API key may have been deleted on the server.
|
109 |
+
* Force reconnection.
|
110 |
+
*/
|
111 |
+
$api_auth_provider->delete_api_key();
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
// we're all done, remove the notice.
|
117 |
+
if ( 1 !== $step ) {
|
118 |
+
Crowdsignal_Forms_Admin_Notices::remove_notice( Crowdsignal_Forms_Admin_Notices::NOTICE_CORE_SETUP );
|
119 |
+
}
|
120 |
+
|
121 |
+
$this->output( $step );
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Displays setup page.
|
126 |
+
*
|
127 |
+
* @param int $step the step shown to the user.
|
128 |
+
*/
|
129 |
+
public function output( $step ) {
|
130 |
+
include dirname( __FILE__ ) . '/views/html-admin-setup-header.php';
|
131 |
+
if ( 1 === $step ) {
|
132 |
+
include dirname( __FILE__ ) . '/views/html-admin-setup-step-1.php';
|
133 |
+
} elseif ( 2 === $step ) {
|
134 |
+
include dirname( __FILE__ ) . '/views/html-admin-setup-step-2.php';
|
135 |
+
} elseif ( 3 === $step ) {
|
136 |
+
include dirname( __FILE__ ) . '/views/html-admin-setup-step-3.php';
|
137 |
+
}
|
138 |
+
include dirname( __FILE__ ) . '/views/html-admin-setup-footer.php';
|
139 |
+
}
|
140 |
+
}
|
includes/admin/index.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// phpcs:ignoreFile -- Silence is golden.
|
includes/admin/views/html-admin-notice-core-setup.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the view for displaying the admin notice when user first activates crowdsignal.
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Admin
|
6 |
+
*/
|
7 |
+
|
8 |
+
use Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin_Notices;
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
exit;
|
12 |
+
}
|
13 |
+
?>
|
14 |
+
<div class="updated crowdsignal-message">
|
15 |
+
<p>
|
16 |
+
<?php
|
17 |
+
echo wp_kses_post( __( 'You are nearly ready to start creating polls with <strong>Crowdsignal</strong>.', 'crowdsignal-forms' ) );
|
18 |
+
?>
|
19 |
+
</p>
|
20 |
+
<p class="submit">
|
21 |
+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=crowdsignal-forms-setup' ) ); ?>" class="button-primary"><?php esc_html_e( "Let's Get Started", 'crowdsignal-forms' ); ?></a>
|
22 |
+
<a class="button-secondary skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'crowdsignal_forms_hide_notice', Crowdsignal_Forms_Admin_Notices::NOTICE_CORE_SETUP ), 'crowdsignal_forms_hide_notices_nonce', '_crowdsignal_forms_notice_nonce' ) ); ?>"><?php esc_html_e( 'Skip Setup', 'crowdsignal-forms' ); ?></a>
|
23 |
+
</p>
|
24 |
+
</div>
|
includes/admin/views/html-admin-setup-footer.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the view used in the footer of the setup pages.
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Admin
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
?>
|
12 |
+
|
13 |
+
<div class="crowdsignal-setup__footer">
|
14 |
+
<div class="crowdsignal-setup__footer-container">
|
15 |
+
<a href="#">
|
16 |
+
<svg role="img" class="crowdsignal-setup__footer-attr" x="0" y="0" viewBox="0 0 935 38.2" enable-background="new 0 0 935 38.2" aria-labelledby="a8c-svg-title">
|
17 |
+
<title id="a8c-svg-title">An Automattic Adventure</title>
|
18 |
+
<path d="M317.1 38.2c-12.6 0-20.7-9.1-20.7-18.5v-1.2c0-9.6 8.2-18.5 20.7-18.5 12.6 0 20.8 8.9 20.8 18.5v1.2C337.9 29.1 329.7 38.2 317.1 38.2zM331.2 18.6c0-6.9-5-13-14.1-13s-14 6.1-14 13v0.9c0 6.9 5 13.1 14 13.1s14.1-6.2 14.1-13.1V18.6zM175 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7L157 1.3h5.5L182 36.8H175zM159.7 8.2L152 23.1h15.7L159.7 8.2zM212.4 38.2c-12.7 0-18.7-6.9-18.7-16.2V1.3h6.6v20.9c0 6.6 4.3 10.5 12.5 10.5 8.4 0 11.9-3.9 11.9-10.5V1.3h6.7V22C231.4 30.8 225.8 38.2 212.4 38.2zM268.6 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H268.6zM397.3 36.8V8.7l-1.8 3.1 -14.9 25h-3.3l-14.7-25 -1.8-3.1v28.1h-6.5V1.3h9.2l14 24.4 1.7 3 1.7-3 13.9-24.4h9.1v35.5H397.3zM454.4 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7l19.2-35.5h5.5l19.5 35.5H454.4zM439.1 8.2l-7.7 14.9h15.7L439.1 8.2zM488.4 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H488.4zM537.3 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H537.3zM569.3 36.8V4.6c2.7 0 3.7-1.4 3.7-3.4h2.8v35.5L569.3 36.8 569.3 36.8zM628 11.3c-3.2-2.9-7.9-5.7-14.2-5.7 -9.5 0-14.8 6.5-14.8 13.3v0.7c0 6.7 5.4 13 15.3 13 5.9 0 10.8-2.8 13.9-5.7l4 4.2c-3.9 3.8-10.5 7.1-18.3 7.1 -13.4 0-21.6-8.7-21.6-18.3v-1.2c0-9.6 8.9-18.7 21.9-18.7 7.5 0 14.3 3.1 18 7.1L628 11.3zM321.5 12.4c1.2 0.8 1.5 2.4 0.8 3.6l-6.1 9.4c-0.8 1.2-2.4 1.6-3.6 0.8l0 0c-1.2-0.8-1.5-2.4-0.8-3.6l6.1-9.4C318.7 11.9 320.3 11.6 321.5 12.4L321.5 12.4z"></path>
|
19 |
+
</svg>
|
20 |
+
</a>
|
21 |
+
</div>
|
22 |
+
<ul class="crowdsignal-setup__footer-links">
|
23 |
+
<li class="crowdsignal-setup__footer-item"><a href="https://crowdsignal.com" target="_blank" rel="noopener noreferrer" class="crowdsignal-setup__footer-link" title="Crowdsignal">Crowdsignal.com</a></li>
|
24 |
+
<li class="crowdsignal-setup__footer-item"><a href="https://crowdsignal.com/support" target="_blank" rel="noopener noreferrer" class="crowdsignal-setup__footer-link" title="<?php esc_html_e( 'Crowdsignal Support', 'crowdsignal-forms' ); ?>"><?php esc_html_e( 'Support', 'crowdsignal-forms' ); ?></a></li>
|
25 |
+
<li class="crowdsignal-setup__footer-item"><a href="https://crowdsignal.com/terms/" target="_blank" rel="noopener noreferrer" title="<?php esc_attr_e( 'Terms of Service', 'crowdsignal-forms' ); ?>" class="crowdsignal-setup__footer-link"><?php esc_html_e( 'Terms', 'crowdsignal-forms' ); ?></a></li>
|
26 |
+
<li class="crowdsignal-setup__footer-item"><a href="https://automattic.com/privacy/" target="_blank" rel="noopener noreferrer" title="<?php esc_attr_e( 'Privacy Policy', 'crowdsignal-forms' ); ?>" class="crowdsignal-setup__footer-link"><?php esc_html_e( 'Privacy', 'crowdsignal-forms' ); ?></a></li>
|
27 |
+
</ul>
|
28 |
+
</div>
|
29 |
+
|
30 |
+
</div> <!--.wrap-->
|
includes/admin/views/html-admin-setup-header.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the view used in the header of the setup pages.
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Admin
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
?>
|
12 |
+
<div class="wrap">
|
13 |
+
<div class="crowdsignal-setup__header">
|
14 |
+
<div class="crowdsignal-setup__header-container">
|
15 |
+
<div class="crowdsignal-setup__logo-container">
|
16 |
+
<div class="crowdsignal-setup__logo">
|
17 |
+
<svg width="199" height="48" viewBox="0 0 199 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
18 |
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.9981 45.1199C35.6624 45.1199 45.1181 35.6641 45.1181 23.9999C45.1181 12.3356 35.6624 2.87988 23.9981 2.87988C12.3339 2.87988 2.87811 12.3356 2.87811 23.9999C2.87811 35.6641 12.3339 45.1199 23.9981 45.1199Z" fill="white" stroke="#384869" stroke-linecap="round" stroke-dasharray="0.1 2"/>
|
19 |
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.0812 24.8962V17.3437C11.0812 16.4769 11.1073 15.9362 11.1595 15.7045C11.2117 15.4728 11.316 15.2496 11.5768 15.0694C11.8812 14.8463 12.2811 14.769 13.2897 14.769C14.1417 14.769 14.6025 14.8892 14.8373 15.0951C15.0807 15.3097 15.2199 15.7217 15.2199 16.3139V17.9102L14.5938 18.159V16.2967C14.5938 15.8676 14.5417 15.653 14.3765 15.5071C14.22 15.3612 13.9331 15.3183 13.2636 15.3183C12.4028 15.3183 12.1854 15.3869 12.0029 15.5157C11.7681 15.6873 11.7073 16.022 11.7073 16.6657V25.4626C11.7073 26.1063 11.7681 26.441 12.0029 26.6127C12.1854 26.7414 12.5767 26.8101 13.2636 26.8101C13.9331 26.8101 14.22 26.7672 14.3765 26.6212C14.5417 26.4753 14.5938 26.2608 14.5938 25.8316V23.8405L15.2199 23.5917V25.8145C15.2199 26.4153 15.0807 26.8186 14.8373 27.0332C14.6025 27.2392 14.1417 27.3593 13.2897 27.3593C12.455 27.3593 11.8812 27.2821 11.5768 27.0675C11.316 26.8787 11.2117 26.6641 11.1595 26.4238C11.1073 26.2093 11.0812 25.6944 11.0812 24.8962Z" fill="#4CCEE4"/>
|
20 |
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.5086 19.5755H16.8294V15.3203H18.7291C19.1446 15.3203 19.4329 15.3806 19.5602 15.5357C19.6704 15.6735 19.7468 15.9405 19.7468 16.3539V18.6452C19.7468 18.9897 19.645 19.2223 19.4923 19.3601C19.3227 19.5066 18.9835 19.5755 18.5086 19.5755ZM20.1623 19.4548C20.2725 19.2912 20.3574 19.0242 20.3574 18.6538V16.2075C20.3574 15.7079 20.2132 15.3462 19.9927 15.1308C19.7552 14.8896 19.3142 14.769 18.7206 14.769H16.2188V26.5009L16.8294 26.2511V20.1268H18.7969C19.3566 20.1268 19.645 20.4454 19.645 21.1001V25.1399L20.2556 24.8901V20.9536C20.2556 20.2732 19.9673 19.9114 19.3821 19.8683V19.8511C19.7552 19.7908 20.0266 19.6616 20.1623 19.4548Z" fill="#4CCEE4"/>
|
21 |
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.5846 21.5327C24.5846 22.1027 24.5326 22.426 24.3243 22.6047C24.1333 22.7663 23.8122 22.8088 23.2829 22.8088C22.7535 22.8088 22.4324 22.7663 22.2414 22.6047C22.0332 22.426 21.9811 22.1027 21.9811 21.5327V16.5897C21.9811 16.0197 22.0332 15.6964 22.2414 15.5177C22.4324 15.356 22.7535 15.3135 23.2829 15.3135C23.8122 15.3135 24.1333 15.356 24.3243 15.5177C24.5326 15.6964 24.5846 16.0197 24.5846 16.5897V21.5327ZM24.8103 15.1178C24.4892 14.8371 23.9598 14.769 23.2829 14.769C22.606 14.769 22.0765 14.8371 21.7555 15.1178C21.4778 15.3475 21.3563 15.7304 21.3563 16.36V21.7624C21.3563 22.392 21.4778 22.7748 21.7555 23.0045C22.0765 23.2853 22.606 23.3533 23.2829 23.3533C23.9598 23.3533 24.4892 23.2853 24.8103 23.0045C25.0879 22.7748 25.2095 22.392 25.2095 21.7624V16.36C25.2095 15.7304 25.0879 15.3475 24.8103 15.1178Z" fill="#4CCEE4"/>
|
22 |
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M27.5965 22.0657L25.7812 14.769H26.432L27.999 21.1666L29.5403 14.769H30.5078L31.9635 19.7401L33.2822 14.769H33.9158L32.4601 20.1464L31.5268 20.5095L30.0369 15.3396L28.4785 21.7112L27.5965 22.0657Z" fill="#4CCEE4"/>
|
23 |
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M35.7824 18.0921H34.9849V15.3089H35.7824C36.5097 15.3089 36.7375 15.604 36.7375 16.7005C36.7375 17.7885 36.5097 18.0921 35.7824 18.0921ZM35.6422 14.769H34.3453V18.632H35.6422C37.053 18.632 37.3422 18.0921 37.3422 16.7005C37.3422 15.3004 37.053 14.769 35.6422 14.769Z" fill="#4CCEE4"/>
|
24 |
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.7906 27.5999L17.3614 27.3594V33.5114H16.7906V27.5999Z" fill="#384869"/>
|
25 |
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M30.8547 28.4545L31.7639 23.1137L32.6646 28.4545H30.8547ZM32.1134 21.6362L31.4389 21.9089L29.3484 33.5102L30.0119 33.5111L30.7613 29.0041H32.7581L33.5358 33.5111H34.2006L32.1134 21.6362Z" fill="#384869"/>
|
26 |
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M35.8345 32.9636V22.2515V22.1157V20.2056L35.1984 20.4537V22.1157V22.2515V33.5112H37.3391V32.9636H35.8345Z" fill="#384869"/>
|
27 |
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M27.7402 23.4135L27.7853 29.284L27.8078 32.6993L26.5472 29.7696L24.5757 24.7024L23.639 25.0776V29.7696V29.7999V33.5116H24.2521V29.7999V29.7696V25.5211L25.8655 29.7696L27.4698 33.5116H28.3485V29.284V23.2104L27.7402 23.4135Z" fill="#384869"/>
|
28 |
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4219 31.1488V31.1487C14.2634 31.1486 14.1051 31.1486 13.9468 31.1486V31.1485C13.1929 31.1485 13.1655 31.1485 13.1383 31.1485C12.8903 31.1485 12.6651 31.1484 12.424 31.1484C11.856 31.1471 11.6428 31.1094 11.6428 30.4895C11.6428 29.9985 11.8088 29.9071 12.424 29.9006C12.688 29.9004 12.9521 29.9002 13.8863 29.9002C14.0627 29.9001 14.2408 29.9001 14.4219 29.9C15.0349 29.9017 15.1951 30.0672 15.1951 30.5415V30.611L15.7056 30.4028C15.6554 29.6702 15.3991 29.3732 14.4219 29.3629V29.3626C14.2417 29.3626 14.0665 29.3624 13.8863 29.3623C13.1928 29.3623 13.1659 29.3623 13.1383 29.3623C12.894 29.3623 12.6572 29.3625 12.4156 29.3626V29.3627C11.5506 29.37 11.0812 29.5968 11.0812 30.637C11.0812 31.6764 11.7439 31.6863 12.4156 31.6862H13.856H13.9468C14.1038 31.6862 14.2475 31.6864 14.4017 31.6864C14.98 31.6893 15.2291 31.799 15.2291 32.4405C15.2291 32.9597 15.1 33.1064 14.4017 33.1159C14.2177 33.116 14.0373 33.1162 13.856 33.1163C12.9479 33.1166 12.6893 33.1167 12.4156 33.1168V33.1169C11.7956 33.1165 11.5917 32.9083 11.5917 32.3451V32.2758L11.0812 32.4839C11.1316 33.304 11.4303 33.6441 12.4156 33.6539V33.6541C12.6578 33.6542 12.8921 33.6544 13.1383 33.6544C13.1658 33.6544 13.1928 33.6544 13.9166 33.6544V33.6544C14.0859 33.6543 14.2525 33.6542 14.4219 33.6541V33.6538C15.3635 33.6428 15.7907 33.3317 15.7907 32.2931C15.7907 31.2534 15.0954 31.1532 14.4219 31.1488Z" fill="#384869"/>
|
29 |
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.3547 27.7945V27.5274C22.3547 26.7263 21.9104 26.501 20.9381 26.501C20.9031 26.501 20.8689 26.5013 20.8349 26.5018C20.6928 26.5021 20.5528 26.5026 20.4133 26.503V26.5031C19.8616 26.5031 19.8466 26.5032 19.8322 26.5032C19.0096 26.5247 18.5015 26.7263 18.5015 27.7194V28.3739V30.5141V31.8367V31.903V32.3849C18.5015 33.0924 18.8059 33.4817 19.8322 33.5094C19.8467 33.5094 19.8615 33.5095 20.4133 33.5095C20.5524 33.5101 20.6914 33.5107 20.8349 33.5109C20.8525 33.5111 20.8698 33.5115 20.8878 33.5115C21.8434 33.5115 22.3547 33.3112 22.3547 32.3432V31.3731V31.3068V30.5141V30.4845V29.6611H20.8543V30.1952H21.7512V30.4845V30.5141V30.9299V31.3068V31.3731V32.2847C21.7512 32.8856 21.5752 32.9774 20.9045 32.9774C20.8804 32.9774 20.8579 32.9769 20.8349 32.9766C20.6995 32.9763 20.5715 32.9757 20.4432 32.9751V32.9749C19.8616 32.9749 19.847 32.9748 19.8322 32.9748C19.307 32.9577 19.1051 32.8226 19.1051 32.1679V31.903V31.8367V30.9299V30.5141V28.3739V27.8529C19.1051 27.1931 19.2212 27.0559 19.8322 27.0379C19.847 27.0379 19.8616 27.0378 20.4432 27.0377V27.0376C20.5713 27.037 20.6978 27.0364 20.8349 27.0361C20.8684 27.0356 20.9019 27.0351 20.9381 27.0351C21.5081 27.0351 21.8015 27.0685 21.8015 27.5441V28.0031L22.3547 27.7945Z" fill="#384869"/>
|
30 |
+
<path d="M66.0459 32.2578C69.709 32.2578 72.2441 30.249 72.7275 26.9297H70.0098C69.5801 28.7988 68.1084 29.9053 66.0566 29.9053C63.3711 29.9053 61.6738 27.7246 61.6738 24.2441C61.6738 20.7852 63.3818 18.5938 66.0459 18.5938C68.0547 18.5938 69.6338 19.8721 69.999 21.8164H72.7275C72.3838 18.4863 69.6445 16.2412 66.0459 16.2412C61.6416 16.2412 58.8379 19.3027 58.8379 24.2441C58.8379 29.2178 61.6201 32.2578 66.0459 32.2578ZM74.5645 32H77.2393V25.3721C77.2393 23.7715 78.1523 22.7939 79.667 22.7939C80.1182 22.7939 80.5264 22.8584 80.752 22.9443V20.5273C80.5586 20.4844 80.2578 20.4199 79.9141 20.4199C78.5713 20.4199 77.5723 21.2148 77.1855 22.6006H77.1318V20.6133H74.5645V32ZM86.7354 32.2256C90.0762 32.2256 92.2461 30.002 92.2461 26.3066C92.2461 22.6221 90.0547 20.377 86.7354 20.377C83.416 20.377 81.2246 22.6328 81.2246 26.3066C81.2246 30.002 83.3945 32.2256 86.7354 32.2256ZM86.7354 30.1094C85.0381 30.1094 83.9424 28.7344 83.9424 26.3066C83.9424 23.8896 85.0488 22.5039 86.7354 22.5039C88.4326 22.5039 89.5283 23.8896 89.5283 26.3066C89.5283 28.7344 88.4326 30.1094 86.7354 30.1094ZM109.348 20.6133H106.705L104.782 29.3574H104.718L102.494 20.6133H99.9268L97.7031 29.3574H97.6494L95.7266 20.6133H93.041L96.124 32H98.917L101.151 23.6748H101.205L103.45 32H106.265L109.348 20.6133ZM114.826 32.1826C116.491 32.1826 117.802 31.334 118.425 30.0557H118.468V32H121.089V16.499H118.414V22.5254H118.35C117.748 21.2686 116.459 20.4199 114.826 20.4199C111.958 20.4199 110.1 22.6973 110.1 26.2959C110.1 29.916 111.958 32.1826 114.826 32.1826ZM115.632 22.6221C117.318 22.6221 118.425 24.0723 118.425 26.3066C118.425 28.5625 117.318 29.9912 115.632 29.9912C113.902 29.9912 112.839 28.5732 112.839 26.3066C112.839 24.0508 113.913 22.6221 115.632 22.6221ZM123.13 23.8789C123.13 25.5225 124.193 26.6182 126.299 27.1123L128.372 27.5957C129.479 27.875 129.897 28.2295 129.897 28.8955C129.897 29.7441 129.092 30.2705 127.792 30.2705C126.438 30.2705 125.633 29.6904 125.472 28.6484H122.84C123.022 30.8076 124.838 32.2256 127.695 32.2256C130.574 32.2256 132.562 30.7754 132.562 28.627C132.562 26.9404 131.67 26.0596 129.393 25.5225L127.362 25.0713C126.245 24.8027 125.729 24.373 125.729 23.7285C125.729 22.9014 126.503 22.3428 127.685 22.3428C128.931 22.3428 129.715 22.9443 129.801 23.9219H132.293C132.229 21.8164 130.413 20.377 127.738 20.377C124.967 20.377 123.13 21.7949 123.13 23.8789ZM134.334 32H137.009V20.6133H134.334V32ZM135.666 19.1201C136.504 19.1201 137.159 18.4756 137.159 17.6699C137.159 16.8535 136.504 16.209 135.666 16.209C134.839 16.209 134.184 16.8535 134.184 17.6699C134.184 18.4756 134.839 19.1201 135.666 19.1201ZM144.281 29.8838C142.595 29.8838 141.521 28.5303 141.521 26.2744C141.521 24.04 142.595 22.6221 144.281 22.6221C145.989 22.6221 147.096 24.0615 147.096 26.2744C147.096 28.498 145.989 29.8838 144.281 29.8838ZM144.271 36.2969C147.59 36.2969 149.771 34.5352 149.771 31.8174V20.6133H147.149V22.5684H147.106C146.451 21.2578 145.141 20.4199 143.519 20.4199C140.607 20.4199 138.781 22.665 138.781 26.2637C138.781 29.8086 140.65 32.0107 143.465 32.0107C145.098 32.0107 146.44 31.1943 147.031 29.9697H147.096V31.8926C147.096 33.3428 146.097 34.3203 144.356 34.3203C143.089 34.3203 142.111 33.7295 141.821 32.8594H139.168C139.437 34.8574 141.456 36.2969 144.271 36.2969ZM151.951 32H154.626V25.4043C154.626 23.7715 155.604 22.665 157.14 22.665C158.665 22.665 159.417 23.5674 159.417 25.1787V32H162.092V24.6416C162.092 22.0098 160.663 20.3984 158.149 20.3984C156.398 20.3984 155.185 21.2148 154.572 22.5684H154.519V20.6133H151.951V32ZM168.397 30.1631C167.237 30.1631 166.464 29.5723 166.464 28.6377C166.464 27.7354 167.205 27.1553 168.494 27.0693L171.126 26.9082V27.7783C171.126 29.1533 169.912 30.1631 168.397 30.1631ZM167.592 32.1826C169.053 32.1826 170.481 31.4199 171.137 30.1846H171.19V32H173.769V24.1582C173.769 21.8701 171.932 20.377 169.106 20.377C166.206 20.377 164.391 21.9023 164.272 24.0293H166.754C166.926 23.084 167.731 22.4717 168.999 22.4717C170.32 22.4717 171.126 23.1592 171.126 24.3516V25.168L168.118 25.3398C165.347 25.5117 163.789 26.7256 163.789 28.7451C163.789 30.7969 165.39 32.1826 167.592 32.1826ZM176.003 32H178.678V16.499H176.003V32Z" fill="black"/>
|
31 |
+
</svg>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
</div>
|
36 |
+
|
37 |
+
<?php
|
38 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
39 |
+
if ( isset( $_GET['msg'] ) ) {
|
40 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
41 |
+
switch ( $_GET['msg'] ) {
|
42 |
+
case 'disconnect-fail':
|
43 |
+
echo '<div class="error fade crowdsignal-message"><p>' . esc_html__( 'Could not disconnect. Please try again.', 'crowdsignal-forms' ) . '</p></div>';
|
44 |
+
break;
|
45 |
+
case 'disconnected':
|
46 |
+
echo '<div class="updated fade crowdsignal-message"><p>' . esc_html__( 'Successfully disconnected from Crowdsignal.', 'crowdsignal-forms' ) . '</p></div>';
|
47 |
+
break;
|
48 |
+
case 'connect':
|
49 |
+
echo '<div class="updated crowdsignal-message"><p>' . esc_html__( 'Success! Your Crowdsignal account is successfully connected! You are ready!', 'crowdsignal-forms' ) . '</p></div>';
|
50 |
+
break;
|
51 |
+
case 'api-key-added':
|
52 |
+
echo '<div class="updated crowdsignal-message"><p>' . esc_html__( 'You have been connected to Crowdsignal.', 'crowdsignal-forms' ) . '</p></div>';
|
53 |
+
break;
|
54 |
+
case 'api-key-not-added':
|
55 |
+
echo '<div class="error fade crowdsignal-message"><p>' . esc_html__( 'Your API key has not been updated.', 'crowdsignal-forms' ) . '</p></div>';
|
56 |
+
break;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
?>
|
includes/admin/views/html-admin-setup-step-1.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the view for step 1 of the setup wizard.
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Admin
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
?>
|
12 |
+
<div class="crowdsignal-setup__main">
|
13 |
+
<div class="crowdsignal-setup__content">
|
14 |
+
<h3><?php esc_html_e( 'Welcome to Crowdsignal Forms', 'crowdsignal-forms' ); ?></h3>
|
15 |
+
|
16 |
+
<div class="crowdsignal-setup__description">
|
17 |
+
<p><?php echo wp_kses_post( 'To collect and manages respones you need to connect the plugin to <a href="https://crowdsignal.com">Crowdsignal</a>. <br />It will take less than a minute and it’s free.', 'crowdsignal-forms' ); ?></p>
|
18 |
+
</div>
|
19 |
+
|
20 |
+
<div class="wrap crowdsignal-settings-wrap">
|
21 |
+
<form id="cs-connect-form" class="crowdsignal-options" method="post" action="https://app.crowdsignal.com/get-api-key/" target="CSCONNECT">
|
22 |
+
<input type="hidden" name="get_api_key" value="<?php echo esc_attr( get_option( 'crowdsignal_api_key_secret' ) ); ?>" />
|
23 |
+
<input type="hidden" name="ref" value="<?php echo esc_attr( admin_url( 'admin.php?page=crowdsignal-forms-setup' ) ); ?>" />
|
24 |
+
<input type="submit" value="<?php esc_html_e( 'Let’s get started', 'crowdsignal-forms' ); ?>" class="crowdsignal-setup__button" />
|
25 |
+
</form>
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
+
</div>
|
29 |
+
|
30 |
+
<script>
|
31 |
+
let CSCONNECT = null;
|
32 |
+
const showConnect = ( title ) => {
|
33 |
+
// window size, match standard iPhone screen size
|
34 |
+
const widthRatio = 1/2;
|
35 |
+
const heightRatio = 3/4;
|
36 |
+
|
37 |
+
// Fixes dual-screen position
|
38 |
+
const dualScreenLeft = window.screenLeft !== undefined
|
39 |
+
? window.screenLeft // Most browsers
|
40 |
+
: window.screenX; // Firefox
|
41 |
+
const dualScreenTop = window.screenTop !== undefined
|
42 |
+
? window.screenTop // Most browsers
|
43 |
+
: window.screenY; // Firefox
|
44 |
+
|
45 |
+
const width = window.innerWidth
|
46 |
+
? window.innerWidth
|
47 |
+
: document.documentElement.clientWidth
|
48 |
+
? document.documentElement.clientWidth
|
49 |
+
: screen.width;
|
50 |
+
const height = window.innerHeight
|
51 |
+
? window.innerHeight
|
52 |
+
: document.documentElement.clientHeight
|
53 |
+
? document.documentElement.clientHeight
|
54 |
+
: screen.height;
|
55 |
+
|
56 |
+
const popupWidth = width * widthRatio;
|
57 |
+
const popupHeight = height * heightRatio;
|
58 |
+
|
59 |
+
const left = ( (width / 2 ) - ( popupWidth / 2 ) ) + dualScreenLeft;
|
60 |
+
const top = ( (height / 2 ) - ( popupHeight / 2 ) ) + dualScreenTop;
|
61 |
+
|
62 |
+
CSCONNECT = window.open( 'about:blank', title,
|
63 |
+
`
|
64 |
+
location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no,
|
65 |
+
width=${ parseInt( popupWidth, 10 ) },
|
66 |
+
height=${ parseInt( popupHeight, 10 ) },
|
67 |
+
top=${ parseInt( top, 10 ) },
|
68 |
+
left=${ parseInt( left, 10 ) }
|
69 |
+
`
|
70 |
+
)
|
71 |
+
|
72 |
+
if ( window.focus ) CSCONNECT.focus();
|
73 |
+
}
|
74 |
+
( function( form ) {
|
75 |
+
form.onsubmit = function() {
|
76 |
+
showConnect( 'CSCONNECT' );
|
77 |
+
}
|
78 |
+
} )( document.getElementById( 'cs-connect-form' ) );
|
79 |
+
</script>
|
80 |
+
</div>
|
includes/admin/views/html-admin-setup-step-2.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the view for step 2 of the setup wizard.
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Admin
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
?>
|
12 |
+
<script type='text/javascript'>
|
13 |
+
window.close();
|
14 |
+
if (window.opener && !window.opener.closed) {
|
15 |
+
var querystring = window.opener.location.search;
|
16 |
+
querystring += ( querystring ? '&' : '?' ) + 'msg=connected';
|
17 |
+
window.opener.location.search = querystring;
|
18 |
+
}
|
19 |
+
</script>
|
20 |
+
<noscript><h3><?php esc_html_e( "You're ready to start using Crowdsignal!", 'crowdsignal-forms' ); ?></h3></noscript>
|
includes/admin/views/html-admin-setup-step-3.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the view for step 3 of the setup wizard.
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Admin
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
?>
|
12 |
+
<div class="crowdsignal-setup__main">
|
13 |
+
<div class="crowdsignal-setup__content">
|
14 |
+
<div class="crowdsignal-setup__top">
|
15 |
+
<h3><?php echo wp_kses_post( __( 'First time using Crowdsignal?', 'crowdsignal-forms' ) ); ?></h3>
|
16 |
+
</div>
|
17 |
+
|
18 |
+
<div class="crowdsignal-setup__middle">
|
19 |
+
<p>
|
20 |
+
<?php echo wp_kses_post( __( 'You can search for our blocks, like the Poll block, in the library of the block editor.', 'crowdsignal-forms' ) ); ?>
|
21 |
+
<br>
|
22 |
+
<?php echo wp_kses_post( __( 'Here is a short video to get you started:', 'crowdsignal-forms' ) ); ?>
|
23 |
+
</p>
|
24 |
+
|
25 |
+
<div class="crowdsignal-setup__video-container">
|
26 |
+
<div class="crowdsignal-setup__video">
|
27 |
+
<iframe width="100%" height="100%" src="https://videopress.com/v/jWTs90Dg" frameborder="0" allowfullscreen></iframe>
|
28 |
+
</div>
|
29 |
+
</div>
|
30 |
+
|
31 |
+
|
32 |
+
<p>
|
33 |
+
<?php
|
34 |
+
echo wp_kses_post(
|
35 |
+
sprintf(
|
36 |
+
// translators: Argument is a link to Crowdsignal's contact page.
|
37 |
+
__(
|
38 |
+
'<a href="%1s" target="_blank">Any questions about Crowdsignal?</a>',
|
39 |
+
'crowdsignal-forms'
|
40 |
+
),
|
41 |
+
'https://crowdsignal.com/contact/'
|
42 |
+
)
|
43 |
+
);
|
44 |
+
?>
|
45 |
+
</p>
|
46 |
+
|
47 |
+
<p>
|
48 |
+
<?php
|
49 |
+
echo wp_kses_post(
|
50 |
+
sprintf(
|
51 |
+
// translators: Argument is a link to Crowdsignal's support page.
|
52 |
+
__(
|
53 |
+
'<a href="%1s" target="_blank">Read more about us here.</a>',
|
54 |
+
'crowdsignal-forms'
|
55 |
+
),
|
56 |
+
'https://crowdsignal.com/support/'
|
57 |
+
)
|
58 |
+
);
|
59 |
+
?>
|
60 |
+
</p>
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
</div>
|
includes/auth/class-api-auth-provider-interface.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* An interface for Crowdsignal Authentication
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Auth
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Auth;
|
10 |
+
|
11 |
+
interface Api_Auth_Provider_Interface {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Return the user code to be used with the Crowdsignal API
|
15 |
+
*
|
16 |
+
* @param int $user_id WordPress User ID.
|
17 |
+
* @return string Crowdsignal user code
|
18 |
+
*/
|
19 |
+
public function fetch_user_code( $user_id );
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Return the user code to be used with the Crowdsignal API
|
23 |
+
*
|
24 |
+
* @param string $api_key Crowdsignal api key.
|
25 |
+
* @return string Crowdsignal user code
|
26 |
+
*/
|
27 |
+
public function fetch_user_code_for_key( $api_key );
|
28 |
+
}
|
includes/auth/class-crowdsignal-forms-api-authenticator.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Manges authentication with Crowdsignal
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Auth
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Auth;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Crowdsignal_Forms_Api_Authenticator
|
13 |
+
*/
|
14 |
+
class Crowdsignal_Forms_Api_Authenticator {
|
15 |
+
|
16 |
+
const USER_CODE_NAME = 'crowdsignal_user_code';
|
17 |
+
const API_KEY_NAME = 'crowdsignal_api_key';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* The Crowdsignal auth provider.
|
21 |
+
*
|
22 |
+
* @var Crowdsignal_Forms\Auth\Api_Auth_Provider_Interface class
|
23 |
+
*/
|
24 |
+
private $auth_provider;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Crowdsignal_Forms_Authenticator constructor
|
28 |
+
*/
|
29 |
+
public function __construct() {
|
30 |
+
$this->auth_provider = $this->get_auth_provider();
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get the auth provider to use for this instance.
|
35 |
+
*
|
36 |
+
* @return Crowdsignal_Forms\Auth\Api_Auth_Provider_Interface provider instance
|
37 |
+
*/
|
38 |
+
private function get_auth_provider() {
|
39 |
+
return apply_filters( 'crowdsignal_forms_get_auth_provider', new Default_Api_Auth_Provider() );
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Get the Crowdsignal user code.
|
44 |
+
*
|
45 |
+
* @return string the user code
|
46 |
+
*/
|
47 |
+
public function get_user_code() {
|
48 |
+
// Return the user code if we already retrieved and saved one.
|
49 |
+
$user_code = get_option( self::USER_CODE_NAME );
|
50 |
+
if ( ! empty( $user_code ) ) {
|
51 |
+
return $user_code;
|
52 |
+
}
|
53 |
+
|
54 |
+
// No saved user code found. Let's fetch one!
|
55 |
+
$user_id = wp_get_current_user()->ID;
|
56 |
+
$user_code = $this->auth_provider->fetch_user_code( $user_id );
|
57 |
+
if ( $user_code ) {
|
58 |
+
$this->set_user_code( $user_code );
|
59 |
+
}
|
60 |
+
|
61 |
+
return $user_code;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get the Crowdsignal API key.
|
66 |
+
*
|
67 |
+
* @return string the API key.
|
68 |
+
*/
|
69 |
+
public function get_api_key() {
|
70 |
+
return get_option( self::API_KEY_NAME );
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Delete the locally cached Crowdsignal API key.
|
75 |
+
*/
|
76 |
+
public function delete_api_key() {
|
77 |
+
delete_option( self::API_KEY_NAME );
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Delete the locally cached Crowdsignal user code.
|
82 |
+
*/
|
83 |
+
public function delete_user_code() {
|
84 |
+
delete_option( self::USER_CODE_NAME );
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Get the Crowdsignal user code for an API key
|
89 |
+
*
|
90 |
+
* @param string $api_key api key.
|
91 |
+
*/
|
92 |
+
public function get_user_code_for_key( $api_key ) {
|
93 |
+
$user_code = $this->auth_provider->fetch_user_code_for_key( $api_key );
|
94 |
+
if ( $user_code ) {
|
95 |
+
$this->set_user_code( $user_code );
|
96 |
+
}
|
97 |
+
|
98 |
+
return $user_code;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Set the Crowdsignal user code
|
103 |
+
*
|
104 |
+
* @param string $user_code user code to be set.
|
105 |
+
*/
|
106 |
+
public function set_user_code( $user_code ) {
|
107 |
+
update_option( self::USER_CODE_NAME, $user_code );
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Set the Crowdsignal API key
|
112 |
+
*
|
113 |
+
* @param string $api_key API key to be set.
|
114 |
+
*/
|
115 |
+
public function set_api_key( $api_key ) {
|
116 |
+
update_option( self::API_KEY_NAME, $api_key );
|
117 |
+
}
|
118 |
+
}
|
includes/auth/class-default-api-auth-provider.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The default (WordPress.org plugin) Crowdsignal auth provider
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Auth
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Auth;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Default_Api_Auth_Provider
|
13 |
+
*
|
14 |
+
* @package Crowdsignal_Forms\Auth
|
15 |
+
*/
|
16 |
+
class Default_Api_Auth_Provider implements Api_Auth_Provider_Interface {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Return the user code to be used with the Crowdsignal API.
|
20 |
+
*
|
21 |
+
* @param int $user_id int WordPress User ID.
|
22 |
+
* @return string Crowdsignal user code
|
23 |
+
*/
|
24 |
+
public function fetch_user_code( $user_id ) {
|
25 |
+
// TODO: Implement get_user_code() method.
|
26 |
+
return '';
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Return the user code to be used with the Crowdsignal API.
|
31 |
+
*
|
32 |
+
* @param string $api_key Crowdsignal API key.
|
33 |
+
* @return string Crowdsignal user code or false on error.
|
34 |
+
*/
|
35 |
+
public function fetch_user_code_for_key( $api_key ) {
|
36 |
+
$curl_data = wp_json_encode(
|
37 |
+
array(
|
38 |
+
'pdAccess' => array(
|
39 |
+
'partnerGUID' => $api_key,
|
40 |
+
'partnerUserID' => wp_get_current_user()->ID,
|
41 |
+
'demands' => array(
|
42 |
+
'demand' => array(
|
43 |
+
'id' => 'GetUserCode',
|
44 |
+
),
|
45 |
+
),
|
46 |
+
),
|
47 |
+
)
|
48 |
+
);
|
49 |
+
|
50 |
+
$data = $this->perform_query( $curl_data );
|
51 |
+
|
52 |
+
if ( isset( $data->pdResponse->userCode ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- data from API.
|
53 |
+
return $data->pdResponse->userCode; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- data from API.
|
54 |
+
} else {
|
55 |
+
return false;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Get the Crowdsignal user code for an API key.
|
61 |
+
*
|
62 |
+
* @param string $query query to send to API.
|
63 |
+
* @return mixed
|
64 |
+
*/
|
65 |
+
private function perform_query( $query ) {
|
66 |
+
$data = wp_remote_post(
|
67 |
+
'https://api.crowdsignal.com/v1',
|
68 |
+
array(
|
69 |
+
'method' => 'POST',
|
70 |
+
'body' => $query,
|
71 |
+
'headers' => array( 'Content-Type' => 'application/json' ),
|
72 |
+
)
|
73 |
+
);
|
74 |
+
return json_decode( $data['body'] );
|
75 |
+
}
|
76 |
+
}
|
includes/class-autoloader.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the class \Crowdsignal_Forms\Autoloader.
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Autoloader
|
13 |
+
*
|
14 |
+
* @package Crowdsignal_Forms
|
15 |
+
*/
|
16 |
+
class Autoloader {
|
17 |
+
/**
|
18 |
+
* The instance.
|
19 |
+
*
|
20 |
+
* @var null|Autoloader
|
21 |
+
*/
|
22 |
+
private static $instance = null;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The dir.
|
26 |
+
*
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
private $plugin_dir = '';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Autoloader constructor.
|
33 |
+
*/
|
34 |
+
private function __construct() {
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Sets our plugin dir.
|
39 |
+
*
|
40 |
+
* @param string $plugin_dir The dir.
|
41 |
+
* @return $this
|
42 |
+
*/
|
43 |
+
public function set_plugin_dir( $plugin_dir ) {
|
44 |
+
$this->plugin_dir = $plugin_dir;
|
45 |
+
return $this;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get This autoloader instance.
|
50 |
+
*
|
51 |
+
* @return Autoloader
|
52 |
+
*/
|
53 |
+
public static function get_instance() {
|
54 |
+
if ( null === self::$instance ) {
|
55 |
+
self::$instance = new self();
|
56 |
+
}
|
57 |
+
|
58 |
+
return self::$instance;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Add this autoloader to spl_autoload_register.
|
63 |
+
*
|
64 |
+
* @return $this;
|
65 |
+
*/
|
66 |
+
public function register() {
|
67 |
+
spl_autoload_register( array( $this, 'autoload' ) );
|
68 |
+
return $this;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Replace _ with dash.
|
73 |
+
*
|
74 |
+
* @param string $thing The string.
|
75 |
+
*
|
76 |
+
* @return string
|
77 |
+
*/
|
78 |
+
private static function dashify( $thing ) {
|
79 |
+
return str_replace( '_', '-', $thing );
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Do the autoload.
|
84 |
+
*
|
85 |
+
* @param string $class The class String.
|
86 |
+
*/
|
87 |
+
public function autoload( $class ) {
|
88 |
+
|
89 |
+
$parts = explode( '\\', strtolower( $class ) );
|
90 |
+
if ( empty( $parts ) ) {
|
91 |
+
return;
|
92 |
+
}
|
93 |
+
|
94 |
+
if ( empty( $parts[0] ) ) {
|
95 |
+
array_shift( $parts );
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( 'crowdsignal_forms' !== $parts[0] ) {
|
99 |
+
return;
|
100 |
+
}
|
101 |
+
array_shift( $parts );
|
102 |
+
|
103 |
+
$class_name = array_pop( $parts );
|
104 |
+
|
105 |
+
$namespaces = array_map( array( __CLASS__, 'dashify' ), $parts );
|
106 |
+
$class_file = 'class-' . str_replace( '_', '-', $class_name ) . '.php';
|
107 |
+
if ( ! empty( $namespaces ) ) {
|
108 |
+
$class_file = implode( DIRECTORY_SEPARATOR, $namespaces ) . DIRECTORY_SEPARATOR . $class_file;
|
109 |
+
}
|
110 |
+
|
111 |
+
$full_path = $this->plugin_dir . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . $class_file;
|
112 |
+
|
113 |
+
if ( file_exists( $full_path ) ) {
|
114 |
+
include_once $full_path;
|
115 |
+
}
|
116 |
+
|
117 |
+
}
|
118 |
+
}
|
includes/class-crowdsignal-forms.php
ADDED
@@ -0,0 +1,362 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the class \Crowdsignal_Forms\Crowdsignal_Forms.
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms;
|
10 |
+
|
11 |
+
use Crowdsignal_Forms\Frontend\Crowdsignal_Forms_Blocks_Assets;
|
12 |
+
use Crowdsignal_Forms\Frontend\Crowdsignal_Forms_Blocks;
|
13 |
+
use Crowdsignal_Forms\Gateways\Api_Gateway_Interface;
|
14 |
+
use Crowdsignal_Forms\Gateways\Api_Gateway;
|
15 |
+
use Crowdsignal_Forms\Gateways\Post_Poll_Meta_Gateway;
|
16 |
+
use Crowdsignal_Forms\Logging\Webservice_Logger;
|
17 |
+
use Crowdsignal_Forms\Rest_Api\Controllers\Polls_Controller;
|
18 |
+
use Crowdsignal_Forms\Rest_Api\Controllers\Account_Controller;
|
19 |
+
use Crowdsignal_Forms\Admin\Admin_Hooks;
|
20 |
+
use Crowdsignal_Forms\Admin\Crowdsignal_Forms_Admin_Notices;
|
21 |
+
use Crowdsignal_Forms\Auth\Crowdsignal_Forms_Api_Authenticator;
|
22 |
+
|
23 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
24 |
+
exit;
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Main Crowdsignal Forms class.
|
29 |
+
*
|
30 |
+
* @class Crowdsignal_Forms
|
31 |
+
*/
|
32 |
+
final class Crowdsignal_Forms {
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Instance of class.
|
36 |
+
*
|
37 |
+
* @var Crowdsignal_Forms
|
38 |
+
*/
|
39 |
+
private static $instance;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* The plugin dir.
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
private $plugin_dir;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* The plugin url.
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
private $plugin_url;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Our textdomain.
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
private $plugin_textdomain = 'crowdsignal-forms';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Blocks registry.
|
64 |
+
*
|
65 |
+
* @var Crowdsignal_Forms_Blocks
|
66 |
+
*/
|
67 |
+
private $blocks;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* The polls controller.
|
71 |
+
*
|
72 |
+
* @var Polls_Controller
|
73 |
+
*/
|
74 |
+
public $rest_api_polls_controller;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* The api gateway.
|
78 |
+
*
|
79 |
+
* @var Api_Gateway_Interface
|
80 |
+
*/
|
81 |
+
private $api_gateway = null;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* The admin hooks instance.
|
85 |
+
*
|
86 |
+
* @var Admin_Hooks
|
87 |
+
*/
|
88 |
+
private $admin_hooks;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* For saving/updating poll data from the api into post meta.
|
92 |
+
*
|
93 |
+
* @since 0.9.0
|
94 |
+
* @var Post_Poll_Meta_Gateway
|
95 |
+
*/
|
96 |
+
private $post_poll_meta_gateway = null;
|
97 |
+
|
98 |
+
/**
|
99 |
+
* The logger we use to record our webservice conversations.
|
100 |
+
*
|
101 |
+
* @since 0.9.0
|
102 |
+
* @var null|Webservice_Logger
|
103 |
+
*/
|
104 |
+
private $webservice_logger;
|
105 |
+
|
106 |
+
/**
|
107 |
+
* For account actions.
|
108 |
+
*
|
109 |
+
* @since 0.9.0
|
110 |
+
* @var Account_Controller
|
111 |
+
*/
|
112 |
+
private $rest_api_account_controller;
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Registers the block assets needed.
|
116 |
+
*
|
117 |
+
* @since 0.9.0
|
118 |
+
* @var Crowdsignal_Forms_Blocks_Assets
|
119 |
+
*/
|
120 |
+
private $blocks_assets;
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Initialize the singleton instance.
|
124 |
+
*
|
125 |
+
* @since 0.9.0
|
126 |
+
*/
|
127 |
+
private function __construct() {
|
128 |
+
$this->plugin_dir = dirname( __DIR__ );
|
129 |
+
$this->plugin_url = untrailingslashit( plugins_url( '', CROWDSIGNAL_FORMS_PLUGIN_BASENAME ) );
|
130 |
+
|
131 |
+
add_action( 'admin_init', array( $this, 'activate_redirect' ) );
|
132 |
+
register_deactivation_hook( CROWDSIGNAL_FORMS_PLUGIN_FILE, array( $this, 'deactivation' ) );
|
133 |
+
register_activation_hook( CROWDSIGNAL_FORMS_PLUGIN_FILE, array( $this, 'activate' ) );
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Fetches an instance of the class.
|
138 |
+
*
|
139 |
+
* @return self
|
140 |
+
*/
|
141 |
+
public static function instance() {
|
142 |
+
if ( ! self::$instance ) {
|
143 |
+
self::$instance = new self();
|
144 |
+
}
|
145 |
+
return self::$instance;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Run when plugin is activated
|
150 |
+
*
|
151 |
+
* @since 0.9.0
|
152 |
+
*/
|
153 |
+
public function activate() {
|
154 |
+
Crowdsignal_Forms_Admin_Notices::add_notice( Crowdsignal_Forms_Admin_Notices::NOTICE_CORE_SETUP );
|
155 |
+
add_option( 'crowdsignal_forms_do_activation_redirect', true );
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Performs a redirect to the getting started page.
|
160 |
+
*
|
161 |
+
* @since 0.9.0
|
162 |
+
*/
|
163 |
+
public function activate_redirect() {
|
164 |
+
if ( get_option( 'crowdsignal_forms_do_activation_redirect', false ) ) {
|
165 |
+
delete_option( 'crowdsignal_forms_do_activation_redirect' );
|
166 |
+
wp_safe_redirect( admin_url( 'admin.php?page=crowdsignal-forms-setup' ) );
|
167 |
+
exit();
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Clean up on deactivation.
|
173 |
+
*
|
174 |
+
* @since 0.9.0
|
175 |
+
*/
|
176 |
+
public function deactivation() {
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Includes all php files needed and sets all the objects this class will use for initializing.
|
181 |
+
*
|
182 |
+
* @since 0.9.0
|
183 |
+
*
|
184 |
+
* @return $this
|
185 |
+
*/
|
186 |
+
public function bootstrap() {
|
187 |
+
$this->blocks = new Crowdsignal_Forms_Blocks();
|
188 |
+
$this->blocks_assets = new Crowdsignal_Forms_Blocks_Assets();
|
189 |
+
$this->rest_api_polls_controller = new Polls_Controller();
|
190 |
+
$this->rest_api_account_controller = new Account_Controller();
|
191 |
+
$this->admin_hooks = new Admin_Hooks();
|
192 |
+
$this->webservice_logger = new Webservice_Logger();
|
193 |
+
|
194 |
+
return $this;
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Setup all filters and hooks. For frontend and optionally, admin.
|
200 |
+
*
|
201 |
+
* @param bool $init_all Pass in `true` to load and initialize both frontend and admin functionality. `false` by default.
|
202 |
+
*
|
203 |
+
* @return $this
|
204 |
+
*/
|
205 |
+
public function setup_hooks( $init_all = false ) {
|
206 |
+
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
207 |
+
add_action( 'init', array( $this->blocks_assets, 'register' ) );
|
208 |
+
add_action( 'init', array( $this->blocks, 'register' ) );
|
209 |
+
add_action( 'rest_api_init', array( $this, 'register_rest_api_routes' ) );
|
210 |
+
|
211 |
+
add_filter( 'crowdsignal_forms_api_request_headers', array( $this, 'add_auth_request_headers' ) );
|
212 |
+
|
213 |
+
$this->admin_hooks->hook();
|
214 |
+
$this->webservice_logger->hook_defaults();
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Set any other hooks, passing this instance.
|
218 |
+
*
|
219 |
+
* @param Crowdsignal_Forms $instance The instance.
|
220 |
+
* @since 0.9.0
|
221 |
+
*/
|
222 |
+
do_action( 'crowdsignal_forms_after_setup_hooks', $this );
|
223 |
+
|
224 |
+
return $this;
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Registers all REST api routes.
|
229 |
+
*
|
230 |
+
* @since 0.9.0
|
231 |
+
*/
|
232 |
+
public function register_rest_api_routes() {
|
233 |
+
$this->rest_api_polls_controller->register_routes();
|
234 |
+
$this->rest_api_account_controller->register_routes();
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Any additional controllers from companion plugins can be registered using this hook.
|
238 |
+
*
|
239 |
+
* @param object $this This plugin's bootstrap instance.
|
240 |
+
* @since 0.9.0
|
241 |
+
*/
|
242 |
+
do_action( 'crowdsignal_forms_register_rest_api_routes', $this );
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Initializes the class and adds all filters and actions.
|
247 |
+
*
|
248 |
+
* @since 0.9.0
|
249 |
+
*
|
250 |
+
* @param bool $init_all Pass in `true` to load and initialize both frontend and admin functionality. `false` by default.
|
251 |
+
*
|
252 |
+
* @return self
|
253 |
+
*/
|
254 |
+
public static function init( $init_all = false ) {
|
255 |
+
return self::instance()->bootstrap()->setup_hooks( $init_all );
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Get the plugin dir.
|
260 |
+
*
|
261 |
+
* @since 0.9.0
|
262 |
+
*
|
263 |
+
* @return string
|
264 |
+
*/
|
265 |
+
public function get_plugin_dir() {
|
266 |
+
return $this->plugin_dir;
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Get the api gateway.
|
271 |
+
*
|
272 |
+
* @return Api_Gateway_Interface
|
273 |
+
*/
|
274 |
+
public function get_api_gateway() {
|
275 |
+
if ( null === $this->api_gateway ) {
|
276 |
+
$this->api_gateway = new Api_Gateway();
|
277 |
+
}
|
278 |
+
|
279 |
+
return $this->api_gateway;
|
280 |
+
}
|
281 |
+
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Set the api gateway.
|
285 |
+
*
|
286 |
+
* @param Api_Gateway_Interface $gateway The gateway.
|
287 |
+
*
|
288 |
+
* @return $this
|
289 |
+
*/
|
290 |
+
public function set_api_gateway( $gateway ) {
|
291 |
+
$this->api_gateway = $gateway;
|
292 |
+
return $this;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Add API key and usercode to the API request headers.
|
297 |
+
*
|
298 |
+
* @param array $headers Any existing header values.
|
299 |
+
*
|
300 |
+
* @return $headers array the modified array.
|
301 |
+
*/
|
302 |
+
public function add_auth_request_headers( $headers ) {
|
303 |
+
$cs_authenticator = new Crowdsignal_Forms_Api_Authenticator();
|
304 |
+
|
305 |
+
$user_code = $cs_authenticator->get_user_code();
|
306 |
+
|
307 |
+
if ( ! empty( $user_code ) ) {
|
308 |
+
$headers['x-api-partner-guid'] = $cs_authenticator->get_api_key();
|
309 |
+
$headers['x-api-user-code'] = $user_code;
|
310 |
+
}
|
311 |
+
|
312 |
+
return $headers;
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Get the api gateway.
|
317 |
+
*
|
318 |
+
* @return Post_Poll_Meta_Gateway
|
319 |
+
*/
|
320 |
+
public function get_post_poll_meta_gateway() {
|
321 |
+
if ( null === $this->post_poll_meta_gateway ) {
|
322 |
+
$this->post_poll_meta_gateway = new Post_Poll_Meta_Gateway();
|
323 |
+
}
|
324 |
+
|
325 |
+
return $this->post_poll_meta_gateway;
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Set the api gateway.
|
330 |
+
*
|
331 |
+
* @param Post_Poll_Meta_Gateway $gateway The gateway.
|
332 |
+
*
|
333 |
+
* @return $this
|
334 |
+
*/
|
335 |
+
public function set_post_poll_meta_gateway( $gateway ) {
|
336 |
+
$this->post_poll_meta_gateway = $gateway;
|
337 |
+
return $this;
|
338 |
+
}
|
339 |
+
|
340 |
+
/**
|
341 |
+
* Get our webservice logger.
|
342 |
+
*
|
343 |
+
* @since 0.9.0
|
344 |
+
*
|
345 |
+
* @return Webservice_Logger
|
346 |
+
*/
|
347 |
+
public function get_webservice_logger() {
|
348 |
+
return $this->webservice_logger;
|
349 |
+
}
|
350 |
+
|
351 |
+
/**
|
352 |
+
* Loads the plugin textdomain.
|
353 |
+
*
|
354 |
+
* @since 0.9.0
|
355 |
+
*
|
356 |
+
* @return void
|
357 |
+
*/
|
358 |
+
public function load_textdomain() {
|
359 |
+
$language_path = basename( $this->plugin_dir ) . '/languages';
|
360 |
+
load_plugin_textdomain( $this->plugin_textdomain, false, $language_path );
|
361 |
+
}
|
362 |
+
}
|
includes/frontend/blocks/class-crowdsignal-forms-poll-block.php
ADDED
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains Crowdsignal_Forms\Frontend\Blocks\Crowdsignal_Forms_Poll_Block
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Frontend\Blocks
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Frontend\Blocks;
|
10 |
+
|
11 |
+
use Crowdsignal_Forms\Frontend\Crowdsignal_Forms_Blocks_Assets;
|
12 |
+
use Crowdsignal_Forms\Frontend\Crowdsignal_Forms_Block;
|
13 |
+
use Crowdsignal_Forms\Crowdsignal_Forms;
|
14 |
+
use Crowdsignal_Forms\Auth\Crowdsignal_Forms_Api_Authenticator;
|
15 |
+
|
16 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
17 |
+
exit;
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Handles Crowdsignal Forms' Poll block.
|
22 |
+
*
|
23 |
+
* @package Crowdsignal_Forms\Frontend\Blocks
|
24 |
+
* @since 0.9.0
|
25 |
+
*/
|
26 |
+
class Crowdsignal_Forms_Poll_Block implements Crowdsignal_Forms_Block {
|
27 |
+
const TRANSIENT_HIDE_BRANDING = 'cs-hide-branding';
|
28 |
+
const HIDE_BRANDING_YES = 'YES';
|
29 |
+
const HIDE_BRANDING_NO = 'NO';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Lazy-loaded state to determine if the api connection is set up.
|
33 |
+
*
|
34 |
+
* @var bool|null
|
35 |
+
*/
|
36 |
+
private static $is_cs_connected = null;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* {@inheritDoc}
|
40 |
+
*/
|
41 |
+
public function register() {
|
42 |
+
register_block_type(
|
43 |
+
'crowdsignal-forms/poll',
|
44 |
+
array(
|
45 |
+
'attributes' => $this->attributes(),
|
46 |
+
'editor_script' => Crowdsignal_Forms_Blocks_Assets::EDITOR,
|
47 |
+
'editor_style' => Crowdsignal_Forms_Blocks_Assets::EDITOR,
|
48 |
+
'render_callback' => array( $this, 'render' ),
|
49 |
+
)
|
50 |
+
);
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Renders the poll dynamic block
|
55 |
+
*
|
56 |
+
* @param array $attributes The block's attributes.
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function render( $attributes ) {
|
60 |
+
if ( $this->should_hide_poll() ) {
|
61 |
+
return '';
|
62 |
+
}
|
63 |
+
|
64 |
+
wp_enqueue_script( Crowdsignal_Forms_Blocks_Assets::POLL );
|
65 |
+
wp_enqueue_style( Crowdsignal_Forms_Blocks_Assets::POLL );
|
66 |
+
|
67 |
+
$attributes['hideBranding'] = $this->should_hide_branding();
|
68 |
+
$post = get_post();
|
69 |
+
if ( $post && isset( $attributes['pollId'] ) ) {
|
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 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
return sprintf(
|
79 |
+
'<div class="align%s crowdsignal-poll-wrapper" data-crowdsignal-poll="%s"></div>',
|
80 |
+
$attributes['align'],
|
81 |
+
htmlentities( wp_json_encode( $attributes ) )
|
82 |
+
);
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Determines if branding should be shown in the poll.
|
87 |
+
* Result is cached in a short-lived transient for performance.
|
88 |
+
*
|
89 |
+
* @return bool
|
90 |
+
*/
|
91 |
+
private function should_hide_branding() {
|
92 |
+
if ( get_transient( self::TRANSIENT_HIDE_BRANDING ) ) {
|
93 |
+
return self::HIDE_BRANDING_YES === get_transient( self::TRANSIENT_HIDE_BRANDING );
|
94 |
+
}
|
95 |
+
|
96 |
+
try {
|
97 |
+
$capabilities = Crowdsignal_Forms::instance()->get_api_gateway()->get_capabilities();
|
98 |
+
$hide_branding = false !== array_search( 'hide-branding', $capabilities, true )
|
99 |
+
? self::HIDE_BRANDING_YES
|
100 |
+
: self::HIDE_BRANDING_NO;
|
101 |
+
} catch ( \Exception $ex ) {
|
102 |
+
// ignore error, we'll get the updated value next time.
|
103 |
+
$hide_branding = self::HIDE_BRANDING_YES;
|
104 |
+
}
|
105 |
+
set_transient(
|
106 |
+
self::TRANSIENT_HIDE_BRANDING,
|
107 |
+
$hide_branding,
|
108 |
+
MINUTE_IN_SECONDS
|
109 |
+
);
|
110 |
+
return self::HIDE_BRANDING_YES === $hide_branding;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Determines if the poll should be rendered or not.
|
115 |
+
*
|
116 |
+
* @return bool
|
117 |
+
*/
|
118 |
+
private function should_hide_poll() {
|
119 |
+
if ( null !== self::$is_cs_connected ) {
|
120 |
+
return ! self::$is_cs_connected;
|
121 |
+
}
|
122 |
+
|
123 |
+
$api_auth_provider = new Crowdsignal_Forms_Api_Authenticator();
|
124 |
+
self::$is_cs_connected = $api_auth_provider->get_user_code();
|
125 |
+
|
126 |
+
return ! self::$is_cs_connected;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Returns the attributes definition array for register_block_type
|
131 |
+
*
|
132 |
+
* Note: Any changes to the array returned by this function need to be
|
133 |
+
* duplicated in client/blocks/poll/attributes.js.
|
134 |
+
*
|
135 |
+
* @return array
|
136 |
+
*/
|
137 |
+
private function attributes() {
|
138 |
+
return array(
|
139 |
+
'pollId' => array(
|
140 |
+
'type' => 'string',
|
141 |
+
'default' => null,
|
142 |
+
),
|
143 |
+
'isMultipleChoice' => array(
|
144 |
+
'type' => 'boolean',
|
145 |
+
'default' => false,
|
146 |
+
),
|
147 |
+
'title' => array(
|
148 |
+
'type' => 'string',
|
149 |
+
'default' => __( 'Untitled Poll', 'crowdsignal-forms' ),
|
150 |
+
),
|
151 |
+
'question' => array(
|
152 |
+
'type' => 'string',
|
153 |
+
'default' => '',
|
154 |
+
),
|
155 |
+
'note' => array(
|
156 |
+
'type' => 'string',
|
157 |
+
'default' => '',
|
158 |
+
),
|
159 |
+
'answers' => array(
|
160 |
+
'type' => 'array',
|
161 |
+
'default' => array( new \stdClass(), new \stdClass(), new \stdClass() ),
|
162 |
+
'items' => array(
|
163 |
+
'type' => 'object',
|
164 |
+
'properties' => array(
|
165 |
+
'answerId' => array(
|
166 |
+
'type' => 'string',
|
167 |
+
'default' => null,
|
168 |
+
),
|
169 |
+
'text' => array(
|
170 |
+
'type' => 'string',
|
171 |
+
'default' => '',
|
172 |
+
),
|
173 |
+
),
|
174 |
+
),
|
175 |
+
),
|
176 |
+
'submitButtonLabel' => array(
|
177 |
+
'type' => 'string',
|
178 |
+
'default' => __( 'Submit', 'crowdsignal-forms' ),
|
179 |
+
),
|
180 |
+
'submitButtonTextColor' => array(
|
181 |
+
'type' => 'string',
|
182 |
+
),
|
183 |
+
'submitButtonBackgroundColor' => array(
|
184 |
+
'type' => 'string',
|
185 |
+
),
|
186 |
+
'confirmMessageType' => array(
|
187 |
+
'type' => 'string',
|
188 |
+
'default' => 'results', // See: client/blocks/poll/constants.js.
|
189 |
+
),
|
190 |
+
'customConfirmMessage' => array(
|
191 |
+
'type' => 'string',
|
192 |
+
),
|
193 |
+
'redirectAddress' => array(
|
194 |
+
'type' => 'string',
|
195 |
+
),
|
196 |
+
'textColor' => array(
|
197 |
+
'type' => 'string',
|
198 |
+
),
|
199 |
+
'backgroundColor' => array(
|
200 |
+
'type' => 'string',
|
201 |
+
),
|
202 |
+
'borderColor' => array(
|
203 |
+
'type' => 'string',
|
204 |
+
),
|
205 |
+
'borderWidth' => array(
|
206 |
+
'type' => 'number',
|
207 |
+
'default' => 2,
|
208 |
+
),
|
209 |
+
'borderRadius' => array(
|
210 |
+
'type' => 'number',
|
211 |
+
'default' => 0,
|
212 |
+
),
|
213 |
+
'hasBoxShadow' => array(
|
214 |
+
'type' => 'boolean',
|
215 |
+
'default' => false,
|
216 |
+
),
|
217 |
+
'fontFamily' => array(
|
218 |
+
'type' => 'string',
|
219 |
+
'default' => null,
|
220 |
+
),
|
221 |
+
'hasOneResponsePerComputer' => array(
|
222 |
+
'type' => 'boolean',
|
223 |
+
'default' => false,
|
224 |
+
),
|
225 |
+
'randomizeAnswers' => array(
|
226 |
+
'type' => 'boolean',
|
227 |
+
'default' => false,
|
228 |
+
),
|
229 |
+
'align' => array(
|
230 |
+
'type' => 'string',
|
231 |
+
'default' => 'center',
|
232 |
+
),
|
233 |
+
'pollStatus' => array(
|
234 |
+
'type' => 'string',
|
235 |
+
'default' => 'open', // See: client/blocks/poll/constants.js.
|
236 |
+
),
|
237 |
+
'closedPollState' => array(
|
238 |
+
'type' => 'string',
|
239 |
+
'default' => 'show-results', // See: client/blocks/poll/constants.js.
|
240 |
+
),
|
241 |
+
'closedAfterDateTime' => array(
|
242 |
+
'type' => 'string',
|
243 |
+
'default' => null,
|
244 |
+
),
|
245 |
+
'hideBranding' => array(
|
246 |
+
'type' => 'boolean',
|
247 |
+
'default' => false,
|
248 |
+
),
|
249 |
+
);
|
250 |
+
}
|
251 |
+
}
|
includes/frontend/class-crowdsignal-forms-block.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains Crowdsignal_Forms\Frontend\Crowdsignal_Forms_Block
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Frontend\Blocks
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Frontend;
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Describes Crowdsignal Forms' Gutenberg blocks.
|
17 |
+
*
|
18 |
+
* @package Crowdsignal_Forms\Frontend
|
19 |
+
* @since 0.9.0
|
20 |
+
*/
|
21 |
+
interface Crowdsignal_Forms_Block {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Registers the Gutenberg block.
|
25 |
+
*/
|
26 |
+
public function register();
|
27 |
+
}
|
includes/frontend/class-crowdsignal-forms-blocks-assets.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains Crowdsignal_Forms\Frontend\Crowdsignal_Forms_Blocks_Assets
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Frontend
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Frontend;
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Handles Crowdsignal Forms' frontend assets.
|
17 |
+
*
|
18 |
+
* @package Crowdsignal_Forms\Frontend
|
19 |
+
* @since 0.9.0
|
20 |
+
*/
|
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
|
28 |
+
* for each group along with the generate config file.
|
29 |
+
*
|
30 |
+
* @return array
|
31 |
+
*/
|
32 |
+
private static function assets() {
|
33 |
+
return array(
|
34 |
+
self::EDITOR => array(
|
35 |
+
'config' => '/build/editor.asset.php',
|
36 |
+
'script' => '/build/editor.js',
|
37 |
+
'style' => '/build/editor.css',
|
38 |
+
),
|
39 |
+
self::POLL => array(
|
40 |
+
'config' => '/build/poll.asset.php',
|
41 |
+
'script' => '/build/poll.js',
|
42 |
+
'style' => '/build/poll.css',
|
43 |
+
),
|
44 |
+
);
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Registers Crowdsignal Forms' frontend assets
|
49 |
+
*/
|
50 |
+
public function register() {
|
51 |
+
foreach ( self::assets() as $id => $paths ) {
|
52 |
+
$this->register_asset_group( $id, $paths );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Registers an asset group.
|
58 |
+
* If the $paths['script'] or $paths['style'] is left undefined it'll be omitted.
|
59 |
+
*
|
60 |
+
* @param string $id Asset group id.
|
61 |
+
* @param array $paths Asset file paths.
|
62 |
+
*/
|
63 |
+
private function register_asset_group( $id, $paths ) {
|
64 |
+
// phpcs:ignore
|
65 |
+
$config = include( $this->include_path( $paths['config'] ) );
|
66 |
+
|
67 |
+
if ( isset( $paths['script'] ) ) {
|
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 |
+
);
|
75 |
+
}
|
76 |
+
|
77 |
+
if ( isset( $paths['style'] ) ) {
|
78 |
+
wp_register_style(
|
79 |
+
$id,
|
80 |
+
$this->url_path( $paths['style'] ),
|
81 |
+
array( 'wp-components' ),
|
82 |
+
$config['version']
|
83 |
+
);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Returns the include path for the given plugin relative path.
|
89 |
+
*
|
90 |
+
* @param string $path Path.
|
91 |
+
* @return string
|
92 |
+
*/
|
93 |
+
private function include_path( $path ) {
|
94 |
+
return plugin_dir_path( CROWDSIGNAL_FORMS_PLUGIN_FILE ) . $path;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Returns the url for the given plugin relative path.
|
99 |
+
*
|
100 |
+
* @param string $path Path.
|
101 |
+
* @return string
|
102 |
+
*/
|
103 |
+
private function url_path( $path ) {
|
104 |
+
return plugins_url( $path, CROWDSIGNAL_FORMS_PLUGIN_FILE );
|
105 |
+
}
|
106 |
+
}
|
includes/frontend/class-crowdsignal-forms-blocks.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains Crowdsignal_Forms\Frontend\Crowdsignal_Forms_Blocks
|
4 |
+
*
|
5 |
+
* @package Crowdsignal_Forms\Frontend
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Frontend;
|
10 |
+
|
11 |
+
use Crowdsignal_Forms\Frontend\Blocks as Blocks;
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Handles Crowdsignal Forms' Gutenberg blocks.
|
19 |
+
*
|
20 |
+
* @package Crowdsignal_Forms\Frontend
|
21 |
+
* @since 0.9.0
|
22 |
+
*/
|
23 |
+
class Crowdsignal_Forms_Blocks {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Returns a list containing all block classes
|
27 |
+
*
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
private static function blocks() {
|
31 |
+
return array(
|
32 |
+
Blocks\Crowdsignal_Forms_Poll_Block::class,
|
33 |
+
);
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Registers Crowdsignal Forms' custom Gutenberg blocks
|
38 |
+
*/
|
39 |
+
public function register() {
|
40 |
+
foreach ( self::blocks() as $block_class ) {
|
41 |
+
$block = new $block_class();
|
42 |
+
$block->register();
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
includes/frontend/index.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// phpcs:ignoreFile -- Silence is golden.
|
includes/gateways/class-api-gateway-interface.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the interface \Crowdsignal_Forms\Gateways\Api_Gateway_Interface.
|
4 |
+
*
|
5 |
+
* @package crowdsignal-forms/Gateways
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Gateways;
|
10 |
+
|
11 |
+
use Crowdsignal_Forms\Models\Poll;
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
interface Api_Gateway_Interface {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Get polls
|
21 |
+
*
|
22 |
+
* @since 0.9.0
|
23 |
+
*
|
24 |
+
* @return array|\WP_Error
|
25 |
+
*/
|
26 |
+
public function get_polls();
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Get the poll with specified poll id from the api.
|
30 |
+
*
|
31 |
+
* @param int $poll_id The poll id.
|
32 |
+
* @since 0.9.0
|
33 |
+
*
|
34 |
+
* @return Poll|\WP_Error
|
35 |
+
*/
|
36 |
+
public function get_poll( $poll_id );
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Call the api to create a poll with the specified data.
|
40 |
+
*
|
41 |
+
* @param Poll $poll The poll data.
|
42 |
+
* @return Poll|\WP_Error
|
43 |
+
* @since 0.9.0
|
44 |
+
*/
|
45 |
+
public function create_poll( Poll $poll);
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Call the api to update a poll with the specified data.
|
49 |
+
*
|
50 |
+
* @param Poll $poll The poll data.
|
51 |
+
* @return Poll|\WP_Error
|
52 |
+
* @since 0.9.0
|
53 |
+
*/
|
54 |
+
public function update_poll( Poll $poll);
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Call the api to archive a poll.
|
58 |
+
*
|
59 |
+
* @param int $id_to_archive The poll id to move to the archive.
|
60 |
+
* @return Poll|\WP_Error
|
61 |
+
* @since 0.9.0
|
62 |
+
*/
|
63 |
+
public function archive_poll( $id_to_archive );
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Get the account capabilities for the user.
|
67 |
+
*
|
68 |
+
* @since 0.9.0
|
69 |
+
*
|
70 |
+
* @return array|\WP_Error
|
71 |
+
*/
|
72 |
+
public function get_capabilities();
|
73 |
+
}
|
includes/gateways/class-api-gateway.php
ADDED
@@ -0,0 +1,345 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the interface \Crowdsignal_Forms\Gateways\Api_Gateway_Interface.
|
4 |
+
*
|
5 |
+
* @package crowdsignal-forms/Gateways
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Gateways;
|
10 |
+
|
11 |
+
use Crowdsignal_Forms\Crowdsignal_Forms;
|
12 |
+
use Crowdsignal_Forms\Models\Poll;
|
13 |
+
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Canned api gateway class
|
20 |
+
**/
|
21 |
+
class Api_Gateway implements Api_Gateway_Interface {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The api base.
|
25 |
+
*
|
26 |
+
* @since 0.9.0
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
const API_BASE_URL = 'https://api.crowdsignal.com/v3';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* A constant flag to mark polls on the API.
|
34 |
+
*
|
35 |
+
* @since 0.9.0
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
const POLL_SOURCE = 'crowdsignal-forms';
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get polls
|
42 |
+
*
|
43 |
+
* @since 0.9.0
|
44 |
+
*
|
45 |
+
* @return array|\WP_Error
|
46 |
+
*/
|
47 |
+
public function get_polls() {
|
48 |
+
return array();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Get the poll with specified poll id from the api.
|
53 |
+
*
|
54 |
+
* @param int $poll_id The poll id.
|
55 |
+
* @since 0.9.0
|
56 |
+
*
|
57 |
+
* @return Poll|\WP_Error
|
58 |
+
*/
|
59 |
+
public function get_poll( $poll_id ) {
|
60 |
+
$poll_id = absint( $poll_id );
|
61 |
+
$response = $this->perform_request( 'GET', '/polls/' . $poll_id );
|
62 |
+
return $this->handle_api_response( $response );
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Get the poll results with specified poll id from the api.
|
67 |
+
*
|
68 |
+
* @param int $poll_id The poll id.
|
69 |
+
* @since 0.9.0
|
70 |
+
*
|
71 |
+
* @return array|\WP_Error
|
72 |
+
*/
|
73 |
+
public function get_poll_results( $poll_id ) {
|
74 |
+
$poll_id = absint( $poll_id );
|
75 |
+
$response = $this->perform_request( 'GET', '/polls/' . $poll_id . '/results' );
|
76 |
+
if ( is_wp_error( $response ) ) {
|
77 |
+
return $response;
|
78 |
+
}
|
79 |
+
|
80 |
+
$body = wp_remote_retrieve_body( $response );
|
81 |
+
$response_data = json_decode( $body, true );
|
82 |
+
|
83 |
+
if ( ! $this->is_poll_response_valid( $response_data ) ) {
|
84 |
+
if ( isset( $response_data['error'] ) ) {
|
85 |
+
return new \WP_Error( $response_data['error'], $response_data );
|
86 |
+
}
|
87 |
+
return new \WP_Error( 'decode-failed' );
|
88 |
+
}
|
89 |
+
|
90 |
+
return $response_data['poll'];
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Call the api to create a poll with the specified data.
|
95 |
+
*
|
96 |
+
* @param Poll $poll The poll data.
|
97 |
+
* @return Poll|\WP_Error
|
98 |
+
* @since 0.9.0
|
99 |
+
*/
|
100 |
+
public function create_poll( Poll $poll ) {
|
101 |
+
return $this->create_or_update_poll( $poll );
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Call the api to update a poll with the specified data.
|
106 |
+
*
|
107 |
+
* @param Poll $poll The poll data.
|
108 |
+
* @return Poll|\WP_Error
|
109 |
+
* @since 0.9.0
|
110 |
+
*/
|
111 |
+
public function update_poll( Poll $poll ) {
|
112 |
+
return $this->create_or_update_poll( $poll );
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Call the api to archive a poll.
|
117 |
+
*
|
118 |
+
* @param int $id_to_archive The poll id to move to the archive.
|
119 |
+
* @return Poll|\WP_Error
|
120 |
+
* @since 0.9.0
|
121 |
+
*/
|
122 |
+
public function archive_poll( $id_to_archive ) {
|
123 |
+
$response = $this->perform_request( 'POST', '/polls/' . absint( $id_to_archive ) . '/archive' );
|
124 |
+
return $this->handle_api_response( $response );
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Handle the api response.
|
129 |
+
*
|
130 |
+
* @param \WP_Error|mixed $response The api response.
|
131 |
+
*
|
132 |
+
* @return \WP_Error|Poll
|
133 |
+
*/
|
134 |
+
private function handle_api_response( $response ) {
|
135 |
+
if ( is_wp_error( $response ) ) {
|
136 |
+
return $response;
|
137 |
+
}
|
138 |
+
|
139 |
+
$body = wp_remote_retrieve_body( $response );
|
140 |
+
$response_data = json_decode( $body, true );
|
141 |
+
|
142 |
+
if ( ! $this->is_poll_response_valid( $response_data ) ) {
|
143 |
+
if ( isset( $response_data['error'] ) ) {
|
144 |
+
return new \WP_Error( $response_data['error'], $response_data );
|
145 |
+
}
|
146 |
+
return new \WP_Error( 'decode-failed' );
|
147 |
+
}
|
148 |
+
|
149 |
+
return Poll::from_array( $response_data['poll'] );
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Call the api to unarchive a poll.
|
154 |
+
*
|
155 |
+
* @param int $id_to_unarchive The poll id to move to the archive.
|
156 |
+
* @return Poll|\WP_Error
|
157 |
+
* @since 0.9.0
|
158 |
+
*/
|
159 |
+
public function unarchive_poll( $id_to_unarchive ) {
|
160 |
+
$response = $this->perform_request( 'POST', '/polls/' . $id_to_unarchive . '/unarchive' );
|
161 |
+
return $this->handle_api_response( $response );
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Common method for either creating or updating a Poll.
|
166 |
+
*
|
167 |
+
* @param Poll $poll The poll.
|
168 |
+
* @return Poll|\WP_Error
|
169 |
+
* @since 0.9.0
|
170 |
+
*/
|
171 |
+
private function create_or_update_poll( Poll $poll ) {
|
172 |
+
$request_method = 'POST';
|
173 |
+
|
174 |
+
if ( 0 === $poll->get_id() ) {
|
175 |
+
$endpoint = '/polls';
|
176 |
+
} else {
|
177 |
+
$endpoint = '/polls/' . $poll->get_id();
|
178 |
+
}
|
179 |
+
|
180 |
+
$request_data = array( 'poll' => $poll->to_array() );
|
181 |
+
|
182 |
+
// Inject "source" property used on the API v3.
|
183 |
+
$request_data['poll']['source'] = self::POLL_SOURCE;
|
184 |
+
|
185 |
+
// Perform the request after injecting the "source" prop.
|
186 |
+
$response = $this->perform_request( $request_method, $endpoint, $request_data );
|
187 |
+
|
188 |
+
if ( is_wp_error( $response ) ) {
|
189 |
+
$this->log_webservice_event(
|
190 |
+
'response_error',
|
191 |
+
array(
|
192 |
+
'error' => $response,
|
193 |
+
)
|
194 |
+
);
|
195 |
+
return $response;
|
196 |
+
}
|
197 |
+
|
198 |
+
$body = wp_remote_retrieve_body( $response );
|
199 |
+
$response_data = json_decode( $body, true );
|
200 |
+
|
201 |
+
if ( ! $this->is_poll_response_valid( $response_data ) ) {
|
202 |
+
if ( isset( $response_data['error'] ) ) {
|
203 |
+
$wp_error = new \WP_Error( $response_data['error'], $response_data );
|
204 |
+
$this->log_webservice_event(
|
205 |
+
'response_error',
|
206 |
+
array(
|
207 |
+
'error' => $wp_error,
|
208 |
+
)
|
209 |
+
);
|
210 |
+
return $wp_error;
|
211 |
+
}
|
212 |
+
|
213 |
+
$this->log_webservice_event(
|
214 |
+
'response_error',
|
215 |
+
array(
|
216 |
+
'error' => 'decode-failed',
|
217 |
+
'body' => $body,
|
218 |
+
)
|
219 |
+
);
|
220 |
+
|
221 |
+
return new \WP_Error(
|
222 |
+
'decode-failed',
|
223 |
+
array(
|
224 |
+
'error' => 'decode-failed',
|
225 |
+
'body' => $body,
|
226 |
+
)
|
227 |
+
);
|
228 |
+
}
|
229 |
+
|
230 |
+
$this->log_webservice_event(
|
231 |
+
'response_success',
|
232 |
+
array(
|
233 |
+
'data' => $response_data,
|
234 |
+
)
|
235 |
+
);
|
236 |
+
|
237 |
+
return Poll::from_array( $response_data['poll'] );
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Get the account capabilities for the user.
|
242 |
+
*
|
243 |
+
* @since 0.9.0
|
244 |
+
*
|
245 |
+
* @return array|\WP_Error
|
246 |
+
*/
|
247 |
+
public function get_capabilities() {
|
248 |
+
$response = $this->perform_request( 'GET', '/account/capabilities' );
|
249 |
+
if ( is_wp_error( $response ) ) {
|
250 |
+
return $response;
|
251 |
+
}
|
252 |
+
|
253 |
+
$body = wp_remote_retrieve_body( $response );
|
254 |
+
$response_data = json_decode( $body, true );
|
255 |
+
|
256 |
+
if ( null === $response_data || ! is_array( $response_data ) ) {
|
257 |
+
if ( isset( $response_data['error'] ) ) {
|
258 |
+
return new \WP_Error( $response_data['error'], $response_data );
|
259 |
+
}
|
260 |
+
return new \WP_Error( 'decode-failed' );
|
261 |
+
}
|
262 |
+
|
263 |
+
return $response_data;
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Perform an API Request.
|
268 |
+
*
|
269 |
+
* @param string $method The HTTP Method.
|
270 |
+
* @param string $endpoint The endpoint.
|
271 |
+
* @param null|array $data The data.
|
272 |
+
* @return array|\WP_Error
|
273 |
+
*/
|
274 |
+
private function perform_request( $method, $endpoint, $data = null ) {
|
275 |
+
/**
|
276 |
+
* Filter the api base url.
|
277 |
+
*
|
278 |
+
* @param string $api_url The api url.
|
279 |
+
* @since 0.9.0
|
280 |
+
*
|
281 |
+
* @return string
|
282 |
+
*/
|
283 |
+
$base_url = apply_filters( 'crowdsignal_forms_api_base_url', self::API_BASE_URL );
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Add any extra request headers here.
|
287 |
+
*
|
288 |
+
* @param string $api_url The api url.
|
289 |
+
* @since 0.9.0
|
290 |
+
*
|
291 |
+
* @return array
|
292 |
+
*/
|
293 |
+
$headers = apply_filters(
|
294 |
+
'crowdsignal_forms_api_request_headers',
|
295 |
+
array(
|
296 |
+
'content-type' => 'application/json',
|
297 |
+
)
|
298 |
+
);
|
299 |
+
|
300 |
+
$request_options = array(
|
301 |
+
'method' => $method,
|
302 |
+
'headers' => $headers,
|
303 |
+
);
|
304 |
+
|
305 |
+
if ( null !== $data && ! in_array( $method, array( 'GET', 'HEAD', 'OPTIONS' ), true ) ) {
|
306 |
+
$body = wp_json_encode( $data );
|
307 |
+
$request_options['body'] = $body;
|
308 |
+
}
|
309 |
+
|
310 |
+
$this->log_webservice_event(
|
311 |
+
'request_data',
|
312 |
+
array(
|
313 |
+
'endpoint' => $endpoint,
|
314 |
+
'request_options' => $request_options,
|
315 |
+
)
|
316 |
+
);
|
317 |
+
|
318 |
+
return wp_remote_request( $base_url . $endpoint, $request_options );
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Log a webservice event such as an error or a successful request.
|
323 |
+
*
|
324 |
+
* @param string $name The event name.
|
325 |
+
* @param array $data The event data.
|
326 |
+
*
|
327 |
+
* @since 0.9.0
|
328 |
+
* @return void
|
329 |
+
*/
|
330 |
+
private function log_webservice_event( $name, $data = array() ) {
|
331 |
+
Crowdsignal_Forms::instance()->get_webservice_logger()->log( $name, $data );
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Checks if an api response contains a poll object.
|
336 |
+
*
|
337 |
+
* @param array $response The event name.
|
338 |
+
*
|
339 |
+
* @since 0.9.0
|
340 |
+
* @return boolean
|
341 |
+
*/
|
342 |
+
private function is_poll_response_valid( $response ) {
|
343 |
+
return null !== $response && isset( $response['poll'] );
|
344 |
+
}
|
345 |
+
}
|
includes/gateways/class-post-poll-meta-gateway.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing \Crowdsignal_Forms\Gateways\Post_Poll_Meta_Gateway
|
4 |
+
*
|
5 |
+
* @package crowdsignal-forms/Gateways
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Gateways;
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Class Post_Poll_Meta_Gateway
|
17 |
+
*
|
18 |
+
* @package Crowdsignal_Forms\Gateways
|
19 |
+
*/
|
20 |
+
class Post_Poll_Meta_Gateway {
|
21 |
+
/**
|
22 |
+
* Prefix for meta entries.
|
23 |
+
*/
|
24 |
+
const META_PREFIX = '_cs_poll_';
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Get a client id's associated poll data.
|
28 |
+
*
|
29 |
+
* @param int $post_id The post we have embedded the poll.
|
30 |
+
* @param string $client_id The uuid we assigned to the poll block.
|
31 |
+
* @return array
|
32 |
+
*/
|
33 |
+
public function get_poll_data_for_poll_client_id( $post_id, $client_id ) {
|
34 |
+
$platform_poll_data = (array) get_post_meta( $post_id, $this->get_poll_meta_key( $client_id ), true );
|
35 |
+
if ( empty( $platform_poll_data ) ) {
|
36 |
+
return array();
|
37 |
+
}
|
38 |
+
|
39 |
+
return $platform_poll_data;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Update a client id's associated poll data.
|
44 |
+
*
|
45 |
+
* @param int $post_id The post.
|
46 |
+
* @param string $client_id The client id.
|
47 |
+
* @param array $data Data as array.
|
48 |
+
*
|
49 |
+
* @return bool|int
|
50 |
+
*/
|
51 |
+
public function update_poll_data_for_client_id( $post_id, $client_id, $data ) {
|
52 |
+
return update_post_meta( $post_id, $this->get_poll_meta_key( $client_id ), $data );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Return the meta key for a poll block client ID.
|
57 |
+
*
|
58 |
+
* @param string $poll_id_on_block The client id.
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
private function get_poll_meta_key( $poll_id_on_block ) {
|
62 |
+
return self::META_PREFIX . $poll_id_on_block;
|
63 |
+
}
|
64 |
+
}
|
includes/gateways/index.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// phpcs:ignoreFile -- Silence is golden.
|
3 |
+
|
includes/index.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// phpcs:ignoreFile -- Silence is golden.
|
includes/logging/class-webservice-logger.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing \Crowdsignal_Forms\Logging\Webservice_Logger
|
4 |
+
*
|
5 |
+
* @package crowdsignal-forms/Logging
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Logging;
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Class Webservice_Logger
|
17 |
+
*
|
18 |
+
* @package Crowdsignal_Forms\Logging
|
19 |
+
*/
|
20 |
+
class Webservice_Logger {
|
21 |
+
/**
|
22 |
+
* Hook the default stuff.
|
23 |
+
*
|
24 |
+
* @since 0.9.0
|
25 |
+
*
|
26 |
+
* @return $this
|
27 |
+
*/
|
28 |
+
public function hook_defaults() {
|
29 |
+
add_filter( 'crowdsignal_forms_webservice_logging_enabled', '__return_false', 10, 1 );
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Unhook the defaults. Used when implementing logging in a companion plugin.
|
35 |
+
*
|
36 |
+
* @since 0.9.0
|
37 |
+
*
|
38 |
+
* @return $this
|
39 |
+
*/
|
40 |
+
public function unhook_defaults() {
|
41 |
+
remove_filter( 'crowdsignal_forms_webservice_logging_enabled', '__return_false', 10 );
|
42 |
+
return $this;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Log the webservice event.
|
47 |
+
*
|
48 |
+
* @param string $name The event we want to log.
|
49 |
+
* @param array $data The data we want to log.
|
50 |
+
* @since 0.9.0
|
51 |
+
*
|
52 |
+
* @return $this
|
53 |
+
*/
|
54 |
+
public function log( $name, $data ) {
|
55 |
+
/**
|
56 |
+
* Figure if we should log anything.
|
57 |
+
*
|
58 |
+
* @param bool $should_log Should we log events at all.
|
59 |
+
*
|
60 |
+
* @return array $data The event data to log.
|
61 |
+
*
|
62 |
+
* @since 0.9.0
|
63 |
+
*/
|
64 |
+
$should_log = (bool) apply_filters( 'crowdsignal_forms_webservice_logging_enabled', false );
|
65 |
+
|
66 |
+
if ( $should_log ) {
|
67 |
+
/**
|
68 |
+
* Record the webservice event using some form of "backend".
|
69 |
+
*
|
70 |
+
* @param string $name The event name to log.
|
71 |
+
* @param array $data The event data to log.
|
72 |
+
*
|
73 |
+
* @since 0.9.0
|
74 |
+
*/
|
75 |
+
do_action( 'crowdsignal_forms_webservice_log_event', $name, $data );
|
76 |
+
}
|
77 |
+
|
78 |
+
return $this;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
|
includes/models/class-poll-answer.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the model \Crowdsignal_Forms\Models\Poll_Answer.
|
4 |
+
*
|
5 |
+
* @package crowdsignal-forms/Models
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Models;
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Class Poll
|
17 |
+
*
|
18 |
+
* @since 0.9.0
|
19 |
+
* @package Crowdsignal_Forms\Models
|
20 |
+
*/
|
21 |
+
class Poll_Answer {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The poll answer id.
|
25 |
+
*
|
26 |
+
* @since 0.9.0
|
27 |
+
* @var int
|
28 |
+
*/
|
29 |
+
private $id = 0;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The client id.
|
33 |
+
*
|
34 |
+
* @since 0.9.0
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
private $client_id = '';
|
38 |
+
|
39 |
+
/**
|
40 |
+
* The poll answer text.
|
41 |
+
*
|
42 |
+
* @since 0.9.0
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
private $answer_text = '';
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Poll constructor.
|
49 |
+
*
|
50 |
+
* @param int $id The id.
|
51 |
+
* @param string $answer_text The answer_text.
|
52 |
+
* @since 0.9.0
|
53 |
+
*/
|
54 |
+
public function __construct( $id, $answer_text ) {
|
55 |
+
$this->id = $id;
|
56 |
+
$this->answer_text = $answer_text;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Create an answer from the API.
|
61 |
+
*
|
62 |
+
* @param array $data The json response decoded.
|
63 |
+
*
|
64 |
+
* @return self
|
65 |
+
*/
|
66 |
+
public static function from_array( array $data ) {
|
67 |
+
$id = isset( $data['id'] ) && is_numeric( $data['id'] ) ? absint( $data['id'] ) : 0;
|
68 |
+
$answer_text = isset( $data['answer_text'] ) ? $data['answer_text'] : '';
|
69 |
+
$ans = new self( $id, $answer_text );
|
70 |
+
|
71 |
+
if ( isset( $data['client_id'] ) ) {
|
72 |
+
$ans->set_client_id( $data['client_id'] );
|
73 |
+
};
|
74 |
+
|
75 |
+
return $ans;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Transform the object into an array based on the class vars values.
|
80 |
+
*
|
81 |
+
* @since 0.9.0
|
82 |
+
* @param string $context The context which we will be using the array.
|
83 |
+
* @return array
|
84 |
+
*/
|
85 |
+
public function to_array( $context = 'view' ) {
|
86 |
+
$data = array(
|
87 |
+
'answer_text' => $this->answer_text,
|
88 |
+
);
|
89 |
+
|
90 |
+
if ( $this->get_id() > 0 ) {
|
91 |
+
$data['id'] = $this->get_id();
|
92 |
+
}
|
93 |
+
|
94 |
+
if ( ! empty( $this->client_id ) ) {
|
95 |
+
$data['client_id'] = $this->client_id;
|
96 |
+
}
|
97 |
+
|
98 |
+
return $data;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Get the id.
|
103 |
+
*
|
104 |
+
* @since 0.9.0
|
105 |
+
* @return int
|
106 |
+
*/
|
107 |
+
public function get_id() {
|
108 |
+
return $this->id;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Get the block id.
|
113 |
+
*
|
114 |
+
* @since 0.9.0
|
115 |
+
* @return string
|
116 |
+
*/
|
117 |
+
public function get_client_id() {
|
118 |
+
return $this->client_id;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Sets the client id.
|
123 |
+
*
|
124 |
+
* @param string $client_id The client id.
|
125 |
+
* @return string
|
126 |
+
* @since 0.9.0
|
127 |
+
*/
|
128 |
+
public function set_client_id( $client_id ) {
|
129 |
+
$this->client_id = $client_id;
|
130 |
+
return $this;
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Updates the answer using block attrs.
|
135 |
+
*
|
136 |
+
* @param array $answer_attributes The attributes of the answers from the block.
|
137 |
+
* @return $this
|
138 |
+
*/
|
139 |
+
public function update_from_block( $answer_attributes ) {
|
140 |
+
if ( isset( $answer_attributes['answerId'] ) ) {
|
141 |
+
$this->client_id = $answer_attributes['answerId'];
|
142 |
+
}
|
143 |
+
|
144 |
+
if ( isset( $answer_attributes['text'] ) && ! empty( $answer_attributes['text'] ) ) {
|
145 |
+
$this->answer_text = $answer_attributes['text'];
|
146 |
+
}
|
147 |
+
|
148 |
+
return $this;
|
149 |
+
}
|
150 |
+
}
|
includes/models/class-poll-settings.php
ADDED
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the model \Crowdsignal_Forms\Models\Poll_Settings.
|
4 |
+
*
|
5 |
+
* @package crowdsignal-forms/Models
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Models;
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Class Poll_Settings
|
17 |
+
*
|
18 |
+
* @since 0.9.0
|
19 |
+
* @package Crowdsignal_Forms\Models
|
20 |
+
*/
|
21 |
+
class Poll_Settings {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* These constants come from (and must be kept in sync)
|
25 |
+
* client/blocks/poll/constants.js.
|
26 |
+
*
|
27 |
+
* @since 0.9.0
|
28 |
+
*/
|
29 |
+
const AFTER_VOTE_RESULTS = 'results';
|
30 |
+
const AFTER_VOTE_THANKYOU = 'thank-you';
|
31 |
+
const AFTER_VOTE_CUSTOM = 'custom-text';
|
32 |
+
const AFTER_VOTE_REDIRECT = 'redirect';
|
33 |
+
const CLOSE_TYPE_OPEN = 'open';
|
34 |
+
const CLOSE_TYPE_SCHEDULED_CLOSE = 'closed-after';
|
35 |
+
const CLOSE_TYPE_CLOSED = 'closed';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* The poll title.
|
39 |
+
*
|
40 |
+
* @since 0.9.0
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
private $title = '';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* The poll after vote option.
|
47 |
+
*
|
48 |
+
* Defines what to show next after voting
|
49 |
+
*
|
50 |
+
* @values results | thank-you | custom-text | redirect
|
51 |
+
* @since 0.9.0
|
52 |
+
* @var string
|
53 |
+
*/
|
54 |
+
private $after_vote = self::AFTER_VOTE_RESULTS;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* The poll custom text after voting.
|
58 |
+
*
|
59 |
+
* @since 0.9.0
|
60 |
+
* @var string
|
61 |
+
*/
|
62 |
+
private $after_message = '';
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Randomize answers option
|
66 |
+
*
|
67 |
+
* @since 0.9.0
|
68 |
+
* @var bool
|
69 |
+
*/
|
70 |
+
private $randomize_answers = false;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Block repeat voters option
|
74 |
+
*
|
75 |
+
* @since 0.9.0
|
76 |
+
* @var bool
|
77 |
+
*/
|
78 |
+
private $restrict_vote_repeat = false;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Captcha option
|
82 |
+
*
|
83 |
+
* @since 0.9.0
|
84 |
+
* @var bool
|
85 |
+
*/
|
86 |
+
private $captcha = false;
|
87 |
+
|
88 |
+
/**
|
89 |
+
* If the poll accepts multiple answers
|
90 |
+
*
|
91 |
+
* @since 0.9.0
|
92 |
+
* @var bool
|
93 |
+
*/
|
94 |
+
private $multiple_choice = false;
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Redirect URL (after voting)
|
98 |
+
*
|
99 |
+
* @since 0.9.0
|
100 |
+
* @var string
|
101 |
+
*/
|
102 |
+
private $redirect_url = '';
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Poll close status
|
106 |
+
*
|
107 |
+
* @values open | closed | closed_after
|
108 |
+
* @since 0.9.0
|
109 |
+
* @var string
|
110 |
+
*/
|
111 |
+
private $close_status = self::CLOSE_TYPE_OPEN;
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Date when the poll closes
|
115 |
+
*
|
116 |
+
* @since 0.9.0
|
117 |
+
* @var bool
|
118 |
+
*/
|
119 |
+
private $close_after = null;
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Poll_Settings constructor.
|
123 |
+
*
|
124 |
+
* @param array $data (optional) An array to construct this instance from.
|
125 |
+
*/
|
126 |
+
public function __construct( array $data = array() ) {
|
127 |
+
$this->update_from_array( $data );
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Update this object's props from a data array.
|
132 |
+
*
|
133 |
+
* @since 0.9.0
|
134 |
+
* @param array $data All the data.
|
135 |
+
* @return $this
|
136 |
+
*/
|
137 |
+
private function update_from_array( $data ) {
|
138 |
+
// on construct, these will be the defaults.
|
139 |
+
$current_values = (array) get_object_vars( $this );
|
140 |
+
$keys = array_keys( $current_values );
|
141 |
+
|
142 |
+
// Perform an intersection so no array members other than the
|
143 |
+
// object vars can be passed. Then merge.
|
144 |
+
$data = array_merge( $current_values, array_intersect_key( $data, $current_values ) );
|
145 |
+
// check for allowed values on close_status and after_vote.
|
146 |
+
$allowed_close_statuses = array(
|
147 |
+
self::CLOSE_TYPE_OPEN,
|
148 |
+
self::CLOSE_TYPE_CLOSED,
|
149 |
+
self::CLOSE_TYPE_SCHEDULED_CLOSE,
|
150 |
+
);
|
151 |
+
|
152 |
+
$data['close_status'] = in_array( $data['close_status'], $allowed_close_statuses, true )
|
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,
|
159 |
+
self::AFTER_VOTE_CUSTOM,
|
160 |
+
self::AFTER_VOTE_REDIRECT,
|
161 |
+
);
|
162 |
+
|
163 |
+
$data['after_vote'] = in_array( $data['after_vote'], $allowed_after_vote_options, true )
|
164 |
+
? $data['after_vote']
|
165 |
+
: self::AFTER_VOTE_RESULTS;
|
166 |
+
|
167 |
+
foreach ( $data as $var => $value ) {
|
168 |
+
if ( in_array( $var, $keys, true ) ) {
|
169 |
+
$this->{$var} = $value;
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
return $this;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Create one from the API.
|
178 |
+
*
|
179 |
+
* @param array $data The data.
|
180 |
+
*
|
181 |
+
* @return Poll_Settings
|
182 |
+
*/
|
183 |
+
public static function from_array( $data ) {
|
184 |
+
return new self( $data );
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Transform the object into an array based on the class vars values.
|
189 |
+
*
|
190 |
+
* @since 0.9.0
|
191 |
+
* @param string $context The context which we will be using the array.
|
192 |
+
* @return array
|
193 |
+
*/
|
194 |
+
public function to_array( $context = 'view' ) {
|
195 |
+
return (array) get_object_vars( $this );
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Update the settings from the block's attrs.
|
200 |
+
*
|
201 |
+
* @since 0.9.0
|
202 |
+
* @param array $attrs All the block attrs.
|
203 |
+
* @return $this
|
204 |
+
*/
|
205 |
+
public function update_from_block( $attrs ) {
|
206 |
+
$settings_from_block = $attrs;
|
207 |
+
// These are not yet implemented.
|
208 |
+
$settings_data = array(
|
209 |
+
'after_message' => '',
|
210 |
+
'redirect_url' => '',
|
211 |
+
'captcha' => false,
|
212 |
+
);
|
213 |
+
|
214 |
+
$block_attributes_to_object_props = array(
|
215 |
+
'title' => 'title',
|
216 |
+
'confirmMessageType' => 'after_vote',
|
217 |
+
'randomizeAnswers' => 'randomize_answers',
|
218 |
+
'hasOneResponsePerComputer' => 'restrict_vote_repeat',
|
219 |
+
'isMultipleChoice' => 'multiple_choice',
|
220 |
+
'pollStatus' => 'close_status',
|
221 |
+
'closedAfterDateTime' => 'close_after',
|
222 |
+
);
|
223 |
+
|
224 |
+
foreach ( $block_attributes_to_object_props as $block_attr => $object_property_name ) {
|
225 |
+
if ( isset( $settings_from_block[ $block_attr ] ) ) {
|
226 |
+
$settings_data[ $object_property_name ] = $settings_from_block[ $block_attr ];
|
227 |
+
}
|
228 |
+
}
|
229 |
+
$this->update_from_array( $settings_data );
|
230 |
+
return $this;
|
231 |
+
}
|
232 |
+
}
|
includes/models/class-poll.php
ADDED
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File containing the model \Crowdsignal_Forms\Models\Poll.
|
4 |
+
*
|
5 |
+
* @package crowdsignal-forms/Models
|
6 |
+
* @since 0.9.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Models;
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Class Poll
|
17 |
+
*
|
18 |
+
* @since 0.9.0
|
19 |
+
* @package Crowdsignal_Forms\Models
|
20 |
+
*/
|
21 |
+
class Poll {
|
22 |
+
const POLL_ID_BLOCK_ATTRIBUTE = 'pollId';
|
23 |
+
const ANSWER_ID_BLOCK_ATTRIBUTE = 'answerId';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* The poll id.
|
27 |
+
*
|
28 |
+
* @since 0.9.0
|
29 |
+
* @var int
|
30 |
+
*/
|
31 |
+
private $id = 0;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* The client id.
|
35 |
+
*
|
36 |
+
* @since 0.9.0
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
private $client_id = '';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* The poll question.
|
43 |
+
*
|
44 |
+
* @since 0.9.0
|
45 |
+
* @var string
|
46 |
+
*/
|
47 |
+
private $question = '';
|
48 |
+
|
49 |
+
/**
|
50 |
+
* The poll answers.
|
51 |
+
*
|
52 |
+
* @since 0.9.0
|
53 |
+
* @var array
|
54 |
+
*/
|
55 |
+
private $answers = array();
|
56 |
+
|
57 |
+
/**
|
58 |
+
* The poll settings.
|
59 |
+
*
|
60 |
+
* @since 0.9.0
|
61 |
+
* @var Poll_Settings|null
|
62 |
+
*/
|
63 |
+
private $settings = null;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* The poll source_link.
|
67 |
+
*
|
68 |
+
* @since 0.9.0
|
69 |
+
* @var string
|
70 |
+
*/
|
71 |
+
private $source_link = '';
|
72 |
+
|
73 |
+
/**
|
74 |
+
* The poll note.
|
75 |
+
*
|
76 |
+
* @since 0.9.0
|
77 |
+
* @var string
|
78 |
+
*/
|
79 |
+
private $note = '';
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Poll constructor.
|
83 |
+
*
|
84 |
+
* @param int $id The id.
|
85 |
+
* @param string $question The question.
|
86 |
+
* @param string $note The note.
|
87 |
+
* @param array $answers The answers.
|
88 |
+
* @param Poll_Settings $settings The settings.
|
89 |
+
*/
|
90 |
+
public function __construct( $id, $question, $note, array $answers, Poll_Settings $settings ) {
|
91 |
+
$this->id = $id;
|
92 |
+
$this->question = $question;
|
93 |
+
$this->note = $note;
|
94 |
+
$this->answers = $answers;
|
95 |
+
$this->settings = $settings;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Creates a new Poll object from an array.
|
100 |
+
*
|
101 |
+
* @param array $data The data.
|
102 |
+
* @return Poll
|
103 |
+
* @since 0.9.0
|
104 |
+
*/
|
105 |
+
public static function from_array( $data ) {
|
106 |
+
$id = isset( $data['id'] ) ? absint( $data['id'] ) : 0;
|
107 |
+
$question = isset( $data['question'] ) ? $data['question'] : '';
|
108 |
+
$note = isset( $data['note'] ) ? $data['note'] : '';
|
109 |
+
$answers = array_map(
|
110 |
+
function ( $poll_data ) {
|
111 |
+
return Poll_Answer::from_array( $poll_data );
|
112 |
+
},
|
113 |
+
isset( $data['answers'] ) ? $data['answers'] : array()
|
114 |
+
);
|
115 |
+
$settings = Poll_Settings::from_array( isset( $data['settings'] ) ? $data['settings'] : array() );
|
116 |
+
$poll = new self( $id, $question, $note, $answers, $settings );
|
117 |
+
|
118 |
+
if ( isset( $data['client_id'] ) ) {
|
119 |
+
$poll->set_client_id( $data['client_id'] );
|
120 |
+
}
|
121 |
+
|
122 |
+
if ( isset( $data['post_id'] ) ) {
|
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 );.
|
126 |
+
$poll->set_source_link( \get_permalink( $data['post_id'] ) );
|
127 |
+
}
|
128 |
+
|
129 |
+
return $poll;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Update this poll from the block attrs.
|
134 |
+
*
|
135 |
+
* @param array $attrs The block attrs.
|
136 |
+
* @return $this
|
137 |
+
*/
|
138 |
+
public function update_from_block_attrs( $attrs ) {
|
139 |
+
$this->client_id = $attrs['pollId'] ? $attrs['pollId'] : '';
|
140 |
+
$attribute_answers = isset( $attrs['answers'] ) ? $attrs['answers'] : array();
|
141 |
+
$this->question = isset( $attrs['question'] ) ? $attrs['question'] : '';
|
142 |
+
$this->note = isset( $attrs['note'] ) ? $attrs['note'] : '';
|
143 |
+
|
144 |
+
$block_answers_by_uuid = array();
|
145 |
+
foreach ( $attribute_answers as $attribute_answer ) {
|
146 |
+
$block_answers_by_uuid[ $attribute_answer['answerId'] ] = $attribute_answer;
|
147 |
+
}
|
148 |
+
|
149 |
+
foreach ( $this->answers as $i => &$answer ) {
|
150 |
+
$answer_block_id = $answer->get_client_id();
|
151 |
+
if ( in_array( $answer_block_id, array_keys( $block_answers_by_uuid ), true ) ) {
|
152 |
+
$answer->update_from_block( $block_answers_by_uuid[ $answer_block_id ] );
|
153 |
+
unset( $block_answers_by_uuid[ $answer_block_id ] );
|
154 |
+
} else {
|
155 |
+
// todo: delete this answer, it is no longer in the block.
|
156 |
+
unset( $this->answers[ $i ] );
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
// Trick to reindex the array.
|
161 |
+
$this->answers = array_values( $this->answers );
|
162 |
+
|
163 |
+
foreach ( $block_answers_by_uuid as $new_answer_data ) {
|
164 |
+
$new_answer = Poll_Answer::from_array( array() );
|
165 |
+
$new_answer->update_from_block( $new_answer_data );
|
166 |
+
$this->answers[] = $new_answer;
|
167 |
+
}
|
168 |
+
|
169 |
+
$this->settings->update_from_block( $attrs );
|
170 |
+
|
171 |
+
return $this;
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Validates the poll is ok for saving.
|
176 |
+
*
|
177 |
+
* @since 0.9.0
|
178 |
+
* @return bool|\WP_Error
|
179 |
+
*/
|
180 |
+
public function validate() {
|
181 |
+
return true;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Get the id.
|
186 |
+
*
|
187 |
+
* @since 0.9.0
|
188 |
+
* @return int
|
189 |
+
*/
|
190 |
+
public function get_id() {
|
191 |
+
return $this->id;
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Get the question.
|
196 |
+
*
|
197 |
+
* @since 0.9.0
|
198 |
+
* @return int
|
199 |
+
*/
|
200 |
+
public function get_question() {
|
201 |
+
return $this->question;
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Get the answers.
|
206 |
+
*
|
207 |
+
* @since 0.9.0
|
208 |
+
* @return array
|
209 |
+
*/
|
210 |
+
public function get_answers() {
|
211 |
+
return $this->answers;
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Get the source link we set.
|
216 |
+
*
|
217 |
+
* @return string
|
218 |
+
*/
|
219 |
+
public function get_source_link() {
|
220 |
+
return $this->source_link;
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Set the poll block source link.
|
225 |
+
*
|
226 |
+
* @param string $source_link The source link.
|
227 |
+
* @return $this
|
228 |
+
*/
|
229 |
+
public function set_source_link( $source_link ) {
|
230 |
+
$this->source_link = $source_link;
|
231 |
+
return $this;
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Transform the poll into an array for sending to the api or the frontend.
|
236 |
+
*
|
237 |
+
* @since 0.9.0
|
238 |
+
* @param string $context The context which we will be using the array.
|
239 |
+
* @return array
|
240 |
+
*/
|
241 |
+
public function to_array( $context = 'view' ) {
|
242 |
+
$data = array();
|
243 |
+
|
244 |
+
if ( ! empty( $this->id ) ) {
|
245 |
+
$data['id'] = $this->id;
|
246 |
+
}
|
247 |
+
|
248 |
+
$data['question'] = $this->question;
|
249 |
+
$data['note'] = $this->note;
|
250 |
+
|
251 |
+
$data['settings'] = $this->settings->to_array( $context );
|
252 |
+
foreach ( $this->get_answers() as $answer ) {
|
253 |
+
$data['answers'][] = $answer->to_array();
|
254 |
+
}
|
255 |
+
|
256 |
+
if ( ! empty( $this->source_link ) ) {
|
257 |
+
$data['source_link'] = $this->get_source_link();
|
258 |
+
}
|
259 |
+
|
260 |
+
if ( ! empty( $this->client_id ) ) {
|
261 |
+
$data['client_id'] = $this->client_id;
|
262 |
+
}
|
263 |
+
|
264 |
+
return $data;
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Set the client id.
|
269 |
+
*
|
270 |
+
* @param string $client_id Unique client id.
|
271 |
+
* @return $this
|
272 |
+
*/
|
273 |
+
private function set_client_id( $client_id ) {
|
274 |
+
$this->client_id = $client_id;
|
275 |
+
return $this;
|
276 |
+
}
|
277 |
+
}
|
includes/rest-api/controllers/class-account-controller.php
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains the Account Controller Class
|
4 |
+
*
|
5 |
+
* @since 0.9.0
|
6 |
+
* @package Crowdsignal_Forms\Rest_Api
|
7 |
+
**/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Rest_Api\Controllers;
|
10 |
+
|
11 |
+
use Crowdsignal_Forms\Crowdsignal_Forms;
|
12 |
+
use Crowdsignal_Forms\Auth\Crowdsignal_Forms_Api_Authenticator;
|
13 |
+
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Account Controller Class
|
20 |
+
*
|
21 |
+
* @since 0.9.0
|
22 |
+
**/
|
23 |
+
class Account_Controller {
|
24 |
+
/**
|
25 |
+
* The namespace.
|
26 |
+
*
|
27 |
+
* @var string
|
28 |
+
**/
|
29 |
+
protected $namespace = 'crowdsignal-forms/v1';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The rest api base.
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
**/
|
36 |
+
protected $rest_base = 'account';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Register the routes for account data
|
40 |
+
*
|
41 |
+
* @since 0.9.0
|
42 |
+
**/
|
43 |
+
public function register_routes() {
|
44 |
+
register_rest_route(
|
45 |
+
$this->namespace,
|
46 |
+
'/' . $this->rest_base . '/capabilities',
|
47 |
+
array(
|
48 |
+
array(
|
49 |
+
'methods' => \WP_REST_Server::READABLE,
|
50 |
+
'callback' => array( $this, 'get_capabilities' ),
|
51 |
+
'permission_callback' => array( $this, 'get_account_permissions_check' ),
|
52 |
+
'args' => $this->get_collection_params(),
|
53 |
+
),
|
54 |
+
)
|
55 |
+
);
|
56 |
+
|
57 |
+
register_rest_route(
|
58 |
+
$this->namespace,
|
59 |
+
'/' . $this->rest_base . '/connected',
|
60 |
+
array(
|
61 |
+
array(
|
62 |
+
'methods' => \WP_REST_Server::READABLE,
|
63 |
+
'callback' => array( $this, 'is_cs_connected' ),
|
64 |
+
'permission_callback' => array( $this, 'get_account_permissions_check' ),
|
65 |
+
),
|
66 |
+
)
|
67 |
+
);
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Gets the collection params.
|
72 |
+
*
|
73 |
+
* @since 0.9.0
|
74 |
+
* @return array
|
75 |
+
*/
|
76 |
+
protected function get_collection_params() {
|
77 |
+
return array();
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Get the capabilities for the account.
|
82 |
+
*
|
83 |
+
* @since 0.9.0
|
84 |
+
*
|
85 |
+
* @param \WP_REST_Request $request
|
86 |
+
*
|
87 |
+
* @return \WP_REST_Response|\WP_Error
|
88 |
+
**/
|
89 |
+
public function get_capabilities( $request ) {
|
90 |
+
$capabilities = Crowdsignal_Forms::instance()->get_api_gateway()->get_capabilities();
|
91 |
+
if ( is_wp_error( $capabilities ) ) {
|
92 |
+
return rest_ensure_response( $capabilities );
|
93 |
+
}
|
94 |
+
|
95 |
+
return rest_ensure_response( $capabilities );
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* The permission check for retrieving account info.
|
100 |
+
*
|
101 |
+
* @since 0.9.0
|
102 |
+
*
|
103 |
+
* @return bool
|
104 |
+
**/
|
105 |
+
public function get_account_permissions_check() {
|
106 |
+
return current_user_can( 'publish_posts' );
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Gets the enabled state of the Crowdsignal connection.
|
111 |
+
*
|
112 |
+
* @return \WP_REST_Response|\WP_Error
|
113 |
+
*/
|
114 |
+
public function is_cs_connected() {
|
115 |
+
if ( defined( 'IS_WPCOM' ) && true === constant( 'IS_WPCOM' ) ) {
|
116 |
+
return true;
|
117 |
+
}
|
118 |
+
|
119 |
+
$api_auth_provider = new Crowdsignal_Forms_Api_Authenticator();
|
120 |
+
$user_code = $api_auth_provider->get_user_code();
|
121 |
+
|
122 |
+
return rest_ensure_response( ! empty( $user_code ) );
|
123 |
+
}
|
124 |
+
}
|
includes/rest-api/controllers/class-polls-controller.php
ADDED
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains the Polls Controller Class
|
4 |
+
*
|
5 |
+
* @since 0.9.0
|
6 |
+
* @package Crowdsignal_Forms\Rest_Api
|
7 |
+
**/
|
8 |
+
|
9 |
+
namespace Crowdsignal_Forms\Rest_Api\Controllers;
|
10 |
+
|
11 |
+
use Crowdsignal_Forms\Crowdsignal_Forms;
|
12 |
+
use Crowdsignal_Forms\Models\Poll;
|
13 |
+
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
die;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Polls Controller Class
|
20 |
+
*
|
21 |
+
* @since 0.9.0
|
22 |
+
**/
|
23 |
+
class Polls_Controller {
|
24 |
+
/**
|
25 |
+
* The namespace.
|
26 |
+
*
|
27 |
+
* @var string
|
28 |
+
**/
|
29 |
+
protected $namespace = 'crowdsignal-forms/v1';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The rest api base.
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
**/
|
36 |
+
protected $rest_base = 'polls';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Register the routes for manipulating polls
|
40 |
+
*
|
41 |
+
* @since 0.9.0
|
42 |
+
**/
|
43 |
+
public function register_routes() {
|
44 |
+
register_rest_route(
|
45 |
+
$this->namespace,
|
46 |
+
'/' . $this->rest_base,
|
47 |
+
array(
|
48 |
+
array(
|
49 |
+
'methods' => \WP_REST_Server::READABLE,
|
50 |
+
'callback' => array( $this, 'get_polls' ),
|
51 |
+
'permission_callback' => array( $this, 'get_polls_permissions_check' ),
|
52 |
+
'args' => $this->get_collection_params(),
|
53 |
+
),
|
54 |
+
)
|
55 |
+
);
|
56 |
+
register_rest_route(
|
57 |
+
$this->namespace,
|
58 |
+
'/' . $this->rest_base,
|
59 |
+
array(
|
60 |
+
array(
|
61 |
+
'methods' => \WP_REST_Server::CREATABLE,
|
62 |
+
'callback' => array( $this, 'create_poll' ),
|
63 |
+
'permission_callback' => array( $this, 'create_or_update_poll_permissions_check' ),
|
64 |
+
),
|
65 |
+
)
|
66 |
+
);
|
67 |
+
|
68 |
+
// GET polls/:poll_id route.
|
69 |
+
register_rest_route(
|
70 |
+
$this->namespace,
|
71 |
+
'/' . $this->rest_base . '/(?P<poll_id>\d+)',
|
72 |
+
array(
|
73 |
+
array(
|
74 |
+
'methods' => \WP_REST_Server::READABLE,
|
75 |
+
'callback' => array( $this, 'get_poll' ),
|
76 |
+
'permission_callback' => array( $this, 'get_poll_permissions_check' ),
|
77 |
+
'args' => $this->get_poll_fetch_params(),
|
78 |
+
),
|
79 |
+
)
|
80 |
+
);
|
81 |
+
|
82 |
+
// GET polls/:poll_id/results route.
|
83 |
+
register_rest_route(
|
84 |
+
$this->namespace,
|
85 |
+
'/' . $this->rest_base . '/(?P<poll_id>\d+)/results',
|
86 |
+
array(
|
87 |
+
array(
|
88 |
+
'methods' => \WP_REST_Server::READABLE,
|
89 |
+
'callback' => array( $this, 'get_poll_results' ),
|
90 |
+
'permission_callback' => array( $this, 'get_poll_permissions_check' ),
|
91 |
+
),
|
92 |
+
)
|
93 |
+
);
|
94 |
+
|
95 |
+
// GET post-polls/:post_id.
|
96 |
+
register_rest_route(
|
97 |
+
$this->namespace,
|
98 |
+
'/post-polls/(?P<post_id>\d+)/(?P<poll_uuid>[a-zA-Z0-9\-\_]+)',
|
99 |
+
array(
|
100 |
+
array(
|
101 |
+
'methods' => \WP_REST_Server::READABLE,
|
102 |
+
'callback' => array( $this, 'get_post_poll_by_uuid' ),
|
103 |
+
'permission_callback' => array( $this, 'get_poll_permissions_check' ),
|
104 |
+
),
|
105 |
+
)
|
106 |
+
);
|
107 |
+
|
108 |
+
register_rest_route(
|
109 |
+
$this->namespace,
|
110 |
+
'/' . $this->rest_base . '/(?P<poll_id>\d+)',
|
111 |
+
array(
|
112 |
+
array(
|
113 |
+
'methods' => \WP_REST_Server::EDITABLE,
|
114 |
+
'callback' => array( $this, 'update_poll' ),
|
115 |
+
'permission_callback' => array( $this, 'create_or_update_poll_permissions_check' ),
|
116 |
+
'args' => $this->get_poll_fetch_params(),
|
117 |
+
),
|
118 |
+
)
|
119 |
+
);
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Archives a poll
|
123 |
+
*/
|
124 |
+
register_rest_route(
|
125 |
+
$this->namespace,
|
126 |
+
'/' . $this->rest_base . '/(?P<poll_id>\d+)/archive',
|
127 |
+
array(
|
128 |
+
array(
|
129 |
+
'methods' => \WP_REST_Server::EDITABLE,
|
130 |
+
'callback' => array( $this, 'archive_poll' ),
|
131 |
+
'permission_callback' => array( $this, 'create_or_update_poll_permissions_check' ),
|
132 |
+
),
|
133 |
+
)
|
134 |
+
);
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Un-archives a poll, moving it to the last used user folder
|
138 |
+
*/
|
139 |
+
register_rest_route(
|
140 |
+
$this->namespace,
|
141 |
+
'/' . $this->rest_base . '/(?P<poll_id>\d+)/unarchive',
|
142 |
+
array(
|
143 |
+
array(
|
144 |
+
'methods' => \WP_REST_Server::EDITABLE,
|
145 |
+
'callback' => array( $this, 'unarchive_poll' ),
|
146 |
+
'permission_callback' => array( $this, 'create_or_update_poll_permissions_check' ),
|
147 |
+
),
|
148 |
+
)
|
149 |
+
);
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Create a new poll.
|
154 |
+
*
|
155 |
+
* @param \WP_REST_Request $request The API Request.
|
156 |
+
* @return \WP_REST_Response|\WP_Error
|
157 |
+
* @since 0.9.0
|
158 |
+
*/
|
159 |
+
public function create_poll( \WP_REST_Request $request ) {
|
160 |
+
$data = $request->get_json_params();
|
161 |
+
$poll = Poll::from_array( $data );
|
162 |
+
$valid_or_wp_error = $poll->validate();
|
163 |
+
if ( is_wp_error( $valid_or_wp_error ) ) {
|
164 |
+
return $valid_or_wp_error;
|
165 |
+
}
|
166 |
+
|
167 |
+
$resulting_poll = Crowdsignal_Forms::instance()->get_api_gateway()->create_poll( $poll );
|
168 |
+
if ( is_wp_error( $resulting_poll ) ) {
|
169 |
+
return $resulting_poll;
|
170 |
+
}
|
171 |
+
|
172 |
+
return rest_ensure_response( $resulting_poll->to_array() );
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Update a poll.
|
177 |
+
*
|
178 |
+
* @param \WP_REST_Request $request The API Request.
|
179 |
+
* @return \WP_REST_Response|\WP_Error
|
180 |
+
* @since 0.9.0
|
181 |
+
*/
|
182 |
+
public function update_poll( \WP_REST_Request $request ) {
|
183 |
+
$data = $request->get_json_params();
|
184 |
+
$poll = Poll::from_array( $data );
|
185 |
+
$valid_or_wp_error = $poll->validate();
|
186 |
+
if ( is_wp_error( $valid_or_wp_error ) ) {
|
187 |
+
return $valid_or_wp_error;
|
188 |
+
}
|
189 |
+
|
190 |
+
$resulting_poll = Crowdsignal_Forms::instance()->get_api_gateway()->update_poll( $poll );
|
191 |
+
if ( is_wp_error( $resulting_poll ) ) {
|
192 |
+
return $resulting_poll;
|
193 |
+
}
|
194 |
+
|
195 |
+
return rest_ensure_response( $resulting_poll->to_array() );
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Archive a poll (Moves poll to the archive folder, does not delete).
|
200 |
+
*
|
201 |
+
* @param \WP_REST_Request $request The API Request.
|
202 |
+
* @return \WP_REST_Response|\WP_Error
|
203 |
+
* @since 0.9.0
|
204 |
+
*/
|
205 |
+
public function archive_poll( \WP_REST_Request $request ) {
|
206 |
+
$poll_id = $request->get_param( 'poll_id' );
|
207 |
+
if ( ! isset( $poll_id ) ) {
|
208 |
+
return new \WP_Error(
|
209 |
+
'no-poll-id',
|
210 |
+
__( 'No Poll ID was provided.', 'crowdsignal-forms' ),
|
211 |
+
array( 'status' => 400 )
|
212 |
+
);
|
213 |
+
}
|
214 |
+
|
215 |
+
$resulting_poll = Crowdsignal_Forms::instance()->get_api_gateway()->archive_poll( $poll_id );
|
216 |
+
if ( is_wp_error( $resulting_poll ) ) {
|
217 |
+
return $resulting_poll;
|
218 |
+
}
|
219 |
+
|
220 |
+
return rest_ensure_response( $resulting_poll->to_array() );
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Un-archive a poll (Moves poll to the most recently used user folder).
|
225 |
+
*
|
226 |
+
* @param \WP_REST_Request $request The API Request.
|
227 |
+
* @return \WP_REST_Response|\WP_Error
|
228 |
+
* @since 0.9.0
|
229 |
+
*/
|
230 |
+
public function unarchive_poll( \WP_REST_Request $request ) {
|
231 |
+
$poll_id = $request->get_param( 'poll_id' );
|
232 |
+
if ( ! isset( $poll_id ) ) {
|
233 |
+
return new \WP_Error(
|
234 |
+
'no-poll-id',
|
235 |
+
__( 'No Poll ID was provided.', 'crowdsignal-forms' ),
|
236 |
+
array( 'status' => 400 )
|
237 |
+
);
|
238 |
+
}
|
239 |
+
|
240 |
+
$resulting_poll = Crowdsignal_Forms::instance()->get_api_gateway()->unarchive_poll( $poll_id );
|
241 |
+
if ( is_wp_error( $resulting_poll ) ) {
|
242 |
+
return $resulting_poll;
|
243 |
+
}
|
244 |
+
|
245 |
+
return rest_ensure_response( $resulting_poll->to_array() );
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* The permission check for creating a new poll.
|
250 |
+
*
|
251 |
+
* @since 0.9.0
|
252 |
+
*
|
253 |
+
* @return bool
|
254 |
+
**/
|
255 |
+
public function create_or_update_poll_permissions_check() {
|
256 |
+
return current_user_can( 'publish_posts' );
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Get the polls.
|
261 |
+
*
|
262 |
+
* @since 0.9.0
|
263 |
+
*
|
264 |
+
* @return \WP_REST_Response
|
265 |
+
**/
|
266 |
+
public function get_polls() {
|
267 |
+
return rest_ensure_response( Crowdsignal_Forms::instance()->get_api_gateway()->get_polls() );
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* The permission check.
|
272 |
+
*
|
273 |
+
* @since 0.9.0
|
274 |
+
*
|
275 |
+
* @return bool
|
276 |
+
**/
|
277 |
+
public function get_polls_permissions_check() {
|
278 |
+
return true;
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Get a poll by ID.
|
283 |
+
*
|
284 |
+
* @since 0.9.0
|
285 |
+
*
|
286 |
+
* @param \WP_REST_Request $request
|
287 |
+
*
|
288 |
+
* @return \WP_REST_Response|\WP_Error
|
289 |
+
**/
|
290 |
+
public function get_poll( $request ) {
|
291 |
+
$poll_id = $request->get_param( 'poll_id' );
|
292 |
+
if ( null === $poll_id || ! is_numeric( $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 |
+
|
306 |
+
/**
|
307 |
+
* Get a post's poll given the post id and poll uuid.
|
308 |
+
*
|
309 |
+
* @since 0.9.0
|
310 |
+
*
|
311 |
+
* @param \WP_REST_Request $request
|
312 |
+
*
|
313 |
+
* @return \WP_REST_Response|\WP_Error
|
314 |
+
**/
|
315 |
+
public function get_post_poll_by_uuid( $request ) {
|
316 |
+
$post_id = $request->get_param( 'post_id' );
|
317 |
+
$poll_uuid = $request->get_param( 'poll_uuid' );
|
318 |
+
|
319 |
+
if ( null === $post_id || ! is_numeric( $post_id ) ) {
|
320 |
+
return new \WP_Error(
|
321 |
+
'invalid-post-id',
|
322 |
+
__( 'Invalid post ID', 'crowdsignal-forms' ),
|
323 |
+
array( 'status' => 400 )
|
324 |
+
);
|
325 |
+
}
|
326 |
+
|
327 |
+
$the_post = get_post( $post_id );
|
328 |
+
|
329 |
+
if ( empty( $the_post ) ) {
|
330 |
+
return $this->resource_not_found();
|
331 |
+
}
|
332 |
+
|
333 |
+
if ( null === $poll_uuid ) {
|
334 |
+
return new \WP_Error(
|
335 |
+
'invalid-poll-id',
|
336 |
+
__( 'Invalid poll ID', 'crowdsignal-forms' ),
|
337 |
+
array( 'status' => 400 )
|
338 |
+
);
|
339 |
+
}
|
340 |
+
|
341 |
+
$poll_saved_in_meta = Crowdsignal_Forms::instance()
|
342 |
+
->get_post_poll_meta_gateway()
|
343 |
+
->get_poll_data_for_poll_client_id( $post_id, $poll_uuid );
|
344 |
+
|
345 |
+
if ( empty( $poll_saved_in_meta ) || ! isset( $poll_saved_in_meta['id'] ) ) {
|
346 |
+
return $this->resource_not_found();
|
347 |
+
}
|
348 |
+
|
349 |
+
return rest_ensure_response( $poll_saved_in_meta );
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Get poll results by ID.
|
354 |
+
*
|
355 |
+
* @since 0.9.0
|
356 |
+
*
|
357 |
+
* @param \WP_REST_Request $request
|
358 |
+
*
|
359 |
+
* @return \WP_REST_Response
|
360 |
+
**/
|
361 |
+
public function get_poll_results( $request ) {
|
362 |
+
$poll_id = $request->get_param( 'poll_id' );
|
363 |
+
return rest_ensure_response( Crowdsignal_Forms::instance()->get_api_gateway()->get_poll_results( $poll_id ) );
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* The get-a-poll by ID permission check.
|
368 |
+
*
|
369 |
+
* @since 0.9.0
|
370 |
+
*
|
371 |
+
* @return bool
|
372 |
+
**/
|
373 |
+
public function get_poll_permissions_check() {
|
374 |
+
return true;
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Gets the collection params.
|
379 |
+
*
|
380 |
+
* @since 0.9.0
|
381 |
+
* @return array
|
382 |
+
*/
|
383 |
+
protected function get_collection_params() {
|
384 |
+
return array();
|
385 |
+
}
|
386 |
+
|
387 |
+
/**
|
388 |
+
* Returns a validator array for the get-a-poll by ID params.
|
389 |
+
*
|
390 |
+
* @see https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/
|
391 |
+
* @since 0.9.0
|
392 |
+
* @return array
|
393 |
+
*/
|
394 |
+
protected function get_poll_fetch_params() {
|
395 |
+
return array(
|
396 |
+
'poll_id' => array(
|
397 |
+
'validate_callback' => function( $param, $request, $key ) {
|
398 |
+
return is_numeric( $param );
|
399 |
+
},
|
400 |
+
),
|
401 |
+
);
|
402 |
+
}
|
403 |
+
|
404 |
+
/**
|
405 |
+
* For not-found.
|
406 |
+
*
|
407 |
+
* @since 0.9.0
|
408 |
+
* @return \WP_Error
|
409 |
+
*/
|
410 |
+
private function resource_not_found() {
|
411 |
+
return new \WP_Error(
|
412 |
+
'resource-not-found',
|
413 |
+
__( 'Resource not found', 'crowdsignal-forms' ),
|
414 |
+
array( 'status' => 404 )
|
415 |
+
);
|
416 |
+
}
|
417 |
+
}
|
includes/rest-api/controllers/index.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// phpcs:ignoreFile -- Silence is golden.
|
index.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// phpcs:ignoreFile -- Silence is golden.
|
languages/crowdsignal-forms.pot
ADDED
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2020 Automattic
|
2 |
+
# This file is distributed under the GPL-2.0+.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: Crowdsignal Forms 0.9.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-07-27T13:38:00+00:00\n"
|
13 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
+
"X-Generator: WP-CLI 2.5.0-alpha-c4c9f7e\n"
|
15 |
+
"X-Domain: crowdsignal-forms\n"
|
16 |
+
|
17 |
+
#. Plugin Name of the plugin
|
18 |
+
msgid "Crowdsignal Forms"
|
19 |
+
msgstr ""
|
20 |
+
|
21 |
+
#. Plugin URI of the plugin
|
22 |
+
msgid "https://crowdsignal.com/crowdsignal-forms/"
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
#. Description of the plugin
|
26 |
+
msgid "Crowdsignal Form Blocks"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#. Author of the plugin
|
30 |
+
msgid "Automattic"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#. Author URI of the plugin
|
34 |
+
msgid "https://automattic.com/"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: includes/admin/class-crowdsignal-forms-admin-notices.php:112
|
38 |
+
msgid "Action failed. Please refresh the page and retry."
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#: includes/admin/class-crowdsignal-forms-admin-notices.php:116
|
42 |
+
msgid "You don’t have permission to do this."
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: includes/admin/class-crowdsignal-forms-admin.php:70
|
46 |
+
msgid "Crowdsignal"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: includes/admin/class-crowdsignal-forms-admin.php:71
|
50 |
+
#: includes/admin/class-crowdsignal-forms-admin.php:86
|
51 |
+
msgid "Settings"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: includes/admin/class-crowdsignal-forms-admin.php:72
|
55 |
+
#: includes/admin/class-crowdsignal-forms-admin.php:85
|
56 |
+
msgid "Getting Started"
|
57 |
+
msgstr ""
|
58 |
+
|
59 |
+
#: includes/admin/class-crowdsignal-forms-settings.php:71
|
60 |
+
msgid "General"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#: includes/admin/class-crowdsignal-forms-settings.php:76
|
64 |
+
#: includes/admin/class-crowdsignal-forms-settings.php:184
|
65 |
+
msgid "Enter Crowdsignal API Key"
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#. translators: %s is a link to the Crowdsignal connection page.
|
69 |
+
#: includes/admin/class-crowdsignal-forms-settings.php:163
|
70 |
+
msgid "To collect responses and data with Crowdsignal Forms you need to <a href=\"%s\" target=\"_blank\">connect the plugin with a Crowdsignal account.</a>"
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
+
#: includes/admin/class-crowdsignal-forms-settings.php:169
|
74 |
+
msgid "You can do this by entering an API key below:"
|
75 |
+
msgstr ""
|
76 |
+
|
77 |
+
#: includes/admin/class-crowdsignal-forms-settings.php:176
|
78 |
+
msgid "Settings successfully saved"
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: includes/admin/class-crowdsignal-forms-settings.php:204
|
82 |
+
msgid "Disconnect"
|
83 |
+
msgstr ""
|
84 |
+
|
85 |
+
#: includes/admin/class-crowdsignal-forms-settings.php:210
|
86 |
+
msgid "Connect"
|
87 |
+
msgstr ""
|
88 |
+
|
89 |
+
#: includes/admin/class-crowdsignal-forms-settings.php:221
|
90 |
+
msgid "If you don't have an API key we can help you here:"
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#: includes/admin/views/html-admin-notice-core-setup.php:17
|
94 |
+
msgid "You are nearly ready to start creating polls with <strong>Crowdsignal</strong>."
|
95 |
+
msgstr ""
|
96 |
+
|
97 |
+
#: includes/admin/views/html-admin-notice-core-setup.php:21
|
98 |
+
msgid "Let's Get Started"
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: includes/admin/views/html-admin-notice-core-setup.php:22
|
102 |
+
msgid "Skip Setup"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: includes/admin/views/html-admin-setup-footer.php:24
|
106 |
+
msgid "Crowdsignal Support"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: includes/admin/views/html-admin-setup-footer.php:24
|
110 |
+
msgid "Support"
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#: includes/admin/views/html-admin-setup-footer.php:25
|
114 |
+
msgid "Terms of Service"
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: includes/admin/views/html-admin-setup-footer.php:25
|
118 |
+
msgid "Terms"
|
119 |
+
msgstr ""
|
120 |
+
|
121 |
+
#: includes/admin/views/html-admin-setup-footer.php:26
|
122 |
+
msgid "Privacy Policy"
|
123 |
+
msgstr ""
|
124 |
+
|
125 |
+
#: includes/admin/views/html-admin-setup-footer.php:26
|
126 |
+
msgid "Privacy"
|
127 |
+
msgstr ""
|
128 |
+
|
129 |
+
#: includes/admin/views/html-admin-setup-header.php:43
|
130 |
+
msgid "Could not disconnect. Please try again."
|
131 |
+
msgstr ""
|
132 |
+
|
133 |
+
#: includes/admin/views/html-admin-setup-header.php:46
|
134 |
+
msgid "Successfully disconnected from Crowdsignal."
|
135 |
+
msgstr ""
|
136 |
+
|
137 |
+
#: includes/admin/views/html-admin-setup-header.php:49
|
138 |
+
msgid "Success! Your Crowdsignal account is successfully connected! You are ready!"
|
139 |
+
msgstr ""
|
140 |
+
|
141 |
+
#: includes/admin/views/html-admin-setup-header.php:52
|
142 |
+
msgid "You have been connected to Crowdsignal."
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: includes/admin/views/html-admin-setup-header.php:55
|
146 |
+
msgid "Your API key has not been updated."
|
147 |
+
msgstr ""
|
148 |
+
|
149 |
+
#: includes/admin/views/html-admin-setup-step-1.php:14
|
150 |
+
msgid "Welcome to Crowdsignal Forms"
|
151 |
+
msgstr ""
|
152 |
+
|
153 |
+
#: includes/admin/views/html-admin-setup-step-1.php:24
|
154 |
+
msgid "Let’s get started"
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#: includes/admin/views/html-admin-setup-step-2.php:20
|
158 |
+
msgid "You're ready to start using Crowdsignal!"
|
159 |
+
msgstr ""
|
160 |
+
|
161 |
+
#: includes/admin/views/html-admin-setup-step-3.php:15
|
162 |
+
msgid "First time using Crowdsignal?"
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: includes/admin/views/html-admin-setup-step-3.php:20
|
166 |
+
msgid "You can search for our blocks, like the Poll block, in the library of the block editor."
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
#: includes/admin/views/html-admin-setup-step-3.php:22
|
170 |
+
msgid "Here is a short video to get you started:"
|
171 |
+
msgstr ""
|
172 |
+
|
173 |
+
#. translators: Argument is a link to Crowdsignal's contact page.
|
174 |
+
#: includes/admin/views/html-admin-setup-step-3.php:37
|
175 |
+
msgid "<a href=\"%1s\" target=\"_blank\">Any questions about Crowdsignal?</a>"
|
176 |
+
msgstr ""
|
177 |
+
|
178 |
+
#. translators: Argument is a link to Crowdsignal's support page.
|
179 |
+
#: includes/admin/views/html-admin-setup-step-3.php:52
|
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:149
|
184 |
+
msgid "Untitled Poll"
|
185 |
+
msgstr ""
|
186 |
+
|
187 |
+
#: includes/frontend/blocks/class-crowdsignal-forms-poll-block.php:178
|
188 |
+
msgid "Submit"
|
189 |
+
msgstr ""
|
190 |
+
|
191 |
+
#: includes/gateways/class-canned-api-gateway.php:60
|
192 |
+
#: includes/gateways/class-canned-api-gateway.php:79
|
193 |
+
msgid "Poll not found"
|
194 |
+
msgstr ""
|
195 |
+
|
196 |
+
#: includes/rest-api/controllers/class-polls-controller.php:210
|
197 |
+
#: includes/rest-api/controllers/class-polls-controller.php:235
|
198 |
+
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:336
|
203 |
+
msgid "Invalid poll ID"
|
204 |
+
msgstr ""
|
205 |
+
|
206 |
+
#: includes/rest-api/controllers/class-polls-controller.php:322
|
207 |
+
msgid "Invalid post ID"
|
208 |
+
msgstr ""
|
209 |
+
|
210 |
+
#: includes/rest-api/controllers/class-polls-controller.php:413
|
211 |
+
msgid "Resource not found"
|
212 |
+
msgstr ""
|
uninstall.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Fired when the plugin is uninstalled.
|
4 |
+
*
|
5 |
+
* When populating this file, consider the following flow
|
6 |
+
* of control:
|
7 |
+
*
|
8 |
+
* - This method should be static
|
9 |
+
* - Check if the $_REQUEST content actually is the plugin name
|
10 |
+
* - Run an admin referrer check to make sure it goes through authentication
|
11 |
+
* - Verify the output of $_GET makes sense
|
12 |
+
* - Repeat with other user roles. Best directly by using the links/query string parameters.
|
13 |
+
* - Repeat things for multisite. Once for a single site in the network, once sitewide.
|
14 |
+
*
|
15 |
+
* This file may be updated more in future version of the Boilerplate; however, this is the
|
16 |
+
* general skeleton and outline for how the file should work.
|
17 |
+
*
|
18 |
+
* For more information, see the following discussion:
|
19 |
+
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
|
20 |
+
*
|
21 |
+
* @link http://example.com
|
22 |
+
* @since 0.9.0
|
23 |
+
*
|
24 |
+
* @package Crowdsignal_Forms
|
25 |
+
*/
|
26 |
+
|
27 |
+
// If uninstall not called from WordPress, then exit.
|
28 |
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
29 |
+
exit;
|
30 |
+
}
|