Version Description
- Gutenberg fixes and improvements
Download this release
Release Info
Developer | kucaahbe |
Plugin | Poll, Survey, Quiz, Slideshow, Form, Story & Landing Page |
Version | 19.6.15 |
Comparing to | |
See all releases |
Code changes from version 19.6.14 to 19.6.15
- admin/content-popup-gutenberg-template.html.php +288 -0
- admin/content-popup.php +7 -3
- admin/views/deactivate-feedback-form.php +53 -14
- gutenberg/.editorconfig +21 -21
- gutenberg/.eslintignore +9 -9
- gutenberg/.eslintrc.json +192 -192
- gutenberg/.gitignore +84 -84
- gutenberg/form/dist/blocks.build.js +1 -1
- gutenberg/form/dist/blocks.editor.build.css +1 -1
- gutenberg/form/src/.DS_Store +0 -0
- gutenberg/form/src/block/block.js +98 -44
- gutenberg/form/src/block/editor.scss +16 -2
- gutenberg/init.php +2 -2
- gutenberg/personality/dist/blocks.build.js +1 -1
- gutenberg/personality/dist/blocks.editor.build.css +1 -1
- gutenberg/personality/src/.DS_Store +0 -0
- gutenberg/personality/src/block/block.js +96 -42
- gutenberg/personality/src/block/editor.scss +16 -2
- gutenberg/poll/dist/blocks.build.js +1 -1
- gutenberg/poll/dist/blocks.editor.build.css +1 -1
- gutenberg/poll/src/.DS_Store +0 -0
- gutenberg/poll/src/block/block.js +93 -39
- gutenberg/poll/src/block/editor.scss +21 -7
- gutenberg/slideshow/dist/blocks.build.js +1 -1
- gutenberg/slideshow/dist/blocks.editor.build.css +1 -1
- gutenberg/slideshow/src/.DS_Store +0 -0
- gutenberg/slideshow/src/block/block.js +94 -39
- gutenberg/slideshow/src/block/editor.scss +16 -2
- gutenberg/survey/dist/blocks.build.js +1 -1
- gutenberg/survey/dist/blocks.editor.build.css +1 -1
- gutenberg/survey/src/.DS_Store +0 -0
- gutenberg/survey/src/block/block.js +93 -39
- gutenberg/survey/src/block/editor.scss +16 -2
- gutenberg/trivia/dist/blocks.build.js +1 -1
- gutenberg/trivia/dist/blocks.editor.build.css +1 -1
- gutenberg/trivia/src/.DS_Store +0 -0
- gutenberg/trivia/src/block/block.js +93 -39
- gutenberg/trivia/src/block/editor.scss +16 -2
- includes/opinionstage-functions.php +18 -1
- includes/opinionstage-utility-functions.php +12 -0
- opinionstage-polls.php +1 -1
- plugin.php +2 -2
- readme.txt +3 -1
admin/content-popup-gutenberg-template.html.php
ADDED
@@ -0,0 +1,288 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// block direct access to plugin PHP files:
|
3 |
+
defined( 'ABSPATH' ) or die();
|
4 |
+
|
5 |
+
require_once( plugin_dir_path( __FILE__ ).'../includes/opinionstage-client-session.php' );
|
6 |
+
|
7 |
+
$opinionstage_user_logged_in = opinionstage_user_logged_in();
|
8 |
+
|
9 |
+
function opinionstage_create_new_href() {
|
10 |
+
return OPINIONSTAGE_SERVER_BASE.'/dashboard/content';
|
11 |
+
}
|
12 |
+
|
13 |
+
// Note: all html put here (not moved to js build system) in order to preserve ability to use Wordpress translate APIs
|
14 |
+
?>
|
15 |
+
<template data-opinionstage-content-popup-template>
|
16 |
+
<div class='opinionstage-content-popup-contents' data-opinionstage-content-popup data-opinionstage-client-logged-in="<?php echo $opinionstage_user_logged_in ?>">
|
17 |
+
<header class='header'>
|
18 |
+
<div class='header__container'>
|
19 |
+
<div class='header__logo'>
|
20 |
+
<a href='<?php echo OPINIONSTAGE_SERVER_BASE ?>' target='_blank'>
|
21 |
+
<img src='<?php echo plugins_url('admin/images/logo.svg', plugin_dir_path( __FILE__ )) ?>'>
|
22 |
+
</a>
|
23 |
+
</div>
|
24 |
+
<div class='header__action'>
|
25 |
+
<?php if ( $opinionstage_user_logged_in ) { ?>
|
26 |
+
<div class="create-new-menu-box">
|
27 |
+
<a href="javascript:void(0)" class="btn-create">CREATE NEW</a>
|
28 |
+
<div class="create-new-menu">
|
29 |
+
<li class="create-menu__itm companymenuli">
|
30 |
+
<a class="alisting">poll</a>
|
31 |
+
<ul class="submenu">
|
32 |
+
<li><?php echo opinionstage_create_poll_link('create-menu__itm'); ?></li>
|
33 |
+
<li><?php echo opinionstage_template_poll_link('create-menu__itm'); ?></li>
|
34 |
+
</ul>
|
35 |
+
</li>
|
36 |
+
<li class="create-menu__itm companymenuli">
|
37 |
+
<a class="alisting">multi poll set</a>
|
38 |
+
<ul class="submenu">
|
39 |
+
<li><?php echo opinionstage_create_poll_set_link('create-menu__itm', __('Create New')) ?></li>
|
40 |
+
<!-- <li><?php echo opinionstage_template_survey_link('create-menu__itm', __('survey')) ?></li> -->
|
41 |
+
</ul>
|
42 |
+
</li>
|
43 |
+
<li class="create-menu__itm companymenuli">
|
44 |
+
<a class="alisting">survey</a>
|
45 |
+
<ul class="submenu">
|
46 |
+
<li><?php echo opinionstage_create_widget_link('survey', 'create-menu__itm'); ?></li>
|
47 |
+
<li><?php echo opinionstage_template_survey_link('create-menu__itm'); ?></li>
|
48 |
+
</ul>
|
49 |
+
</li>
|
50 |
+
<li class="create-menu__itm companymenuli">
|
51 |
+
<a class="alisting">slideshow</a>
|
52 |
+
<ul class="submenu">
|
53 |
+
<li><?php echo opinionstage_create_slideshow_link( 'create-menu__itm' ); ?></li>
|
54 |
+
<li><?php echo opinionstage_template_slideshow_link('create-menu__itm') ?></li>
|
55 |
+
</ul>
|
56 |
+
</li>
|
57 |
+
<li class="create-menu__itm companymenuli">
|
58 |
+
<a class="alisting">trivia quiz</a>
|
59 |
+
<ul class="submenu">
|
60 |
+
<li><?php echo opinionstage_create_widget_link('quiz', 'create-menu__itm'); ?></li>
|
61 |
+
<li><?php echo opinionstage_template_trivia_link('create-menu__itm'); ?></li>
|
62 |
+
</ul>
|
63 |
+
</li>
|
64 |
+
<li class="create-menu__itm companymenuli">
|
65 |
+
<a class="alisting">personality quiz</a>
|
66 |
+
<ul class="submenu">
|
67 |
+
<li><?php echo opinionstage_create_widget_link('outcome', 'create-menu__itm'); ?></li>
|
68 |
+
<li><?php echo opinionstage_template_personality_quiz_link('create-menu__itm') ?></li>
|
69 |
+
</ul>
|
70 |
+
</li>
|
71 |
+
<li class="create-menu__itm companymenuli">
|
72 |
+
<a class="alisting">list</a>
|
73 |
+
<ul class="submenu">
|
74 |
+
<li><?php echo opinionstage_create_widget_link('list', 'create-menu__itm'); ?></li>
|
75 |
+
<li><?php echo opinionstage_template_list_link('create-menu__itm'); ?></li>
|
76 |
+
</ul>
|
77 |
+
</li>
|
78 |
+
<li class="create-menu__itm companymenuli">
|
79 |
+
<a class="alisting">form</a>
|
80 |
+
<ul class="submenu">
|
81 |
+
<li><?php echo opinionstage_create_widget_link('contact_form', 'create-menu__itm'); ?></li>
|
82 |
+
<li><?php echo opinionstage_template_form_link('create-menu__itm'); ?></li>
|
83 |
+
</ul>
|
84 |
+
</li>
|
85 |
+
<li class="create-menu__itm companymenuli">
|
86 |
+
<a class="alisting">story</a>
|
87 |
+
<ul class="submenu">
|
88 |
+
<li><?php echo opinionstage_create_widget_link('story', 'create-menu__itm'); ?></li>
|
89 |
+
</ul>
|
90 |
+
</li>
|
91 |
+
</div>
|
92 |
+
</div>
|
93 |
+
<?php } ?>
|
94 |
+
<div class='btn-close' @click="closePopup">X</div>
|
95 |
+
</div>
|
96 |
+
</div>
|
97 |
+
</header>
|
98 |
+
<section>
|
99 |
+
<popup-content
|
100 |
+
:show-client-content="showClientContent"
|
101 |
+
:client-is-logged-in="isClientLoggedIn"
|
102 |
+
:modal-is-opened="isModalOpened"
|
103 |
+
@insert-shortcode="insertShortcode"
|
104 |
+
client-widgets-url="<?php echo OPINIONSTAGE_CONTENT_POPUP_CLIENT_WIDGETS_API ?>"
|
105 |
+
shared-widgets-url="<?php echo OPINIONSTAGE_CONTENT_POPUP_SHARED_WIDGETS_API ?>"
|
106 |
+
client-widgets-has-new-url="<?php echo OPINIONSTAGE_CONTENT_POPUP_CLIENT_WIDGETS_API_RECENT_UPDATE ?>"
|
107 |
+
access-key="<?php echo opinionstage_user_access_token() ?>"
|
108 |
+
plugin-version="<?php echo OPINIONSTAGE_WIDGET_VERSION ?>"
|
109 |
+
>
|
110 |
+
</popup-content>
|
111 |
+
</section>
|
112 |
+
</div>
|
113 |
+
</template>
|
114 |
+
|
115 |
+
<template id="opinionstage-widget-list">
|
116 |
+
<div class='page-content'>
|
117 |
+
<div class='content-actions'>
|
118 |
+
<div class='filter'>
|
119 |
+
<div class="dropdown">
|
120 |
+
<button class="dropbtn" id="dropbtn"><span>All ITEMS</span></button>
|
121 |
+
<div class="dropdown-content">
|
122 |
+
<div class='filter__itm'
|
123 |
+
@click="selectWidgetType('all')"
|
124 |
+
:class="{ active: selectedWidgetType === 'all' }"
|
125 |
+
>all Items</div>
|
126 |
+
<div class='filter__itm'
|
127 |
+
@click="selectWidgetType('poll')"
|
128 |
+
:class="{ active: selectedWidgetType === 'poll' }"
|
129 |
+
>poll</div>
|
130 |
+
<div class='filter__itm'
|
131 |
+
@click="selectWidgetType('set')"
|
132 |
+
:class="{ active: selectedWidgetType === 'set' }"
|
133 |
+
>multi poll set</div>
|
134 |
+
<div class='filter__itm'
|
135 |
+
@click="selectWidgetType('survey')"
|
136 |
+
:class="{ active: selectedWidgetType === 'survey' }"
|
137 |
+
>survey</div>
|
138 |
+
<div class='filter__itm'
|
139 |
+
@click="selectWidgetType('slideshow')"
|
140 |
+
:class="{ active: selectedWidgetType === 'slideshow' }"
|
141 |
+
>slideshow</div>
|
142 |
+
<div class='filter__itm'
|
143 |
+
@click="selectWidgetType('trivia')"
|
144 |
+
:class="{ active: selectedWidgetType === 'trivia' }"
|
145 |
+
>trivia quiz</div>
|
146 |
+
<div class='filter__itm'
|
147 |
+
@click="selectWidgetType('outcome')"
|
148 |
+
:class="{ active: selectedWidgetType === 'outcome' }"
|
149 |
+
>personality quiz</div>
|
150 |
+
<div class='filter__itm'
|
151 |
+
@click="selectWidgetType('list')"
|
152 |
+
:class="{ active: selectedWidgetType === 'list' }"
|
153 |
+
>list</div>
|
154 |
+
<div class='filter__itm'
|
155 |
+
@click="selectWidgetType('form')"
|
156 |
+
:class="{ active: selectedWidgetType === 'form' }"
|
157 |
+
>form</div>
|
158 |
+
<div class='filter__itm'
|
159 |
+
@click="selectWidgetType('story')"
|
160 |
+
:class="{ active: selectedWidgetType === 'story' }"
|
161 |
+
>story article</div>
|
162 |
+
</div>
|
163 |
+
</div>
|
164 |
+
</div>
|
165 |
+
<div class='search' style="width: 180px;">
|
166 |
+
<input
|
167 |
+
class='std-search'
|
168 |
+
placeholder='Search...'
|
169 |
+
type='text'
|
170 |
+
v-model='widgetTitleSearch'
|
171 |
+
:class='{ hidden: !showSearch }'
|
172 |
+
>
|
173 |
+
</div>
|
174 |
+
</div>
|
175 |
+
<div class='content__list'>
|
176 |
+
<div v-if='hasData'>
|
177 |
+
<div class='content__itm' v-for="widget in widgets">
|
178 |
+
<div class='content__image'>
|
179 |
+
<img :src='widget.imageUrl'>
|
180 |
+
<div class='content__label'>{{ widget.type }}</div>
|
181 |
+
</div>
|
182 |
+
<p class='content__info'>{{ widget.title }}</p>
|
183 |
+
<div class='content__links'>
|
184 |
+
<button class='content__links-itm'
|
185 |
+
@click="var shortcode = widget.landingPageUrl.replace('https://www.opinionstage.com',''); window.verifyOSInsert(shortcode)">insert</button>
|
186 |
+
<a class='content__links-itm' target="_blank" :href='widget.landingPageUrl'>view</a>
|
187 |
+
<a class='content__links-itm' target="_blank" :href='widget.editUrl' v-show="!widget.template">edit</a>
|
188 |
+
<a class='content__links-itm' target="_blank" :href='widget.statsUrl' v-show="!widget.template">statistics</a>
|
189 |
+
</div>
|
190 |
+
</div>
|
191 |
+
<div class='content__loading' v-if='dataLoading'>
|
192 |
+
loading...
|
193 |
+
</div>
|
194 |
+
<div v-else>
|
195 |
+
<button
|
196 |
+
class='btn-show-more'
|
197 |
+
v-if='!noMoreData'
|
198 |
+
@click='showMore'
|
199 |
+
>Click for more</button>
|
200 |
+
</div>
|
201 |
+
</div>
|
202 |
+
<div v-else>
|
203 |
+
No content found
|
204 |
+
</div>
|
205 |
+
</div>
|
206 |
+
</div>
|
207 |
+
</template>
|
208 |
+
|
209 |
+
<template id="opinionstage-popup-content">
|
210 |
+
<div v-if="showClientContent">
|
211 |
+
<div v-if="clientIsLoggedIn">
|
212 |
+
<div v-if="newWidgetsAvailable" class="notification-container">
|
213 |
+
<notification
|
214 |
+
:widget-type='searchCriteria.type'
|
215 |
+
@reload='reloadData'
|
216 |
+
@hide='startWidgetUpdatesChecker'
|
217 |
+
>
|
218 |
+
</div>
|
219 |
+
<widget-list
|
220 |
+
:widgets='widgets'
|
221 |
+
:data-loading='dataLoading'
|
222 |
+
:show-search='true'
|
223 |
+
:no-more-data='noMoreData'
|
224 |
+
@insert-shortcode="insertShortcode"
|
225 |
+
@widgets-search-update='reloadData'
|
226 |
+
@load-more-widgets='appendData'
|
227 |
+
>
|
228 |
+
</div>
|
229 |
+
<div class='page-content' v-else>
|
230 |
+
<div class="bordered-container">
|
231 |
+
<h1 class='main-title'>
|
232 |
+
<b>Connect WordPress</b>
|
233 |
+
<span>with</span>
|
234 |
+
<b>Opinion Stage</b>
|
235 |
+
<span>to get started</span>
|
236 |
+
</h1>
|
237 |
+
<form action="<?php echo OPINIONSTAGE_LOGIN_PATH ?>" method="get" class="opinionstage-connect-form">
|
238 |
+
<input type="hidden" name="utm_source" value="<?php echo OPINIONSTAGE_UTM_SOURCE ?>">
|
239 |
+
<input type="hidden" name="utm_campaign" value="<?php echo OPINIONSTAGE_UTM_CAMPAIGN ?>">
|
240 |
+
<input type="hidden" name="utm_medium" value="<?php echo OPINIONSTAGE_UTM_MEDIUM ?>">
|
241 |
+
<input type="hidden" name="o" value="<?php echo OPINIONSTAGE_WIDGET_API_KEY ?>">
|
242 |
+
<input type="hidden" name="callback" value="<?php echo opinionstage_custom_content_popup_callback_url() ?>">
|
243 |
+
<input id="os-email" type="email" name="email" placeholder="Enter Your Email" data-os-email-input class="opinionstage-conect-input">
|
244 |
+
<button class="opinionstage-blue-btn" type="submit" id="os-start-login" data-os-login>CONNECT</button>
|
245 |
+
</form>
|
246 |
+
</div>
|
247 |
+
</div>
|
248 |
+
</div>
|
249 |
+
<div v-else>
|
250 |
+
<widget-list
|
251 |
+
:widgets='widgets'
|
252 |
+
:data-loading='dataLoading'
|
253 |
+
:show-search='false'
|
254 |
+
:no-more-data='noMoreData'
|
255 |
+
@insert-shortcode='insertShortcode'
|
256 |
+
@widgets-search-update='reloadData'
|
257 |
+
@load-more-widgets='appendData'
|
258 |
+
>
|
259 |
+
</div>
|
260 |
+
</template>
|
261 |
+
|
262 |
+
<template id="opinionstage-notification">
|
263 |
+
<div class="opinionstage-section-notification">
|
264 |
+
<p class="opinionstage-section-notification__title">
|
265 |
+
Your content has been updated, please click the button to update your view
|
266 |
+
</p>
|
267 |
+
<div class="opinionstage-section-notification__controls">
|
268 |
+
<button class='btn-blue' @click="reload">Update view</button>
|
269 |
+
</div>
|
270 |
+
</div>
|
271 |
+
</template>
|
272 |
+
<script>
|
273 |
+
jQuery(document).ready(function ($) {
|
274 |
+
$('.filter__itm').live('click', function(e) {
|
275 |
+
var text = $(this).text();
|
276 |
+
$("button#dropbtn span").text(text);
|
277 |
+
});
|
278 |
+
$('div#show-templates').live('click', function(e) {
|
279 |
+
var inputs = $(".filter__itm");
|
280 |
+
for(var i = 0; i < inputs.length; i++){
|
281 |
+
if($(inputs[i]).text() == 'story article'){
|
282 |
+
$(inputs[i]).hide();
|
283 |
+
break;
|
284 |
+
}
|
285 |
+
}
|
286 |
+
});
|
287 |
+
});
|
288 |
+
</script>
|
admin/content-popup.php
CHANGED
@@ -24,7 +24,11 @@ function opinionstage_content_popup_js() {
|
|
24 |
}
|
25 |
|
26 |
function opinionstage_content_popup_html() {
|
27 |
-
|
|
|
|
|
|
|
|
|
28 |
<script>
|
29 |
jQuery(document).ready(function ($) {
|
30 |
$('span#oswpLauncherContentPopupExamples').parent().attr({'data-opinionstage-content-launch':"", 'data-os-view':"examples"});
|
@@ -141,8 +145,8 @@ button#dropbtn:after {
|
|
141 |
position: absolute;
|
142 |
top: 0;
|
143 |
width: 40px;
|
144 |
-
right: -
|
145 |
-
height:
|
146 |
border: 1px solid #e4e4e4;
|
147 |
top: -1px;
|
148 |
border-left: 0px !important;
|
24 |
}
|
25 |
|
26 |
function opinionstage_content_popup_html() {
|
27 |
+
if(opinionstage_is_guten_enabled() == true){
|
28 |
+
require( plugin_dir_path( __FILE__ ).'content-popup-gutenberg-template.html.php');
|
29 |
+
}else{
|
30 |
+
require( plugin_dir_path( __FILE__ ).'content-popup-template.html.php');
|
31 |
+
} ?>
|
32 |
<script>
|
33 |
jQuery(document).ready(function ($) {
|
34 |
$('span#oswpLauncherContentPopupExamples').parent().attr({'data-opinionstage-content-launch':"", 'data-os-view':"examples"});
|
145 |
position: absolute;
|
146 |
top: 0;
|
147 |
width: 40px;
|
148 |
+
right: -40px;
|
149 |
+
height: 45px;
|
150 |
border: 1px solid #e4e4e4;
|
151 |
top: -1px;
|
152 |
border-left: 0px !important;
|
admin/views/deactivate-feedback-form.php
CHANGED
@@ -1,11 +1,22 @@
|
|
1 |
<?php
|
|
|
2 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
3 |
-
$os_client_logged_in = opinionstage_user_logged_in();
|
|
|
4 |
if(!$os_client_logged_in){
|
|
|
5 |
$connectionOpinionStagePlugin = 'Not Connected';
|
6 |
}else{
|
|
|
7 |
$connectionOpinionStagePlugin = 'Connected';
|
8 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
?>
|
10 |
<style type="text/css">
|
11 |
.os-feedback-modal-wrapper {
|
@@ -80,7 +91,6 @@ mixpanel.init("73bec82504e0f14a7dba16aebd26b97d",{
|
|
80 |
<script type="text/javascript">
|
81 |
// OS Modal JS here
|
82 |
jQuery(document).ready(function($){
|
83 |
-
|
84 |
// elements
|
85 |
var elemModal = $('.os-feedback-modal-wrapper');
|
86 |
var elemOpen = $('.plugins [data-slug="social-polls-by-opinionstage"] .deactivate');
|
@@ -101,22 +111,51 @@ mixpanel.init("73bec82504e0f14a7dba16aebd26b97d",{
|
|
101 |
|
102 |
$(elemSend).click(function(){
|
103 |
|
104 |
-
if( jQuery('input[name=reason]:checked', $(elemModal)).length > 0 ){
|
105 |
-
elemModal.fadeOut();
|
106 |
-
|
107 |
var reason = jQuery('input[name=reason]:checked', $(elemModal)).val();
|
|
|
|
|
|
|
108 |
if(reason == 'I found a better plugin.'){
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
}else if(reason == 'Other:'){
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
-
$opswConnected = '<?php echo $connectionOpinionStagePlugin; ?>';
|
114 |
-
mixpanel.track("WordPress Opinion Stage Disconnect",
|
115 |
-
{"reason": reason, "details": reason ,"url": window.location.href,"opinionStagePluginConnect": $opswConnected, },
|
116 |
-
function(){
|
117 |
-
window.location = elemOpen.find('a').attr('href');
|
118 |
-
}
|
119 |
-
);
|
120 |
}else{
|
121 |
// show error.
|
122 |
$('span.alert-error').html('Please select one of the options.');
|
1 |
<?php
|
2 |
+
global $wp_version;
|
3 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
4 |
+
$os_client_logged_in = opinionstage_user_logged_in();
|
5 |
+
|
6 |
if(!$os_client_logged_in){
|
7 |
+
$connectedEmail = '';
|
8 |
$connectionOpinionStagePlugin = 'Not Connected';
|
9 |
}else{
|
10 |
+
$connectedEmail = $os_options['email'];
|
11 |
$connectionOpinionStagePlugin = 'Connected';
|
12 |
}
|
13 |
+
|
14 |
+
$item_count = $os_options['item_count'];
|
15 |
+
$active_plugins=get_option('active_plugins');
|
16 |
+
foreach($active_plugins as $key => $value) {
|
17 |
+
$plugin = explode('/',$value); // Folder name will be displayed
|
18 |
+
$plugin_list[] = $plugin[0];
|
19 |
+
}
|
20 |
?>
|
21 |
<style type="text/css">
|
22 |
.os-feedback-modal-wrapper {
|
91 |
<script type="text/javascript">
|
92 |
// OS Modal JS here
|
93 |
jQuery(document).ready(function($){
|
|
|
94 |
// elements
|
95 |
var elemModal = $('.os-feedback-modal-wrapper');
|
96 |
var elemOpen = $('.plugins [data-slug="social-polls-by-opinionstage"] .deactivate');
|
111 |
|
112 |
$(elemSend).click(function(){
|
113 |
|
114 |
+
if( jQuery('input[name=reason]:checked', $(elemModal)).length > 0 ){
|
|
|
|
|
115 |
var reason = jQuery('input[name=reason]:checked', $(elemModal)).val();
|
116 |
+
var validReason = false;
|
117 |
+
|
118 |
+
if(reason == 'I found a better plugin.' || reason == 'Other:' ){
|
119 |
if(reason == 'I found a better plugin.'){
|
120 |
+
if ($('.os-other-plugin').val()){
|
121 |
+
validReason = true;
|
122 |
+
reason = 'Found better plugin: ' + $('.os-other-plugin').val();
|
123 |
+
}
|
124 |
+
else {
|
125 |
+
$('span.alert-error').html('Please share the plugin name.');
|
126 |
+
}
|
127 |
}else if(reason == 'Other:'){
|
128 |
+
if ($('.os-other-reason').val()){
|
129 |
+
validReason = true;
|
130 |
+
reason = 'Other: ' + $('.os-other-reason').val();
|
131 |
+
}
|
132 |
+
else {
|
133 |
+
$('span.alert-error').html('Please share your Reason.');
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
else
|
138 |
+
{
|
139 |
+
validReason = true;
|
140 |
+
}
|
141 |
+
|
142 |
+
if (validReason == true) {
|
143 |
+
elemModal.fadeOut();
|
144 |
+
$opswConnected = '<?php echo $connectionOpinionStagePlugin; ?>';
|
145 |
+
$ospVersion = '<?php echo $wp_version; ?>';
|
146 |
+
$ospTheme = '<?php echo wp_get_theme(); ?>';
|
147 |
+
$ospPluginList = '<?php echo json_encode($plugin_list); ?>';
|
148 |
+
$ospEmail = '<?php echo $connectedEmail; ?>';
|
149 |
+
$ospItemCount = '<?php echo $item_count; ?>';
|
150 |
+
$pluginVersion="<?php echo OPINIONSTAGE_WIDGET_VERSION ?>";
|
151 |
+
|
152 |
+
mixpanel.track("WordPress Opinion Stage Disconnect",
|
153 |
+
{"reason": reason, "details": reason ,"url": window.location.href,"opinionStagePluginConnect": $opswConnected, "wpVersion": $ospVersion, "osVersion": $pluginVersion, "theme": $ospTheme, "pluginList": $ospPluginList, "email": $ospEmail, 'totalItem': $ospItemCount, },
|
154 |
+
function(){
|
155 |
+
window.location = elemOpen.find('a').attr('href');
|
156 |
+
}
|
157 |
+
);
|
158 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
}else{
|
160 |
// show error.
|
161 |
$('span.alert-error').html('Please select one of the options.');
|
gutenberg/.editorconfig
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
# This file is for unifying the coding style for different editors and IDEs
|
2 |
-
# editorconfig.org
|
3 |
-
|
4 |
-
# WordPress Coding Standards
|
5 |
-
# https://make.wordpress.org/core/handbook/coding-standards/
|
6 |
-
|
7 |
-
root = true
|
8 |
-
|
9 |
-
[*]
|
10 |
-
charset = utf-8
|
11 |
-
end_of_line = lf
|
12 |
-
insert_final_newline = true
|
13 |
-
trim_trailing_whitespace = true
|
14 |
-
indent_style = tab
|
15 |
-
|
16 |
-
[*.yml]
|
17 |
-
indent_style = space
|
18 |
-
indent_size = 2
|
19 |
-
|
20 |
-
[*.md]
|
21 |
-
trim_trailing_whitespace = false
|
1 |
+
# This file is for unifying the coding style for different editors and IDEs
|
2 |
+
# editorconfig.org
|
3 |
+
|
4 |
+
# WordPress Coding Standards
|
5 |
+
# https://make.wordpress.org/core/handbook/coding-standards/
|
6 |
+
|
7 |
+
root = true
|
8 |
+
|
9 |
+
[*]
|
10 |
+
charset = utf-8
|
11 |
+
end_of_line = lf
|
12 |
+
insert_final_newline = true
|
13 |
+
trim_trailing_whitespace = true
|
14 |
+
indent_style = tab
|
15 |
+
|
16 |
+
[*.yml]
|
17 |
+
indent_style = space
|
18 |
+
indent_size = 2
|
19 |
+
|
20 |
+
[*.md]
|
21 |
+
trim_trailing_whitespace = false
|
gutenberg/.eslintignore
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
**/*.min.js
|
2 |
-
**/*.build.js
|
3 |
-
**/node_modules/**
|
4 |
-
**/vendor/**
|
5 |
-
build
|
6 |
-
coverage
|
7 |
-
cypress
|
8 |
-
node_modules
|
9 |
-
vendor
|
1 |
+
**/*.min.js
|
2 |
+
**/*.build.js
|
3 |
+
**/node_modules/**
|
4 |
+
**/vendor/**
|
5 |
+
build
|
6 |
+
coverage
|
7 |
+
cypress
|
8 |
+
node_modules
|
9 |
+
vendor
|
gutenberg/.eslintrc.json
CHANGED
@@ -1,192 +1,192 @@
|
|
1 |
-
{
|
2 |
-
"root": true,
|
3 |
-
"parser": "babel-eslint",
|
4 |
-
"extends": [
|
5 |
-
"wordpress",
|
6 |
-
"plugin:react/recommended",
|
7 |
-
"plugin:jsx-a11y/recommended",
|
8 |
-
"plugin:jest/recommended"
|
9 |
-
],
|
10 |
-
"env": {
|
11 |
-
"browser": false,
|
12 |
-
"es6": true,
|
13 |
-
"node": true,
|
14 |
-
"mocha": true,
|
15 |
-
"jest/globals": true
|
16 |
-
},
|
17 |
-
"parserOptions": {
|
18 |
-
"sourceType": "module",
|
19 |
-
"ecmaFeatures": {
|
20 |
-
"jsx": true
|
21 |
-
}
|
22 |
-
},
|
23 |
-
"globals": {
|
24 |
-
"wp": true,
|
25 |
-
"wpApiSettings": true,
|
26 |
-
"window": true,
|
27 |
-
"document": true
|
28 |
-
},
|
29 |
-
"plugins": ["react", "jsx-a11y", "jest"],
|
30 |
-
"settings": {
|
31 |
-
"react": {
|
32 |
-
"pragma": "wp"
|
33 |
-
}
|
34 |
-
},
|
35 |
-
"rules": {
|
36 |
-
"array-bracket-spacing": ["error", "always"],
|
37 |
-
"brace-style": ["error", "1tbs"],
|
38 |
-
"camelcase": ["error", { "properties": "never" }],
|
39 |
-
"comma-dangle": ["error", "always-multiline"],
|
40 |
-
"comma-spacing": "error",
|
41 |
-
"comma-style": "error",
|
42 |
-
"computed-property-spacing": ["error", "always"],
|
43 |
-
"constructor-super": "error",
|
44 |
-
"dot-notation": "error",
|
45 |
-
"eol-last": "error",
|
46 |
-
"eqeqeq": "error",
|
47 |
-
"func-call-spacing": "error",
|
48 |
-
"indent": ["error", "tab", { "SwitchCase": 1 }],
|
49 |
-
"jsx-a11y/label-has-for": [
|
50 |
-
"error",
|
51 |
-
{
|
52 |
-
"required": "id"
|
53 |
-
}
|
54 |
-
],
|
55 |
-
"jsx-a11y/media-has-caption": "off",
|
56 |
-
"jsx-a11y/no-noninteractive-tabindex": "off",
|
57 |
-
"jsx-a11y/role-has-required-aria-props": "off",
|
58 |
-
"jsx-quotes": "error",
|
59 |
-
"key-spacing": "error",
|
60 |
-
"keyword-spacing": "error",
|
61 |
-
"lines-around-comment": "off",
|
62 |
-
"no-alert": "error",
|
63 |
-
"no-bitwise": "error",
|
64 |
-
"no-caller": "error",
|
65 |
-
"no-console": "error",
|
66 |
-
"no-const-assign": "error",
|
67 |
-
"no-debugger": "error",
|
68 |
-
"no-dupe-args": "error",
|
69 |
-
"no-dupe-class-members": "error",
|
70 |
-
"no-dupe-keys": "error",
|
71 |
-
"no-duplicate-case": "error",
|
72 |
-
"no-duplicate-imports": "error",
|
73 |
-
"no-else-return": "error",
|
74 |
-
"no-eval": "error",
|
75 |
-
"no-extra-semi": "error",
|
76 |
-
"no-fallthrough": "error",
|
77 |
-
"no-lonely-if": "error",
|
78 |
-
"no-mixed-operators": "error",
|
79 |
-
"no-mixed-spaces-and-tabs": "error",
|
80 |
-
"no-multiple-empty-lines": ["error", { "max": 1 }],
|
81 |
-
"no-multi-spaces": "error",
|
82 |
-
"no-multi-str": "off",
|
83 |
-
"no-negated-in-lhs": "error",
|
84 |
-
"no-nested-ternary": "error",
|
85 |
-
"no-redeclare": "error",
|
86 |
-
"no-restricted-syntax": [
|
87 |
-
"error",
|
88 |
-
{
|
89 |
-
"selector":
|
90 |
-
"ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]",
|
91 |
-
"message": "Path access on WordPress dependencies is not allowed."
|
92 |
-
},
|
93 |
-
{
|
94 |
-
"selector": "ImportDeclaration[source.value=/^blocks$/]",
|
95 |
-
"message": "Use @wordpress/blocks as import path instead."
|
96 |
-
},
|
97 |
-
{
|
98 |
-
"selector": "ImportDeclaration[source.value=/^components$/]",
|
99 |
-
"message": "Use @wordpress/components as import path instead."
|
100 |
-
},
|
101 |
-
{
|
102 |
-
"selector": "ImportDeclaration[source.value=/^date$/]",
|
103 |
-
"message": "Use @wordpress/date as import path instead."
|
104 |
-
},
|
105 |
-
{
|
106 |
-
"selector": "ImportDeclaration[source.value=/^editor$/]",
|
107 |
-
"message": "Use @wordpress/editor as import path instead."
|
108 |
-
},
|
109 |
-
{
|
110 |
-
"selector": "ImportDeclaration[source.value=/^element$/]",
|
111 |
-
"message": "Use @wordpress/element as import path instead."
|
112 |
-
},
|
113 |
-
{
|
114 |
-
"selector": "ImportDeclaration[source.value=/^i18n$/]",
|
115 |
-
"message": "Use @wordpress/i18n as import path instead."
|
116 |
-
},
|
117 |
-
{
|
118 |
-
"selector": "ImportDeclaration[source.value=/^data$/]",
|
119 |
-
"message": "Use @wordpress/data as import path instead."
|
120 |
-
},
|
121 |
-
{
|
122 |
-
"selector": "ImportDeclaration[source.value=/^utils$/]",
|
123 |
-
"message": "Use @wordpress/utils as import path instead."
|
124 |
-
},
|
125 |
-
{
|
126 |
-
"selector":
|
127 |
-
"CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])",
|
128 |
-
"message": "Translate function arguments must be string literals."
|
129 |
-
},
|
130 |
-
{
|
131 |
-
"selector":
|
132 |
-
"CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])",
|
133 |
-
"message": "Translate function arguments must be string literals."
|
134 |
-
},
|
135 |
-
{
|
136 |
-
"selector":
|
137 |
-
"CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])",
|
138 |
-
"message": "Translate function arguments must be string literals."
|
139 |
-
}
|
140 |
-
],
|
141 |
-
"no-shadow": "error",
|
142 |
-
"no-undef": "error",
|
143 |
-
"no-undef-init": "error",
|
144 |
-
"no-unreachable": "error",
|
145 |
-
"no-unsafe-negation": "error",
|
146 |
-
"no-unused-expressions": "error",
|
147 |
-
"no-unused-vars": "error",
|
148 |
-
"no-useless-computed-key": "error",
|
149 |
-
"no-useless-constructor": "error",
|
150 |
-
"no-useless-return": "error",
|
151 |
-
"no-var": "error",
|
152 |
-
"no-whitespace-before-property": "error",
|
153 |
-
"object-curly-spacing": ["error", "always"],
|
154 |
-
"padded-blocks": ["error", "never"],
|
155 |
-
"prefer-const": "error",
|
156 |
-
"quote-props": ["error", "as-needed"],
|
157 |
-
"react/display-name": "off",
|
158 |
-
"react/jsx-curly-spacing": [
|
159 |
-
"error",
|
160 |
-
{
|
161 |
-
"when": "always",
|
162 |
-
"children": true
|
163 |
-
}
|
164 |
-
],
|
165 |
-
"react/jsx-equals-spacing": "error",
|
166 |
-
"react/jsx-indent": ["error", "tab"],
|
167 |
-
"react/jsx-indent-props": ["error", "tab"],
|
168 |
-
"react/jsx-key": "error",
|
169 |
-
"react/jsx-tag-spacing": "error",
|
170 |
-
"react/no-children-prop": "off",
|
171 |
-
"react/no-find-dom-node": "warn",
|
172 |
-
"react/prop-types": "off",
|
173 |
-
"semi": "error",
|
174 |
-
"semi-spacing": "error",
|
175 |
-
"space-before-blocks": ["error", "always"],
|
176 |
-
"space-before-function-paren": ["error", "never"],
|
177 |
-
"space-in-parens": ["error", "always"],
|
178 |
-
"space-infix-ops": ["error", { "int32Hint": false }],
|
179 |
-
"space-unary-ops": [
|
180 |
-
"error",
|
181 |
-
{
|
182 |
-
"overrides": {
|
183 |
-
"!": true
|
184 |
-
}
|
185 |
-
}
|
186 |
-
],
|
187 |
-
"template-curly-spacing": ["error", "always"],
|
188 |
-
"valid-jsdoc": ["error", { "requireReturn": false }],
|
189 |
-
"valid-typeof": "error",
|
190 |
-
"yoda": "off"
|
191 |
-
}
|
192 |
-
}
|
1 |
+
{
|
2 |
+
"root": true,
|
3 |
+
"parser": "babel-eslint",
|
4 |
+
"extends": [
|
5 |
+
"wordpress",
|
6 |
+
"plugin:react/recommended",
|
7 |
+
"plugin:jsx-a11y/recommended",
|
8 |
+
"plugin:jest/recommended"
|
9 |
+
],
|
10 |
+
"env": {
|
11 |
+
"browser": false,
|
12 |
+
"es6": true,
|
13 |
+
"node": true,
|
14 |
+
"mocha": true,
|
15 |
+
"jest/globals": true
|
16 |
+
},
|
17 |
+
"parserOptions": {
|
18 |
+
"sourceType": "module",
|
19 |
+
"ecmaFeatures": {
|
20 |
+
"jsx": true
|
21 |
+
}
|
22 |
+
},
|
23 |
+
"globals": {
|
24 |
+
"wp": true,
|
25 |
+
"wpApiSettings": true,
|
26 |
+
"window": true,
|
27 |
+
"document": true
|
28 |
+
},
|
29 |
+
"plugins": ["react", "jsx-a11y", "jest"],
|
30 |
+
"settings": {
|
31 |
+
"react": {
|
32 |
+
"pragma": "wp"
|
33 |
+
}
|
34 |
+
},
|
35 |
+
"rules": {
|
36 |
+
"array-bracket-spacing": ["error", "always"],
|
37 |
+
"brace-style": ["error", "1tbs"],
|
38 |
+
"camelcase": ["error", { "properties": "never" }],
|
39 |
+
"comma-dangle": ["error", "always-multiline"],
|
40 |
+
"comma-spacing": "error",
|
41 |
+
"comma-style": "error",
|
42 |
+
"computed-property-spacing": ["error", "always"],
|
43 |
+
"constructor-super": "error",
|
44 |
+
"dot-notation": "error",
|
45 |
+
"eol-last": "error",
|
46 |
+
"eqeqeq": "error",
|
47 |
+
"func-call-spacing": "error",
|
48 |
+
"indent": ["error", "tab", { "SwitchCase": 1 }],
|
49 |
+
"jsx-a11y/label-has-for": [
|
50 |
+
"error",
|
51 |
+
{
|
52 |
+
"required": "id"
|
53 |
+
}
|
54 |
+
],
|
55 |
+
"jsx-a11y/media-has-caption": "off",
|
56 |
+
"jsx-a11y/no-noninteractive-tabindex": "off",
|
57 |
+
"jsx-a11y/role-has-required-aria-props": "off",
|
58 |
+
"jsx-quotes": "error",
|
59 |
+
"key-spacing": "error",
|
60 |
+
"keyword-spacing": "error",
|
61 |
+
"lines-around-comment": "off",
|
62 |
+
"no-alert": "error",
|
63 |
+
"no-bitwise": "error",
|
64 |
+
"no-caller": "error",
|
65 |
+
"no-console": "error",
|
66 |
+
"no-const-assign": "error",
|
67 |
+
"no-debugger": "error",
|
68 |
+
"no-dupe-args": "error",
|
69 |
+
"no-dupe-class-members": "error",
|
70 |
+
"no-dupe-keys": "error",
|
71 |
+
"no-duplicate-case": "error",
|
72 |
+
"no-duplicate-imports": "error",
|
73 |
+
"no-else-return": "error",
|
74 |
+
"no-eval": "error",
|
75 |
+
"no-extra-semi": "error",
|
76 |
+
"no-fallthrough": "error",
|
77 |
+
"no-lonely-if": "error",
|
78 |
+
"no-mixed-operators": "error",
|
79 |
+
"no-mixed-spaces-and-tabs": "error",
|
80 |
+
"no-multiple-empty-lines": ["error", { "max": 1 }],
|
81 |
+
"no-multi-spaces": "error",
|
82 |
+
"no-multi-str": "off",
|
83 |
+
"no-negated-in-lhs": "error",
|
84 |
+
"no-nested-ternary": "error",
|
85 |
+
"no-redeclare": "error",
|
86 |
+
"no-restricted-syntax": [
|
87 |
+
"error",
|
88 |
+
{
|
89 |
+
"selector":
|
90 |
+
"ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]",
|
91 |
+
"message": "Path access on WordPress dependencies is not allowed."
|
92 |
+
},
|
93 |
+
{
|
94 |
+
"selector": "ImportDeclaration[source.value=/^blocks$/]",
|
95 |
+
"message": "Use @wordpress/blocks as import path instead."
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"selector": "ImportDeclaration[source.value=/^components$/]",
|
99 |
+
"message": "Use @wordpress/components as import path instead."
|
100 |
+
},
|
101 |
+
{
|
102 |
+
"selector": "ImportDeclaration[source.value=/^date$/]",
|
103 |
+
"message": "Use @wordpress/date as import path instead."
|
104 |
+
},
|
105 |
+
{
|
106 |
+
"selector": "ImportDeclaration[source.value=/^editor$/]",
|
107 |
+
"message": "Use @wordpress/editor as import path instead."
|
108 |
+
},
|
109 |
+
{
|
110 |
+
"selector": "ImportDeclaration[source.value=/^element$/]",
|
111 |
+
"message": "Use @wordpress/element as import path instead."
|
112 |
+
},
|
113 |
+
{
|
114 |
+
"selector": "ImportDeclaration[source.value=/^i18n$/]",
|
115 |
+
"message": "Use @wordpress/i18n as import path instead."
|
116 |
+
},
|
117 |
+
{
|
118 |
+
"selector": "ImportDeclaration[source.value=/^data$/]",
|
119 |
+
"message": "Use @wordpress/data as import path instead."
|
120 |
+
},
|
121 |
+
{
|
122 |
+
"selector": "ImportDeclaration[source.value=/^utils$/]",
|
123 |
+
"message": "Use @wordpress/utils as import path instead."
|
124 |
+
},
|
125 |
+
{
|
126 |
+
"selector":
|
127 |
+
"CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])",
|
128 |
+
"message": "Translate function arguments must be string literals."
|
129 |
+
},
|
130 |
+
{
|
131 |
+
"selector":
|
132 |
+
"CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])",
|
133 |
+
"message": "Translate function arguments must be string literals."
|
134 |
+
},
|
135 |
+
{
|
136 |
+
"selector":
|
137 |
+
"CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])",
|
138 |
+
"message": "Translate function arguments must be string literals."
|
139 |
+
}
|
140 |
+
],
|
141 |
+
"no-shadow": "error",
|
142 |
+
"no-undef": "error",
|
143 |
+
"no-undef-init": "error",
|
144 |
+
"no-unreachable": "error",
|
145 |
+
"no-unsafe-negation": "error",
|
146 |
+
"no-unused-expressions": "error",
|
147 |
+
"no-unused-vars": "error",
|
148 |
+
"no-useless-computed-key": "error",
|
149 |
+
"no-useless-constructor": "error",
|
150 |
+
"no-useless-return": "error",
|
151 |
+
"no-var": "error",
|
152 |
+
"no-whitespace-before-property": "error",
|
153 |
+
"object-curly-spacing": ["error", "always"],
|
154 |
+
"padded-blocks": ["error", "never"],
|
155 |
+
"prefer-const": "error",
|
156 |
+
"quote-props": ["error", "as-needed"],
|
157 |
+
"react/display-name": "off",
|
158 |
+
"react/jsx-curly-spacing": [
|
159 |
+
"error",
|
160 |
+
{
|
161 |
+
"when": "always",
|
162 |
+
"children": true
|
163 |
+
}
|
164 |
+
],
|
165 |
+
"react/jsx-equals-spacing": "error",
|
166 |
+
"react/jsx-indent": ["error", "tab"],
|
167 |
+
"react/jsx-indent-props": ["error", "tab"],
|
168 |
+
"react/jsx-key": "error",
|
169 |
+
"react/jsx-tag-spacing": "error",
|
170 |
+
"react/no-children-prop": "off",
|
171 |
+
"react/no-find-dom-node": "warn",
|
172 |
+
"react/prop-types": "off",
|
173 |
+
"semi": "error",
|
174 |
+
"semi-spacing": "error",
|
175 |
+
"space-before-blocks": ["error", "always"],
|
176 |
+
"space-before-function-paren": ["error", "never"],
|
177 |
+
"space-in-parens": ["error", "always"],
|
178 |
+
"space-infix-ops": ["error", { "int32Hint": false }],
|
179 |
+
"space-unary-ops": [
|
180 |
+
"error",
|
181 |
+
{
|
182 |
+
"overrides": {
|
183 |
+
"!": true
|
184 |
+
}
|
185 |
+
}
|
186 |
+
],
|
187 |
+
"template-curly-spacing": ["error", "always"],
|
188 |
+
"valid-jsdoc": ["error", { "requireReturn": false }],
|
189 |
+
"valid-typeof": "error",
|
190 |
+
"yoda": "off"
|
191 |
+
}
|
192 |
+
}
|
gutenberg/.gitignore
CHANGED
@@ -1,85 +1,85 @@
|
|
1 |
-
# Packages #
|
2 |
-
############
|
3 |
-
*.7z
|
4 |
-
*.dmg
|
5 |
-
*.gz
|
6 |
-
*.bz2
|
7 |
-
*.iso
|
8 |
-
*.jar
|
9 |
-
*.rar
|
10 |
-
*.tar
|
11 |
-
*.zip
|
12 |
-
*.tgz
|
13 |
-
*.map
|
14 |
-
|
15 |
-
# Logs and databases #
|
16 |
-
######################
|
17 |
-
*.log
|
18 |
-
*.sql
|
19 |
-
|
20 |
-
# OS generated files #
|
21 |
-
######################
|
22 |
-
**.DS_Store*
|
23 |
-
ehthumbs.db
|
24 |
-
Icon?
|
25 |
-
Thumbs.db
|
26 |
-
._*
|
27 |
-
|
28 |
-
# Vim generated files #
|
29 |
-
######################
|
30 |
-
*.un~
|
31 |
-
|
32 |
-
# SASS #
|
33 |
-
##########
|
34 |
-
**/.sass-cache
|
35 |
-
**/.sass-cache/*
|
36 |
-
**/.map
|
37 |
-
|
38 |
-
# Composer #
|
39 |
-
##########
|
40 |
-
vendors/composer/
|
41 |
-
!assets/js/vendor/
|
42 |
-
wpcs/
|
43 |
-
composer.lock
|
44 |
-
|
45 |
-
# Bower #
|
46 |
-
##########
|
47 |
-
assets/bower_components/*
|
48 |
-
|
49 |
-
# Codekit #
|
50 |
-
##########
|
51 |
-
/codekit-config.json
|
52 |
-
*.codekit
|
53 |
-
**.codekit-cache/*
|
54 |
-
|
55 |
-
# NPM #
|
56 |
-
##########
|
57 |
-
node_modules
|
58 |
-
**/node_modules/**
|
59 |
-
|
60 |
-
# Compiled Files and Build Dirs #
|
61 |
-
##########
|
62 |
-
/README.html
|
63 |
-
|
64 |
-
# PhpStrom Project Files #
|
65 |
-
.idea/
|
66 |
-
library/vendors/composer
|
67 |
-
assets/img/.DS_Store
|
68 |
-
assets/sass/HTML
|
69 |
-
assets/sass/Rails
|
70 |
-
HTML
|
71 |
-
Rails
|
72 |
-
|
73 |
-
# CGB
|
74 |
-
.idea/
|
75 |
-
.vscode/
|
76 |
-
node_modules/
|
77 |
-
.DS_Store
|
78 |
-
*.tgz
|
79 |
-
my-app*
|
80 |
-
template/src/__tests__/__snapshots__/
|
81 |
-
lerna-debug.log
|
82 |
-
npm-debug.log*
|
83 |
-
yarn-debug.log*
|
84 |
-
yarn-error.log*
|
85 |
/.changelog
|
1 |
+
# Packages #
|
2 |
+
############
|
3 |
+
*.7z
|
4 |
+
*.dmg
|
5 |
+
*.gz
|
6 |
+
*.bz2
|
7 |
+
*.iso
|
8 |
+
*.jar
|
9 |
+
*.rar
|
10 |
+
*.tar
|
11 |
+
*.zip
|
12 |
+
*.tgz
|
13 |
+
*.map
|
14 |
+
|
15 |
+
# Logs and databases #
|
16 |
+
######################
|
17 |
+
*.log
|
18 |
+
*.sql
|
19 |
+
|
20 |
+
# OS generated files #
|
21 |
+
######################
|
22 |
+
**.DS_Store*
|
23 |
+
ehthumbs.db
|
24 |
+
Icon?
|
25 |
+
Thumbs.db
|
26 |
+
._*
|
27 |
+
|
28 |
+
# Vim generated files #
|
29 |
+
######################
|
30 |
+
*.un~
|
31 |
+
|
32 |
+
# SASS #
|
33 |
+
##########
|
34 |
+
**/.sass-cache
|
35 |
+
**/.sass-cache/*
|
36 |
+
**/.map
|
37 |
+
|
38 |
+
# Composer #
|
39 |
+
##########
|
40 |
+
vendors/composer/
|
41 |
+
!assets/js/vendor/
|
42 |
+
wpcs/
|
43 |
+
composer.lock
|
44 |
+
|
45 |
+
# Bower #
|
46 |
+
##########
|
47 |
+
assets/bower_components/*
|
48 |
+
|
49 |
+
# Codekit #
|
50 |
+
##########
|
51 |
+
/codekit-config.json
|
52 |
+
*.codekit
|
53 |
+
**.codekit-cache/*
|
54 |
+
|
55 |
+
# NPM #
|
56 |
+
##########
|
57 |
+
node_modules
|
58 |
+
**/node_modules/**
|
59 |
+
|
60 |
+
# Compiled Files and Build Dirs #
|
61 |
+
##########
|
62 |
+
/README.html
|
63 |
+
|
64 |
+
# PhpStrom Project Files #
|
65 |
+
.idea/
|
66 |
+
library/vendors/composer
|
67 |
+
assets/img/.DS_Store
|
68 |
+
assets/sass/HTML
|
69 |
+
assets/sass/Rails
|
70 |
+
HTML
|
71 |
+
Rails
|
72 |
+
|
73 |
+
# CGB
|
74 |
+
.idea/
|
75 |
+
.vscode/
|
76 |
+
node_modules/
|
77 |
+
.DS_Store
|
78 |
+
*.tgz
|
79 |
+
my-app*
|
80 |
+
template/src/__tests__/__snapshots__/
|
81 |
+
lerna-debug.log
|
82 |
+
npm-debug.log*
|
83 |
+
yarn-debug.log*
|
84 |
+
yarn-error.log*
|
85 |
/.changelog
|
gutenberg/form/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),l=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}var o,a,i,l,c,s,u=n(2),m=n.n(u),p=n(5),f=(n.n(p),n(6)),h=(n.n(f),wp.i18n.__),d=wp.blocks.registerBlockType,b=wp.components,g=b.SelectControl,v=(b.TextControl,wp.editor.RichText,!1);d("opinion-stage/block-os-form",{title:h("Form"),icon:"editor-justify",category:"opinion-stage",keywords:[h("Opinion Stage Form"),h("Opinion Stage Form Insert")],attributes:{embedUrl:{source:"attribute",attribute:"data-embed-url",selector:"div[data-embed-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=form&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(m.a.mark(function n(r){var o;return m.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,v=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:p}),"Change"==p&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,p=(n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<v.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(v[n].attributes["landing-page-url"]),s=r.pathname;if(t==s){o=v[n].attributes.title,a=v[n].attributes["image-url"],i=v[n].attributes["landing-page-url"],l=v[n].attributes["edit-url"],c=v[n].attributes["stats-url"];break}}}}),h=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),O=wp.element.createElement(g,{options:s,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})},d=osGutenData.onCreateButtonClickOs+"?w_type=contact_form&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",b=function(e){window.open(d,"_blank").focus()};p||e.setAttributes({buttonText:"Embed"});var w=osGutenData.callbackUrlOs,y=w,E=osGutenData.getActionUrlOS,_=osGutenData.getLogoImageLink;if(""==osGutenData.isOsConnected)return wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-form-wrapper components-placeholder"},wp.element.createElement("div",{className:"components-placeholder__label"},"Connect WordPress with Opinion Stage to get started"),wp.element.createElement("form",{method:"get",action:E,className:"components-placeholder__fieldset"},wp.element.createElement("input",{type:"hidden",name:"utm_source",value:"wordpress"}),wp.element.createElement("input",{type:"hidden",name:"utm_campaign",value:"WPMainPI"}),wp.element.createElement("input",{type:"hidden",name:"utm_medium",value:"link"}),wp.element.createElement("input",{type:"hidden",name:"o",value:"wp35e8"}),wp.element.createElement("input",{type:"hidden",name:"callback",id:"myvalue",value:y}),wp.element.createElement("input",{id:"os-email",type:"email",name:"email",placeholder:"Enter Your Email",className:"components-placeholder__input","data-os-email-input":""}),wp.element.createElement("button",{class:"opinionstage-connect-btn opinionstage-blue-btn",type:"submit",className:"components-button is-button is-default is-block is-primary",id:"os-start-login","data-os-login":""},"CONNECT"))));if(0==v)s=[{value:"Select",label:"Select a Form"},{value:"refresh",label:"Refresh"}],t();else{s=[{value:"Select",label:"Select a Form"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var x=0;x<v.length;x++){s[s.length]={value:v[x].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:v[x].attributes.title};var k=function(e){var t=document.createElement("a");return t.href=e,t}(v[x].attributes["landing-page-url"]),N=k.pathname;u==N&&(o=v[x].attributes.title,a=v[x].attributes["image-url"],i=v[x].attributes["landing-page-url"],l=v[x].attributes["edit-url"],c=v[x].attributes["stats-url"])}}"refresh"==u&&t();var O=wp.element.createElement(g,{options:s,value:u,onChange:f,className:"components-select-control__input"}),L=wp.element.createElement("div",{className:"os-form-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:_,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-placeholder__label"},"Select an existing form or create a new one"),wp.element.createElement("div",{className:"components-placeholder__fieldset"},O,wp.element.createElement("input",{type:"button",value:p,className:"components-button is-button is-default is-large",onClick:h}),wp.element.createElement("input",{type:"button",value:"Create New Form",className:"components-button is-button is-default is-block is-primary",onClick:b})));return""!=u&&"Select"!=u&&u?"Embed"==p||"Change"==p&&(L=wp.element.createElement("div",{className:"os-form-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:_,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,classname:"components-button is-button is-default is-large",target:"_blank"}," View "),wp.element.createElement("a",{href:l,classname:"components-button is-button is-default is-large",target:"_blank"}," Edit "),wp.element.createElement("a",{href:c,classname:"components-button is-button is-default is-large",target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:p,className:"components-button is-button is-default is-large left-align",onClick:h})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Form: ",o)))),O=wp.element.createElement(g,{options:s,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},L)},save:function(e){var t=e.attributes,n=t.embedUrl,r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-form-wrapper","data-type":"form","data-embed-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),l=new f(r||[]);return i._invoke=s(e,n,l),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,o,a,i){var l=r(e[n],e,o);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"===typeof s&&v.call(s,"__await")?Promise.resolve(s.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(s).then(function(e){c.value=e,a(c)},i)}i(l.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function s(e,t,n){var o=N;return function(a,i){if(o===L)throw new Error("Generator is already running");if(o===S){if("throw"===a)throw i;return d()}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=u(l,n);if(c){if(c===T)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=S,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=L;var s=r(e,t,n);if("normal"===s.type){if(o=n.done?S:O,s.arg===T)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=S,n.method="throw",n.arg=s.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===b){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=b,u(e,t),"throw"===t.method))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,T;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=b),t.delegate=null,T):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T)}function m(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function p(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(m,this),this.reset(!0)}function h(e){if(e){var t=e[y];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(v.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=b,t.done=!0,t};return r.next=r}}return{next:d}}function d(){return{value:b,done:!0}}var b,g=Object.prototype,v=g.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",_=w.toStringTag||"@@toStringTag",x="object"===typeof e,k=t.regeneratorRuntime;if(k)return void(x&&(e.exports=k));k=t.regeneratorRuntime=x?e.exports:{},k.wrap=n;var N="suspendedStart",O="suspendedYield",L="executing",S="completed",T={},C={};C[y]=function(){return this};var P=Object.getPrototypeOf,j=P&&P(P(h([])));j&&j!==g&&v.call(j,y)&&(C=j);var G=i.prototype=o.prototype=Object.create(C);a.prototype=G.constructor=i,i.constructor=a,i[_]=a.displayName="GeneratorFunction",k.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},k.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_ in e||(e[_]="GeneratorFunction")),e.prototype=Object.create(G),e},k.awrap=function(e){return{__await:e}},l(c.prototype),c.prototype[E]=function(){return this},k.AsyncIterator=c,k.async=function(e,t,r,o){var a=new c(n(e,t,r,o));return k.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},l(G),G[_]="Generator",G[y]=function(){return this},G.toString=function(){return"[object Generator]"},k.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},k.values=h,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=b,this.done=!1,this.delegate=null,this.method="next",this.arg=b,this.tryEntries.forEach(p),!e)for(var t in this)"t"===t.charAt(0)&&v.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=b)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=b),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=v.call(o,"catchLoc"),l=v.call(o,"finallyLoc");if(i&&l){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&v.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,T):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),p(n),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;p(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:h(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=b),T}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
1 |
+
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),c=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(c).then(function(e){r("next",e)},function(e){r("throw",e)});e(c)}return r("next")})}}var o,a,i,c,l,s,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),d=(n.n(f),wp.i18n.__),h=wp.blocks.registerBlockType,g=wp.components,v=g.SelectControl,b=(g.TextControl,wp.editor.RichText,!1);h("opinion-stage/block-os-form",{title:d("Form"),icon:"editor-justify",category:"opinion-stage",keywords:[d("Opinion Stage Form"),d("Opinion Stage Form")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},oswpUrlShortcode:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=form&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,b=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.oswpUrlShortcode,n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<b.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(b[n].attributes["landing-page-url"]),s=r.pathname;if(t==s){o=b[n].attributes.title,a=b[n].attributes["image-url"],i=b[n].attributes["landing-page-url"],c=b[n].attributes["edit-url"],l=b[n].attributes["stats-url"];break}}}}),d=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),L=wp.element.createElement(v,{id:"selectID",options:s,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})};window.verifyOSInsert=function(t){e.setAttributes({oswpUrlShortcode:t});for(var n=document.getElementById("selectID").options,r=0;r<n.length;r++)if(n[r].value==t){n[r].defaultSelected=!0,e.setAttributes({lockEmbed:!0,buttonText:"Change",embedUrl:t});break}};var h=osGutenData.onCreateButtonClickOs+"?w_type=form&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",g=function(e){window.open(h,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var w=osGutenData.callbackUrlOs,y=w,E=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),x=function(e){window.location.replace(y)};if(""==osGutenData.isOsConnected)return $(document).ready(function(){$("span#oswpLauncherContentPopupform , #owspLaunchInputCreate").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500)})}),wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-form-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("p",{className:"components-heading"},"Please connect Opinion Stage to WordPress to start adding forms"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:x},"Connect")));if(0==b)s=[{value:"Select",label:"Select a form"},{value:"refresh",label:"Refresh"}],t();else{s=[{value:"Select",label:"Select a form"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var k=0;k<b.length;k++){s[s.length]={value:b[k].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:b[k].attributes.title};var _=function(e){var t=document.createElement("a");return t.href=e,t}(b[k].attributes["landing-page-url"]),N=_.pathname;if(u==N){o=b[k].attributes.title,a=b[k].attributes["image-url"],i=b[k].attributes["landing-page-url"],c=b[k].attributes["edit-url"],l=b[k].attributes["stats-url"];var O=b[k].id}}}"refresh"==u&&t();var L=wp.element.createElement(v,{id:"selectID",options:s,value:u,onChange:f,className:"components-select-control__input"});$(document).ready(function(){$("span#oswpLauncherContentPopupform").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var t=$(this).attr("data-os-block");$("button#dropbtn span").text(t);for(var n=$(".filter__itm"),r=0;r<n.length;r++)if($(n[r]).text()==t){setTimeout(function(){$(n[r]).trigger("click")},2e3),$("button.content__links-itm").live("click",function(e){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}})});var S=wp.element.createElement("div",{className:"os-form-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("span",{id:"oswpLauncherContentPopupform",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"form"},"Select a Form"),wp.element.createElement("input",{type:"button",value:"Create a New Form",className:"components-button is-button is-default is-block is-primary",onClick:g}),wp.element.createElement("div",{className:"components-placeholder__fieldset"},L,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",id:"clickMe",onClick:d})));return function(e,t,n){var r,o=e.getElementsByTagName(t)[0],a=Math.floor((new Date).getTime()/1e6);e.getElementById(n)||(r=e.createElement(t),r.id=n,r.async=1,r.src="https://www.opinionstage.com/assets/loader.js?"+a,o.parentNode.insertBefore(r,o))}(document,"script","os-widget-jssdk"),O="os-widget-"+O,""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(S=wp.element.createElement("div",{className:"os-form-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,target:"_blank"}," View "),wp.element.createElement("a",{href:c,target:"_blank"}," Edit "),wp.element.createElement("a",{href:l,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:d})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Form: ",o)))),L=wp.element.createElement(v,{id:"selectID",options:s,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},S)},save:function(e){var t=e.attributes,n=(t.embedUrl,t.oswpUrlShortcode),r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-form-wrapper","data-type":"form","data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),c=new f(r||[]);return i._invoke=s(e,n,c),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function c(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function l(e){function t(n,o,a,i){var c=r(e[n],e,o);if("throw"!==c.type){var l=c.arg,s=l.value;return s&&"object"===typeof s&&b.call(s,"__await")?Promise.resolve(s.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(s).then(function(e){l.value=e,a(l)},i)}i(c.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function s(e,t,n){var o=N;return function(a,i){if(o===L)throw new Error("Generator is already running");if(o===S){if("throw"===a)throw i;return h()}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var l=u(c,n);if(l){if(l===T)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=S,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=L;var s=r(e,t,n);if("normal"===s.type){if(o=n.done?S:O,s.arg===T)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=S,n.method="throw",n.arg=s.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===g){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=g,u(e,t),"throw"===t.method))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,T;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=g),t.delegate=null,T):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[y];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(b.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=g,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:g,done:!0}}var g,v=Object.prototype,b=v.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",x=w.toStringTag||"@@toStringTag",k="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(k&&(e.exports=_));_=t.regeneratorRuntime=k?e.exports:{},_.wrap=n;var N="suspendedStart",O="suspendedYield",L="executing",S="completed",T={},C={};C[y]=function(){return this};var P=Object.getPrototypeOf,j=P&&P(P(d([])));j&&j!==v&&b.call(j,y)&&(C=j);var A=i.prototype=o.prototype=Object.create(C);a.prototype=A.constructor=i,i.constructor=a,i[x]=a.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,x in e||(e[x]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},c(l.prototype),l.prototype[E]=function(){return this},_.AsyncIterator=l,_.async=function(e,t,r,o){var a=new l(n(e,t,r,o));return _.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},c(A),A[x]="Generator",A[y]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&b.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=b.call(o,"catchLoc"),c=b.call(o,"finallyLoc");if(i&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,T):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=g),T}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
gutenberg/form/dist/blocks.editor.build.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wp-block-cgb-block-sampleblock{background:#bada55;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}.os-form-wrapper .is-large,.os-form-wrapper .is-block{height:30px;line-height:25px;padding:0 12px 2px}.os-form-wrapper .is-block{
|
1 |
+
.wp-block-cgb-block-sampleblock{background:#bada55;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}.os-form-wrapper .is-large,.os-form-wrapper .is-block{height:30px;line-height:25px;padding:0 12px 2px;width:100%;max-width:50%;display:block}.os-form-wrapper .is-block{margin-top:10px}.components-base-control.components-select-control__input{width:100%;float:left;max-width:80%;margin-right:10px}.os-form-wrapper .components-preview__block{width:100%;max-width:100%;padding:10px;background:#fdfdfd;-webkit-box-shadow:0px 1px 2px 0px #3fb2c145;box-shadow:0px 1px 2px 0px #3fb2c145;-webkit-transition:0.2s;-o-transition:0.2s;transition:0.2s}.components-preview__leftBlockImage{width:100%;float:left}.block-editor__container .components-preview__leftBlockImage img{width:100%}.components-preview__rightBlockContent{width:100%;float:left}components-placeholder__fieldset{visibility:hidden;opacity:0}.components-preview__rightBlockContent .components-placeholder__label{font-size:18px;font-weight:bold;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;margin:0px;line-height:20px;margin:0px auto;margin-top:20px;margin-bottom:10px}ul.components-edit-view-stats__Block{list-style-type:none !important;text-align:left;color:#3fb2c1;font-weight:bold;margin-top:10px !important}ul.components-edit-view-stats__Block li{width:100%;max-width:30%;display:inline-block;float:left;margin-top:12px;text-align:center;margin:6px;padding:3px;font-weight:normal;letter-spacing:1px;border-radius:2px}.clear-both-OS__Block{clear:both}ul.components-edit-view-stats__Block li a{color:#fff}ul.components-edit-view-stats__Block li a{color:#fff;text-decoration:none}.components-preview__leftBlockImage{position:relative}.components-preview__leftBlockImage .image{display:block;width:100%;height:auto}.components-preview__leftBlockImage .overlay{position:absolute;top:0;bottom:0;left:0;right:0;height:100%;width:100%;opacity:0;-webkit-transition:.5s ease;-o-transition:.5s ease;transition:.5s ease;background-color:#222120}.components-preview__leftBlockImage:hover .overlay{opacity:0.8}.components-preview__leftBlockImage .text{color:white;font-size:20px;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);transform:translate(-50%, -50%);text-align:center}.components-preview__leftBlockImage .text a{border-radius:5px;border:1px solid #fff;color:#fff;background:transparent;cursor:pointer;display:block;line-height:1;margin:10px auto;padding:10px 8px;text-align:center;text-decoration:none;text-transform:uppercase;width:140px}.components-preview__leftBlockImage .text a:hover,.components-preview__block input.left-align:hover{color:#000 !important;background:#fff !important}.components-preview__block .left-align{color:#fff;text-transform:uppercase;border:1px solid #FFF;-webkit-box-shadow:0px 0px;box-shadow:0px 0px;text-align:center;font-size:19px;border-radius:5px;padding:0px 32px;height:40px;width:100%;max-width:-webkit-fit-content;max-width:-moz-fit-content;max-width:fit-content;background:transparent}.components-preview__block .left-align:hover{background:transparent !important;color:#fff !important;border-color:#fff !important;-webkit-box-shadow:0px 0px !important;box-shadow:0px 0px !important}p.components-heading{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-weight:600;text-align:center}.os-form-wrapper.components-placeholder{-webkit-transition:1s;-o-transition:1s;transition:1s}.os-form-wrapper .wp-block-opinion-stage-block-os-form .components-placeholder__fieldset{visibility:hidden;opacity:0}.os-form-wrapper .components-placeholder__fieldset{visibility:hidden;opacity:0;height:0}
|
gutenberg/form/src/.DS_Store
CHANGED
Binary file
|
gutenberg/form/src/block/block.js
CHANGED
@@ -20,13 +20,18 @@ var options;
|
|
20 |
category: 'opinion-stage',
|
21 |
keywords: [
|
22 |
__( 'Opinion Stage Form' ),
|
23 |
-
__( 'Opinion Stage Form
|
24 |
],
|
25 |
attributes: {
|
26 |
embedUrl: {
|
27 |
source: 'attribute',
|
28 |
-
attribute: 'data-
|
29 |
-
selector: 'div[data-
|
|
|
|
|
|
|
|
|
|
|
30 |
},
|
31 |
lockEmbed: {
|
32 |
source: 'attribute',
|
@@ -37,10 +42,10 @@ var options;
|
|
37 |
source: 'attribute',
|
38 |
attribute: 'data-button-text',
|
39 |
selector: 'div[data-button-text]'
|
40 |
-
},
|
41 |
},
|
42 |
edit: function( props ) {
|
43 |
-
let {attributes: {embedUrl, lockEmbed, buttonText}, setAttributes} = props;
|
44 |
const onDropdownChange = val => {
|
45 |
if(val == ''){
|
46 |
props.setAttributes({ embedUrl: '' });
|
@@ -59,7 +64,7 @@ var options;
|
|
59 |
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
60 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
61 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
62 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
63 |
break;
|
64 |
}
|
65 |
}
|
@@ -72,14 +77,26 @@ var options;
|
|
72 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
73 |
}else{
|
74 |
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
75 |
-
contentDropdown = (<SelectControl options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
76 |
}
|
77 |
}else{
|
78 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
79 |
}
|
80 |
};
|
81 |
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
const onCreateButtonClick = value => {
|
84 |
// Open Create new form link in new page
|
85 |
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
@@ -93,9 +110,12 @@ var options;
|
|
93 |
var callback_url = getCallBackUrlOs;
|
94 |
var formActionUrlOS = osGutenData.getActionUrlOS;
|
95 |
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
99 |
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
100 |
var opinionStageClientToken = osGutenData.OswpClientToken;
|
101 |
var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=form&page=1&per_page=99';
|
@@ -117,7 +137,7 @@ var options;
|
|
117 |
props.setAttributes({ buttonText: buttonText});
|
118 |
if(buttonText == 'Change' && embedUrl !='Select'){
|
119 |
props.setAttributes({ embedUrl: embedUrl });
|
120 |
-
}else{
|
121 |
props.setAttributes({ embedUrl: 'Select' });
|
122 |
}
|
123 |
})
|
@@ -126,29 +146,28 @@ var options;
|
|
126 |
});
|
127 |
}
|
128 |
// Checking for Opinion Stage connection
|
129 |
-
if(osGutenData.isOsConnected == ''){
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
return (
|
131 |
<div className={ props.className }>
|
132 |
<div className="os-form-wrapper components-placeholder">
|
133 |
-
|
134 |
-
|
135 |
-
<
|
136 |
-
<input type="hidden" name="utm_campaign" value="WPMainPI"/>
|
137 |
-
<input type="hidden" name="utm_medium" value="link"/>
|
138 |
-
<input type="hidden" name="o" value="wp35e8"/>
|
139 |
-
<input type="hidden" name="callback" id="myvalue" value={callback_url} />
|
140 |
-
<input id="os-email" type="email" name="email" placeholder="Enter Your Email" className="components-placeholder__input" data-os-email-input=""/>
|
141 |
-
<button class="opinionstage-connect-btn opinionstage-blue-btn" type="submit" className="components-button is-button is-default is-block is-primary" id="os-start-login" data-os-login="">CONNECT</button>
|
142 |
-
</form>
|
143 |
</div>
|
144 |
</div>
|
145 |
);
|
146 |
}else{
|
147 |
if(dropdownOptions == false){
|
148 |
-
options = [{value:'Select',label:'Select a
|
149 |
-
|
150 |
}else{
|
151 |
-
options = [{value:'Select',label:'Select a
|
152 |
for (var i = 0; i < dropdownOptions.length; i++) {
|
153 |
options[options.length] = {
|
154 |
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
@@ -167,26 +186,59 @@ var options;
|
|
167 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
168 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
169 |
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
|
|
|
|
170 |
}
|
171 |
}
|
172 |
}
|
173 |
-
if(embedUrl == 'refresh'){
|
174 |
-
|
175 |
}
|
176 |
-
var contentDropdown = (<SelectControl options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
var contentViewEditStatOs = (
|
179 |
<div className="os-form-wrapper components-placeholder">
|
180 |
-
|
181 |
-
|
|
|
182 |
<div className="components-placeholder__fieldset">
|
183 |
{contentDropdown}
|
184 |
-
<input type="button" value={buttonText} className="components-button is-button is-default is-large" onClick={onEmbedButtonClick} />
|
185 |
-
<input type="button" value="Create New Form" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
186 |
</div>
|
187 |
</div>
|
188 |
);
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
if(embedUrl != '' && embedUrl != 'Select' && embedUrl){
|
192 |
if(buttonText == 'Embed'){
|
@@ -200,9 +252,9 @@ var options;
|
|
200 |
<img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
|
201 |
<div className="overlay">
|
202 |
<div className="text">
|
203 |
-
<a href={previewBlockOsView}
|
204 |
-
<a href={previewBlockOsEdit}
|
205 |
-
<a href={previewBlockOsStatistics}
|
206 |
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onEmbedButtonClick} />
|
207 |
</div>
|
208 |
</div>
|
@@ -213,7 +265,7 @@ var options;
|
|
213 |
</div>
|
214 |
</div>
|
215 |
);
|
216 |
-
contentDropdown = (<SelectControl options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
217 |
}
|
218 |
}else if(embedUrl == 'Select' || embedUrl == '' || embedUrl == 'refresh'){
|
219 |
contentViewEditStatOs
|
@@ -221,17 +273,19 @@ var options;
|
|
221 |
props.setAttributes({ buttonText: 'Embed'});
|
222 |
contentViewEditStatOs
|
223 |
}
|
|
|
|
|
224 |
return (
|
225 |
-
|
226 |
-
{contentViewEditStatOs}
|
227 |
</div>
|
228 |
);
|
229 |
}
|
230 |
},
|
231 |
-
save: function( {attributes: {embedUrl, lockEmbed, buttonText}} ) {
|
232 |
return (
|
233 |
-
<div class="os-form-wrapper" data-type="form" data-
|
234 |
-
[os-widget path="{
|
235 |
</div>
|
236 |
);
|
237 |
},
|
20 |
category: 'opinion-stage',
|
21 |
keywords: [
|
22 |
__( 'Opinion Stage Form' ),
|
23 |
+
__( 'Opinion Stage Form' ),
|
24 |
],
|
25 |
attributes: {
|
26 |
embedUrl: {
|
27 |
source: 'attribute',
|
28 |
+
attribute: 'data-test-url',
|
29 |
+
selector: 'div[data-test-url]'
|
30 |
+
},
|
31 |
+
oswpUrlShortcode: {
|
32 |
+
source: 'attribute',
|
33 |
+
attribute: 'data-test-url',
|
34 |
+
selector: 'div[data-test-url]'
|
35 |
},
|
36 |
lockEmbed: {
|
37 |
source: 'attribute',
|
42 |
source: 'attribute',
|
43 |
attribute: 'data-button-text',
|
44 |
selector: 'div[data-button-text]'
|
45 |
+
},
|
46 |
},
|
47 |
edit: function( props ) {
|
48 |
+
let {attributes: {embedUrl, oswpUrlShortcode, lockEmbed, buttonText}, setAttributes} = props;
|
49 |
const onDropdownChange = val => {
|
50 |
if(val == ''){
|
51 |
props.setAttributes({ embedUrl: '' });
|
64 |
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
65 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
66 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
67 |
+
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
68 |
break;
|
69 |
}
|
70 |
}
|
77 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
78 |
}else{
|
79 |
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
80 |
+
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
81 |
}
|
82 |
}else{
|
83 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
84 |
}
|
85 |
};
|
86 |
|
87 |
+
window.verifyOSInsert = function(widget){
|
88 |
+
props.setAttributes({ oswpUrlShortcode: widget });
|
89 |
+
var myOpts = document.getElementById('selectID').options;
|
90 |
+
for(var i = 0; i < myOpts.length; i++){
|
91 |
+
if(myOpts[i].value == widget){
|
92 |
+
myOpts[i].defaultSelected = true;
|
93 |
+
props.setAttributes({ lockEmbed: true, buttonText: "Change", embedUrl: widget });
|
94 |
+
break;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=form&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
100 |
const onCreateButtonClick = value => {
|
101 |
// Open Create new form link in new page
|
102 |
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
110 |
var callback_url = getCallBackUrlOs;
|
111 |
var formActionUrlOS = osGutenData.getActionUrlOS;
|
112 |
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
113 |
+
const onConnectOSWPButtonClick = value => {
|
114 |
+
// Open Connect to opinionstage
|
115 |
+
window.location.replace(callback_url);
|
116 |
+
};
|
117 |
+
// Populate list ajax function
|
118 |
+
function OsPolulateList() {
|
119 |
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
120 |
var opinionStageClientToken = osGutenData.OswpClientToken;
|
121 |
var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=form&page=1&per_page=99';
|
137 |
props.setAttributes({ buttonText: buttonText});
|
138 |
if(buttonText == 'Change' && embedUrl !='Select'){
|
139 |
props.setAttributes({ embedUrl: embedUrl });
|
140 |
+
}else{
|
141 |
props.setAttributes({ embedUrl: 'Select' });
|
142 |
}
|
143 |
})
|
146 |
});
|
147 |
}
|
148 |
// Checking for Opinion Stage connection
|
149 |
+
if(osGutenData.isOsConnected == ''){
|
150 |
+
$(document).ready(function () {
|
151 |
+
$('span#oswpLauncherContentPopupform , #owspLaunchInputCreate').live('click', function(e) {
|
152 |
+
e.preventDefault();
|
153 |
+
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
154 |
+
});
|
155 |
+
});
|
156 |
return (
|
157 |
<div className={ props.className }>
|
158 |
<div className="os-form-wrapper components-placeholder">
|
159 |
+
<p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
|
160 |
+
<p className="components-heading">Please connect Opinion Stage to WordPress to start adding forms</p>
|
161 |
+
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
</div>
|
163 |
</div>
|
164 |
);
|
165 |
}else{
|
166 |
if(dropdownOptions == false){
|
167 |
+
options = [{value:'Select',label:'Select a form'},{value:'refresh',label:'Refresh'}];
|
168 |
+
OsPolulateList();
|
169 |
}else{
|
170 |
+
options = [{value:'Select',label:'Select a form'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
|
171 |
for (var i = 0; i < dropdownOptions.length; i++) {
|
172 |
options[options.length] = {
|
173 |
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
186 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
187 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
188 |
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
189 |
+
var previewBlockOsWidgetID = dropdownOptions[i].id;
|
190 |
+
|
191 |
}
|
192 |
}
|
193 |
}
|
194 |
+
if(embedUrl == 'refresh'){
|
195 |
+
OsPolulateList();
|
196 |
}
|
197 |
+
var contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
198 |
+
$(document).ready(function () {
|
199 |
+
$('span#oswpLauncherContentPopupform').live('click', function(e) {
|
200 |
+
e.preventDefault();
|
201 |
+
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
202 |
+
var text = $(this).attr('data-os-block');
|
203 |
+
$("button#dropbtn span").text(text);
|
204 |
+
var inputs = $(".filter__itm");
|
205 |
+
for(var i = 0; i < inputs.length; i++){
|
206 |
+
if($(inputs[i]).text() == text){
|
207 |
+
setTimeout(function(){$(inputs[i]).trigger('click');},2000);
|
208 |
+
$('button.content__links-itm').live('click', function(e) {
|
209 |
+
$('.tingle-modal.opinionstage-content-popup').hide();
|
210 |
+
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
211 |
+
});
|
212 |
+
break;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
});
|
216 |
+
});
|
217 |
+
|
218 |
var contentViewEditStatOs = (
|
219 |
<div className="os-form-wrapper components-placeholder">
|
220 |
+
<p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
|
221 |
+
<span id="oswpLauncherContentPopupform" className="components-button is-button is-default is-block is-primary" data-opinionstage-content-launch data-os-block="form">Select a Form</span>
|
222 |
+
<input type="button" value="Create a New Form" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
223 |
<div className="components-placeholder__fieldset">
|
224 |
{contentDropdown}
|
225 |
+
<input type="button" value={buttonText} className="components-button is-button is-default is-large" id="clickMe" onClick={onEmbedButtonClick} />
|
|
|
226 |
</div>
|
227 |
</div>
|
228 |
);
|
229 |
+
|
230 |
+
var dataOpinionStageEmbedUrl = 'https://www.opinionstage.com/api/v1/widgets/'+embedUrl+'/code.json?comments=true&sharing=true&recommendations=false&width=';
|
231 |
+
var OpinionStageDataIframe = 'https://www.opinionstage.com/'+embedUrl+'?wid=0&em=1&comments=null&referring_widget='+embedUrl+'&autoswitch=1&of=&os_utm_source=null';
|
232 |
+
(function(d, s, id){
|
233 |
+
var js,
|
234 |
+
fjs = d.getElementsByTagName(s)[0],
|
235 |
+
r = Math.floor(new Date().getTime() / 1000000);
|
236 |
+
if (d.getElementById(id)) {return;}
|
237 |
+
js = d.createElement(s); js.id = id; js.async=1;
|
238 |
+
js.src = "https://www.opinionstage.com/assets/loader.js?" + r;
|
239 |
+
fjs.parentNode.insertBefore(js, fjs);
|
240 |
+
}(document, 'script', 'os-widget-jssdk'));
|
241 |
+
previewBlockOsWidgetID = 'os-widget-'+previewBlockOsWidgetID;
|
242 |
|
243 |
if(embedUrl != '' && embedUrl != 'Select' && embedUrl){
|
244 |
if(buttonText == 'Embed'){
|
252 |
<img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
|
253 |
<div className="overlay">
|
254 |
<div className="text">
|
255 |
+
<a href={previewBlockOsView} target="_blank"> View </a>
|
256 |
+
<a href={previewBlockOsEdit} target="_blank"> Edit </a>
|
257 |
+
<a href={previewBlockOsStatistics} target="_blank"> Statistics </a>
|
258 |
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onEmbedButtonClick} />
|
259 |
</div>
|
260 |
</div>
|
265 |
</div>
|
266 |
</div>
|
267 |
);
|
268 |
+
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
269 |
}
|
270 |
}else if(embedUrl == 'Select' || embedUrl == '' || embedUrl == 'refresh'){
|
271 |
contentViewEditStatOs
|
273 |
props.setAttributes({ buttonText: 'Embed'});
|
274 |
contentViewEditStatOs
|
275 |
}
|
276 |
+
|
277 |
+
|
278 |
return (
|
279 |
+
<div className={ props.className }>
|
280 |
+
{contentViewEditStatOs}
|
281 |
</div>
|
282 |
);
|
283 |
}
|
284 |
},
|
285 |
+
save: function( {attributes: {embedUrl, oswpUrlShortcode, lockEmbed, buttonText}} ) {
|
286 |
return (
|
287 |
+
<div class="os-form-wrapper" data-type="form" data-test-url={oswpUrlShortcode} data-lock-embed={lockEmbed} data-button-text={buttonText}>
|
288 |
+
[os-widget path="{oswpUrlShortcode}"]
|
289 |
</div>
|
290 |
);
|
291 |
},
|
gutenberg/form/src/block/editor.scss
CHANGED
@@ -17,11 +17,12 @@
|
|
17 |
height: 30px;
|
18 |
line-height: 25px;
|
19 |
padding: 0 12px 2px;
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
.os-form-wrapper .is-block {
|
23 |
-
display: block;
|
24 |
-
width: 100%;
|
25 |
margin-top: 10px;
|
26 |
}
|
27 |
.components-base-control.components-select-control__input {
|
@@ -49,6 +50,10 @@
|
|
49 |
width: 100%;
|
50 |
float: left;
|
51 |
}
|
|
|
|
|
|
|
|
|
52 |
.components-preview__rightBlockContent .components-placeholder__label {
|
53 |
font-size: 18px;
|
54 |
font-weight: bold;
|
@@ -177,3 +182,12 @@ p.components-heading {
|
|
177 |
.os-form-wrapper.components-placeholder {
|
178 |
transition: 1s;
|
179 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
height: 30px;
|
18 |
line-height: 25px;
|
19 |
padding: 0 12px 2px;
|
20 |
+
width: 100%;
|
21 |
+
max-width: 50%;
|
22 |
+
display: block;
|
23 |
}
|
24 |
|
25 |
.os-form-wrapper .is-block {
|
|
|
|
|
26 |
margin-top: 10px;
|
27 |
}
|
28 |
.components-base-control.components-select-control__input {
|
50 |
width: 100%;
|
51 |
float: left;
|
52 |
}
|
53 |
+
components-placeholder__fieldset{
|
54 |
+
visibility: hidden;
|
55 |
+
opacity :0;
|
56 |
+
}
|
57 |
.components-preview__rightBlockContent .components-placeholder__label {
|
58 |
font-size: 18px;
|
59 |
font-weight: bold;
|
182 |
.os-form-wrapper.components-placeholder {
|
183 |
transition: 1s;
|
184 |
}
|
185 |
+
.os-form-wrapper .wp-block-opinion-stage-block-os-form .components-placeholder__fieldset {
|
186 |
+
visibility: hidden;
|
187 |
+
opacity: 0;
|
188 |
+
}
|
189 |
+
.os-form-wrapper .components-placeholder__fieldset {
|
190 |
+
visibility: hidden;
|
191 |
+
opacity: 0;
|
192 |
+
height: 0;
|
193 |
+
}
|
gutenberg/init.php
CHANGED
@@ -50,7 +50,7 @@ function oswp_gutenberg_enqueue_scripts() {
|
|
50 |
$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
51 |
|
52 |
// get admin url for opinionstage plugin
|
53 |
-
$adminUrlForOs =
|
54 |
|
55 |
// opinionstage plugin version
|
56 |
$OswpPluginVersion = OPINIONSTAGE_WIDGET_VERSION;
|
@@ -68,7 +68,7 @@ function oswp_gutenberg_enqueue_scripts() {
|
|
68 |
$dataToPass = array(
|
69 |
'isOsConnected' => (isset($os_options['uid']) && $os_options['uid'] != '') ? true : false,
|
70 |
'onCreateButtonClickOs' => 'https://www.opinionstage.com/api/wp/redirects/widgets/new',
|
71 |
-
'callbackUrlOs' => $adminUrlForOs
|
72 |
'OswpPluginVersion' => $OswpPluginVersion,
|
73 |
'OswpClientToken' => opinionstage_user_access_token(),
|
74 |
'OswpFetchDataUrl' => $FetchUrlOS,
|
50 |
$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
51 |
|
52 |
// get admin url for opinionstage plugin
|
53 |
+
$adminUrlForOs = opinionstage_callback_url_gutenberg_connect();
|
54 |
|
55 |
// opinionstage plugin version
|
56 |
$OswpPluginVersion = OPINIONSTAGE_WIDGET_VERSION;
|
68 |
$dataToPass = array(
|
69 |
'isOsConnected' => (isset($os_options['uid']) && $os_options['uid'] != '') ? true : false,
|
70 |
'onCreateButtonClickOs' => 'https://www.opinionstage.com/api/wp/redirects/widgets/new',
|
71 |
+
'callbackUrlOs' => $adminUrlForOs,
|
72 |
'OswpPluginVersion' => $OswpPluginVersion,
|
73 |
'OswpClientToken' => opinionstage_user_access_token(),
|
74 |
'OswpFetchDataUrl' => $FetchUrlOS,
|
gutenberg/personality/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(a,o){try{var i=t[a](o),l=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}var a,o,i,l,s,c,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),h=(n.n(f),wp.i18n.__),d=wp.blocks.registerBlockType,b=wp.components,g=b.SelectControl,v=(b.TextControl,wp.editor.RichText,!1);d("opinion-stage/block-os-personality",{title:h("Personality Quiz"),icon:"smiley",category:"opinion-stage",keywords:[h("Opinion Stage Personality Quiz"),h("Opinion Stage Personality Quiz Insert")],attributes:{embedUrl:{source:"attribute",attribute:"data-embed-url",selector:"div[data-embed-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,a=osGutenData.OswpClientToken,o=osGutenData.OswpFetchDataUrl+"?type=outcome&page=1&per_page=99";fetch(o,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":a}}).then(function(){var n=r(p.a.mark(function n(r){var a;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:a=t.sent,a=a.data,v=a,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<v.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(v[n].attributes["landing-page-url"]),c=r.pathname;if(t==c){a=v[n].attributes.title,o=v[n].attributes["image-url"],i=v[n].attributes["landing-page-url"],l=v[n].attributes["edit-url"],s=v[n].attributes["stats-url"];break}}}}),h=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),O=wp.element.createElement(g,{options:c,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})},d=osGutenData.onCreateButtonClickOs+"?w_type=outcome&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",b=function(e){window.open(d,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var y=osGutenData.callbackUrlOs,w=y,E=osGutenData.getActionUrlOS,_=osGutenData.getLogoImageLink;if(""==osGutenData.isOsConnected)return wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-personality-wrapper components-placeholder"},wp.element.createElement("div",{className:"components-placeholder__label"},"Connect WordPress with Opinion Stage to get started"),wp.element.createElement("form",{method:"get",action:E,className:"components-placeholder__fieldset"},wp.element.createElement("input",{type:"hidden",name:"utm_source",value:"wordpress"}),wp.element.createElement("input",{type:"hidden",name:"utm_campaign",value:"WPMainPI"}),wp.element.createElement("input",{type:"hidden",name:"utm_medium",value:"link"}),wp.element.createElement("input",{type:"hidden",name:"o",value:"wp35e8"}),wp.element.createElement("input",{type:"hidden",name:"callback",id:"myvalue",value:w}),wp.element.createElement("input",{id:"os-email",type:"email",name:"email",placeholder:"Enter Your Email",className:"components-placeholder__input","data-os-email-input":""}),wp.element.createElement("button",{class:"opinionstage-connect-btn opinionstage-blue-btn",type:"submit",className:"components-button is-button is-default is-block is-primary",id:"os-start-login","data-os-login":""},"CONNECT"))));if(0==v)c=[{value:"Select",label:"Select a Personality Quiz"},{value:"refresh",label:"Refresh"}],t();else{c=[{value:"Select",label:"Select a Personality Quiz"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var x=0;x<v.length;x++){c[c.length]={value:v[x].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:v[x].attributes.title};var k=function(e){var t=document.createElement("a");return t.href=e,t}(v[x].attributes["landing-page-url"]),N=k.pathname;u==N&&(a=v[x].attributes.title,o=v[x].attributes["image-url"],i=v[x].attributes["landing-page-url"],l=v[x].attributes["edit-url"],s=v[x].attributes["stats-url"])}}"refresh"==u&&t();var O=wp.element.createElement(g,{options:c,value:u,onChange:f,className:"components-select-control__input"}),L=wp.element.createElement("div",{className:"os-personality-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:_,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-placeholder__label"},"Select an existing personality quiz or create a new one"),wp.element.createElement("div",{className:"components-placeholder__fieldset"},O,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",onClick:h}),wp.element.createElement("input",{type:"button",value:"Create New Personality Quiz",className:"components-button is-button is-default is-block is-primary",onClick:b})));return""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(L=wp.element.createElement("div",{className:"os-personality-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:_,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:o,alt:a,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,classname:"components-button is-button is-default is-large",target:"_blank"}," View "),wp.element.createElement("a",{href:l,classname:"components-button is-button is-default is-large",target:"_blank"}," Edit "),wp.element.createElement("a",{href:s,classname:"components-button is-button is-default is-large",target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:h})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Personality Quiz: ",a)))),O=wp.element.createElement(g,{options:c,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},L)},save:function(e){var t=e.attributes,n=t.embedUrl,r=t.lockEmbed,a=t.buttonText;return wp.element.createElement("div",{class:"os-personality-wrapper","data-type":"personality","data-embed-url":n,"data-lock-embed":r,"data-button-text":a},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),a=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=a&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),a)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var o=t&&t.prototype instanceof a?t:a,i=Object.create(o.prototype),l=new f(r||[]);return i._invoke=c(e,n,l),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function a(){}function o(){}function i(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function s(e){function t(n,a,o,i){var l=r(e[n],e,a);if("throw"!==l.type){var s=l.arg,c=s.value;return c&&"object"===typeof c&&v.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,o,i)},function(e){t("throw",e,o,i)}):Promise.resolve(c).then(function(e){s.value=e,o(s)},i)}i(l.arg)}function n(e,n){function r(){return new Promise(function(r,a){t(e,n,r,a)})}return a=a?a.then(r,r):r()}var a;this._invoke=n}function c(e,t,n){var a=N;return function(o,i){if(a===L)throw new Error("Generator is already running");if(a===P){if("throw"===o)throw i;return d()}for(n.method=o,n.arg=i;;){var l=n.delegate;if(l){var s=u(l,n);if(s){if(s===S)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===N)throw a=P,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=L;var c=r(e,t,n);if("normal"===c.type){if(a=n.done?P:O,c.arg===S)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=P,n.method="throw",n.arg=c.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===b){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=b,u(e,t),"throw"===t.method))return S;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return S}var a=r(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,S;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=b),t.delegate=null,S):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,S)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function h(e){if(e){var t=e[w];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(v.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=b,t.done=!0,t};return r.next=r}}return{next:d}}function d(){return{value:b,done:!0}}var b,g=Object.prototype,v=g.hasOwnProperty,y="function"===typeof Symbol?Symbol:{},w=y.iterator||"@@iterator",E=y.asyncIterator||"@@asyncIterator",_=y.toStringTag||"@@toStringTag",x="object"===typeof e,k=t.regeneratorRuntime;if(k)return void(x&&(e.exports=k));k=t.regeneratorRuntime=x?e.exports:{},k.wrap=n;var N="suspendedStart",O="suspendedYield",L="executing",P="completed",S={},T={};T[w]=function(){return this};var C=Object.getPrototypeOf,j=C&&C(C(h([])));j&&j!==g&&v.call(j,w)&&(T=j);var G=i.prototype=a.prototype=Object.create(T);o.prototype=G.constructor=i,i.constructor=o,i[_]=o.displayName="GeneratorFunction",k.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===o||"GeneratorFunction"===(t.displayName||t.name))},k.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_ in e||(e[_]="GeneratorFunction")),e.prototype=Object.create(G),e},k.awrap=function(e){return{__await:e}},l(s.prototype),s.prototype[E]=function(){return this},k.AsyncIterator=s,k.async=function(e,t,r,a){var o=new s(n(e,t,r,a));return k.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},l(G),G[_]="Generator",G[w]=function(){return this},G.toString=function(){return"[object Generator]"},k.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},k.values=h,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=b,this.done=!1,this.delegate=null,this.method="next",this.arg=b,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&v.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=b)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return o.type="throw",o.arg=e,n.next=t,r&&(n.method="next",n.arg=b),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],o=a.completion;if("root"===a.tryLoc)return t("end");if(a.tryLoc<=this.prev){var i=v.call(a,"catchLoc"),l=v.call(a,"finallyLoc");if(i&&l){if(this.prev<a.catchLoc)return t(a.catchLoc,!0);if(this.prev<a.finallyLoc)return t(a.finallyLoc)}else if(i){if(this.prev<a.catchLoc)return t(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return t(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&v.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,S):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),S},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),S}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;m(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:h(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=b),S}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
1 |
+
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),l=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}var o,a,i,l,s,c,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),d=(n.n(f),wp.i18n.__),h=wp.blocks.registerBlockType,g=wp.components,v=g.SelectControl,b=(g.TextControl,wp.editor.RichText,!1);h("opinion-stage/block-os-personality",{title:d("Personality Quiz"),icon:"smiley",category:"opinion-stage",keywords:[d("Opinion Stage Personality Quiz"),d("Opinion Stage Personality")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},oswpUrlShortcode:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=outcome&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,b=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.oswpUrlShortcode,n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<b.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(b[n].attributes["landing-page-url"]),c=r.pathname;if(t==c){o=b[n].attributes.title,a=b[n].attributes["image-url"],i=b[n].attributes["landing-page-url"],l=b[n].attributes["edit-url"],s=b[n].attributes["stats-url"];break}}}}),d=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),L=wp.element.createElement(v,{id:"selectID",options:c,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})};window.verifyOSInsert=function(t){e.setAttributes({oswpUrlShortcode:t});for(var n=document.getElementById("selectID").options,r=0;r<n.length;r++)if(n[r].value==t){n[r].defaultSelected=!0,e.setAttributes({lockEmbed:!0,buttonText:"Change",embedUrl:t});break}};var h=osGutenData.onCreateButtonClickOs+"?w_type=outcome&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",g=function(e){window.open(h,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var y=osGutenData.callbackUrlOs,w=y,E=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),x=function(e){window.location.replace(w)};if(""==osGutenData.isOsConnected)return $(document).ready(function(){$("span#oswpLauncherContentPopuppersonality , #owspLaunchInputCreate").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500)})}),wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-personality-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("p",{className:"components-heading"},"Please connect Opinion Stage to WordPress to start adding personality quizzes"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:x},"Connect")));if(0==b)c=[{value:"Select",label:"Select a personality"},{value:"refresh",label:"Refresh"}],t();else{c=[{value:"Select",label:"Select a personality"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var k=0;k<b.length;k++){c[c.length]={value:b[k].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:b[k].attributes.title};var _=function(e){var t=document.createElement("a");return t.href=e,t}(b[k].attributes["landing-page-url"]),N=_.pathname;if(u==N){o=b[k].attributes.title,a=b[k].attributes["image-url"],i=b[k].attributes["landing-page-url"],l=b[k].attributes["edit-url"],s=b[k].attributes["stats-url"];var O=b[k].id}}}"refresh"==u&&t();var L=wp.element.createElement(v,{id:"selectID",options:c,value:u,onChange:f,className:"components-select-control__input"});$(document).ready(function(){$("span#oswpLauncherContentPopuppersonality").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var t=$(this).attr("data-os-block");$("button#dropbtn span").text(t);for(var n=$(".filter__itm"),r=0;r<n.length;r++)if($(n[r]).text()==t){setTimeout(function(){$(n[r]).trigger("click")},2e3),$("button.content__links-itm").live("click",function(e){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}})});var S=wp.element.createElement("div",{className:"os-personality-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("span",{id:"oswpLauncherContentPopuppersonality",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"personality quiz"},"Select a Personality Quiz"),wp.element.createElement("input",{type:"button",value:"Create a New Personality Quiz",className:"components-button is-button is-default is-block is-primary",onClick:g}),wp.element.createElement("div",{className:"components-placeholder__fieldset"},L,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",id:"clickMe",onClick:d})));return function(e,t,n){var r,o=e.getElementsByTagName(t)[0],a=Math.floor((new Date).getTime()/1e6);e.getElementById(n)||(r=e.createElement(t),r.id=n,r.async=1,r.src="https://www.opinionstage.com/assets/loader.js?"+a,o.parentNode.insertBefore(r,o))}(document,"script","os-widget-jssdk"),O="os-widget-"+O,""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(S=wp.element.createElement("div",{className:"os-personality-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,target:"_blank"}," View "),wp.element.createElement("a",{href:l,target:"_blank"}," Edit "),wp.element.createElement("a",{href:s,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:d})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Personality: ",o)))),L=wp.element.createElement(v,{id:"selectID",options:c,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},S)},save:function(e){var t=e.attributes,n=(t.embedUrl,t.oswpUrlShortcode),r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-personality-wrapper","data-type":"personality","data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),l=new f(r||[]);return i._invoke=c(e,n,l),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function s(e){function t(n,o,a,i){var l=r(e[n],e,o);if("throw"!==l.type){var s=l.arg,c=s.value;return c&&"object"===typeof c&&b.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(c).then(function(e){s.value=e,a(s)},i)}i(l.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function c(e,t,n){var o=N;return function(a,i){if(o===L)throw new Error("Generator is already running");if(o===S){if("throw"===a)throw i;return h()}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var s=u(l,n);if(s){if(s===P)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=S,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=L;var c=r(e,t,n);if("normal"===c.type){if(o=n.done?S:O,c.arg===P)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=S,n.method="throw",n.arg=c.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===g){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=g,u(e,t),"throw"===t.method))return P;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return P}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,P;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=g),t.delegate=null,P):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,P)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[w];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(b.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=g,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:g,done:!0}}var g,v=Object.prototype,b=v.hasOwnProperty,y="function"===typeof Symbol?Symbol:{},w=y.iterator||"@@iterator",E=y.asyncIterator||"@@asyncIterator",x=y.toStringTag||"@@toStringTag",k="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(k&&(e.exports=_));_=t.regeneratorRuntime=k?e.exports:{},_.wrap=n;var N="suspendedStart",O="suspendedYield",L="executing",S="completed",P={},T={};T[w]=function(){return this};var C=Object.getPrototypeOf,j=C&&C(C(d([])));j&&j!==v&&b.call(j,w)&&(T=j);var A=i.prototype=o.prototype=Object.create(T);a.prototype=A.constructor=i,i.constructor=a,i[x]=a.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,x in e||(e[x]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},l(s.prototype),s.prototype[E]=function(){return this},_.AsyncIterator=s,_.async=function(e,t,r,o){var a=new s(n(e,t,r,o));return _.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},l(A),A[x]="Generator",A[w]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&b.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=b.call(o,"catchLoc"),l=b.call(o,"finallyLoc");if(i&&l){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,P):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),P},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),P}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=g),P}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
gutenberg/personality/dist/blocks.editor.build.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wp-block-cgb-block-sampleblock{background:#bada55;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}.os-personality-wrapper .is-large,.os-personality-wrapper .is-block{height:30px;line-height:25px;padding:0 12px 2px}.os-personality-wrapper .is-block{
|
1 |
+
.wp-block-cgb-block-sampleblock{background:#bada55;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}.os-personality-wrapper .is-large,.os-personality-wrapper .is-block{height:30px;line-height:25px;padding:0 12px 2px;width:100%;max-width:50%;display:block}.os-personality-wrapper .is-block{margin-top:10px}.components-base-control.components-select-control__input{width:100%;float:left;max-width:80%;margin-right:10px}.os-personality-wrapper .components-preview__block{width:100%;max-width:100%;padding:10px;background:#fdfdfd;-webkit-box-shadow:0px 1px 2px 0px #3fb2c145;box-shadow:0px 1px 2px 0px #3fb2c145;-webkit-transition:0.2s;-o-transition:0.2s;transition:0.2s}.components-preview__leftBlockImage{width:100%;float:left}.block-editor__container .components-preview__leftBlockImage img{width:100%}.components-preview__rightBlockContent{width:100%;float:left}components-placeholder__fieldset{visibility:hidden;opacity:0}.components-preview__rightBlockContent .components-placeholder__label{font-size:18px;font-weight:bold;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;margin:0px;line-height:20px;margin:0px auto;margin-top:20px;margin-bottom:10px}ul.components-edit-view-stats__Block{list-style-type:none !important;text-align:left;color:#3fb2c1;font-weight:bold;margin-top:10px !important}ul.components-edit-view-stats__Block li{width:100%;max-width:30%;display:inline-block;float:left;margin-top:12px;text-align:center;margin:6px;padding:3px;font-weight:normal;letter-spacing:1px;border-radius:2px}.clear-both-OS__Block{clear:both}ul.components-edit-view-stats__Block li a{color:#fff}ul.components-edit-view-stats__Block li a{color:#fff;text-decoration:none}.components-preview__leftBlockImage{position:relative}.components-preview__leftBlockImage .image{display:block;width:100%;height:auto}.components-preview__leftBlockImage .overlay{position:absolute;top:0;bottom:0;left:0;right:0;height:100%;width:100%;opacity:0;-webkit-transition:.5s ease;-o-transition:.5s ease;transition:.5s ease;background-color:#222120}.components-preview__leftBlockImage:hover .overlay{opacity:0.8}.components-preview__leftBlockImage .text{color:white;font-size:20px;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);transform:translate(-50%, -50%);text-align:center}.components-preview__leftBlockImage .text a{border-radius:5px;border:1px solid #fff;color:#fff;background:transparent;cursor:pointer;display:block;line-height:1;margin:10px auto;padding:10px 8px;text-align:center;text-decoration:none;text-transform:uppercase;width:140px}.components-preview__leftBlockImage .text a:hover,.components-preview__block input.left-align:hover{color:#000 !important;background:#fff !important}.components-preview__block .left-align{color:#fff;text-transform:uppercase;border:1px solid #FFF;-webkit-box-shadow:0px 0px;box-shadow:0px 0px;text-align:center;font-size:19px;border-radius:5px;padding:0px 32px;height:40px;width:100%;max-width:-webkit-fit-content;max-width:-moz-fit-content;max-width:fit-content;background:transparent}.components-preview__block .left-align:hover{background:transparent !important;color:#fff !important;border-color:#fff !important;-webkit-box-shadow:0px 0px !important;box-shadow:0px 0px !important}p.components-heading{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-weight:600;text-align:center}.os-personality-wrapper.components-placeholder{-webkit-transition:1s;-o-transition:1s;transition:1s}.os-personality-wrapper .wp-block-opinion-stage-block-os-personality .components-placeholder__fieldset{visibility:hidden;opacity:0}.os-personality-wrapper .components-placeholder__fieldset{visibility:hidden;opacity:0;height:0}
|
gutenberg/personality/src/.DS_Store
CHANGED
Binary file
|
gutenberg/personality/src/block/block.js
CHANGED
@@ -20,13 +20,18 @@ var options;
|
|
20 |
category: 'opinion-stage',
|
21 |
keywords: [
|
22 |
__( 'Opinion Stage Personality Quiz' ),
|
23 |
-
__( 'Opinion Stage Personality
|
24 |
],
|
25 |
-
attributes: {
|
26 |
embedUrl: {
|
27 |
source: 'attribute',
|
28 |
-
attribute: 'data-
|
29 |
-
selector: 'div[data-
|
|
|
|
|
|
|
|
|
|
|
30 |
},
|
31 |
lockEmbed: {
|
32 |
source: 'attribute',
|
@@ -37,10 +42,10 @@ var options;
|
|
37 |
source: 'attribute',
|
38 |
attribute: 'data-button-text',
|
39 |
selector: 'div[data-button-text]'
|
40 |
-
},
|
41 |
},
|
42 |
edit: function( props ) {
|
43 |
-
let {attributes: {embedUrl, lockEmbed, buttonText}, setAttributes} = props;
|
44 |
const onDropdownChange = val => {
|
45 |
if(val == ''){
|
46 |
props.setAttributes({ embedUrl: '' });
|
@@ -59,7 +64,7 @@ var options;
|
|
59 |
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
60 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
61 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
62 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
63 |
break;
|
64 |
}
|
65 |
}
|
@@ -72,16 +77,28 @@ var options;
|
|
72 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
73 |
}else{
|
74 |
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
75 |
-
contentDropdown = (<SelectControl options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
76 |
}
|
77 |
}else{
|
78 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
79 |
}
|
80 |
};
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=outcome&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
83 |
const onCreateButtonClick = value => {
|
84 |
-
// Open Create new personality
|
85 |
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
86 |
};
|
87 |
|
@@ -93,7 +110,10 @@ var options;
|
|
93 |
var callback_url = getCallBackUrlOs;
|
94 |
var formActionUrlOS = osGutenData.getActionUrlOS;
|
95 |
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
96 |
-
|
|
|
|
|
|
|
97 |
// Populate list ajax function
|
98 |
function OsPolulateList() {
|
99 |
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
@@ -117,7 +137,7 @@ var options;
|
|
117 |
props.setAttributes({ buttonText: buttonText});
|
118 |
if(buttonText == 'Change' && embedUrl !='Select'){
|
119 |
props.setAttributes({ embedUrl: embedUrl });
|
120 |
-
}else{
|
121 |
props.setAttributes({ embedUrl: 'Select' });
|
122 |
}
|
123 |
})
|
@@ -126,29 +146,28 @@ var options;
|
|
126 |
});
|
127 |
}
|
128 |
// Checking for Opinion Stage connection
|
129 |
-
if(osGutenData.isOsConnected == ''){
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
return (
|
131 |
<div className={ props.className }>
|
132 |
<div className="os-personality-wrapper components-placeholder">
|
133 |
-
|
134 |
-
|
135 |
-
<
|
136 |
-
<input type="hidden" name="utm_campaign" value="WPMainPI"/>
|
137 |
-
<input type="hidden" name="utm_medium" value="link"/>
|
138 |
-
<input type="hidden" name="o" value="wp35e8"/>
|
139 |
-
<input type="hidden" name="callback" id="myvalue" value={callback_url} />
|
140 |
-
<input id="os-email" type="email" name="email" placeholder="Enter Your Email" className="components-placeholder__input" data-os-email-input=""/>
|
141 |
-
<button class="opinionstage-connect-btn opinionstage-blue-btn" type="submit" className="components-button is-button is-default is-block is-primary" id="os-start-login" data-os-login="">CONNECT</button>
|
142 |
-
</form>
|
143 |
</div>
|
144 |
</div>
|
145 |
);
|
146 |
}else{
|
147 |
if(dropdownOptions == false){
|
148 |
-
options = [{value:'Select',label:'Select a
|
149 |
OsPolulateList();
|
150 |
}else{
|
151 |
-
options = [{value:'Select',label:'Select a
|
152 |
for (var i = 0; i < dropdownOptions.length; i++) {
|
153 |
options[options.length] = {
|
154 |
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
@@ -167,26 +186,59 @@ var options;
|
|
167 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
168 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
169 |
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
|
|
|
|
170 |
}
|
171 |
}
|
172 |
}
|
173 |
-
if(embedUrl == 'refresh'){
|
174 |
OsPolulateList();
|
175 |
}
|
176 |
-
var contentDropdown = (<SelectControl options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
var contentViewEditStatOs = (
|
179 |
<div className="os-personality-wrapper components-placeholder">
|
180 |
-
|
181 |
-
|
|
|
182 |
<div className="components-placeholder__fieldset">
|
183 |
{contentDropdown}
|
184 |
-
<input type="button" value={buttonText} className="components-button is-button is-default is-large" onClick={onEmbedButtonClick} />
|
185 |
-
<input type="button" value="Create New Personality Quiz" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
186 |
</div>
|
187 |
</div>
|
188 |
);
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
if(embedUrl != '' && embedUrl != 'Select' && embedUrl){
|
192 |
if(buttonText == 'Embed'){
|
@@ -200,20 +252,20 @@ var options;
|
|
200 |
<img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
|
201 |
<div className="overlay">
|
202 |
<div className="text">
|
203 |
-
<a href={previewBlockOsView}
|
204 |
-
<a href={previewBlockOsEdit}
|
205 |
-
<a href={previewBlockOsStatistics}
|
206 |
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onEmbedButtonClick} />
|
207 |
</div>
|
208 |
</div>
|
209 |
</div>
|
210 |
<div className="components-preview__rightBlockContent">
|
211 |
-
<div className="components-placeholder__label">Personality
|
212 |
</div>
|
213 |
</div>
|
214 |
</div>
|
215 |
);
|
216 |
-
contentDropdown = (<SelectControl options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
217 |
}
|
218 |
}else if(embedUrl == 'Select' || embedUrl == '' || embedUrl == 'refresh'){
|
219 |
contentViewEditStatOs
|
@@ -221,17 +273,19 @@ var options;
|
|
221 |
props.setAttributes({ buttonText: 'Embed'});
|
222 |
contentViewEditStatOs
|
223 |
}
|
|
|
|
|
224 |
return (
|
225 |
-
|
226 |
-
{contentViewEditStatOs}
|
227 |
</div>
|
228 |
);
|
229 |
}
|
230 |
},
|
231 |
-
save: function( {attributes: {embedUrl, lockEmbed, buttonText}} ) {
|
232 |
return (
|
233 |
-
<div class="os-personality-wrapper" data-type="personality" data-
|
234 |
-
[os-widget path="{
|
235 |
</div>
|
236 |
);
|
237 |
},
|
20 |
category: 'opinion-stage',
|
21 |
keywords: [
|
22 |
__( 'Opinion Stage Personality Quiz' ),
|
23 |
+
__( 'Opinion Stage Personality' ),
|
24 |
],
|
25 |
+
attributes: {
|
26 |
embedUrl: {
|
27 |
source: 'attribute',
|
28 |
+
attribute: 'data-test-url',
|
29 |
+
selector: 'div[data-test-url]'
|
30 |
+
},
|
31 |
+
oswpUrlShortcode: {
|
32 |
+
source: 'attribute',
|
33 |
+
attribute: 'data-test-url',
|
34 |
+
selector: 'div[data-test-url]'
|
35 |
},
|
36 |
lockEmbed: {
|
37 |
source: 'attribute',
|
42 |
source: 'attribute',
|
43 |
attribute: 'data-button-text',
|
44 |
selector: 'div[data-button-text]'
|
45 |
+
},
|
46 |
},
|
47 |
edit: function( props ) {
|
48 |
+
let {attributes: {embedUrl, oswpUrlShortcode, lockEmbed, buttonText}, setAttributes} = props;
|
49 |
const onDropdownChange = val => {
|
50 |
if(val == ''){
|
51 |
props.setAttributes({ embedUrl: '' });
|
64 |
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
65 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
66 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
67 |
+
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
68 |
break;
|
69 |
}
|
70 |
}
|
77 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
78 |
}else{
|
79 |
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
80 |
+
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
81 |
}
|
82 |
}else{
|
83 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
84 |
}
|
85 |
};
|
86 |
|
87 |
+
window.verifyOSInsert = function(widget){
|
88 |
+
props.setAttributes({ oswpUrlShortcode: widget });
|
89 |
+
var myOpts = document.getElementById('selectID').options;
|
90 |
+
for(var i = 0; i < myOpts.length; i++){
|
91 |
+
if(myOpts[i].value == widget){
|
92 |
+
myOpts[i].defaultSelected = true;
|
93 |
+
props.setAttributes({ lockEmbed: true, buttonText: "Change", embedUrl: widget });
|
94 |
+
break;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=outcome&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
100 |
const onCreateButtonClick = value => {
|
101 |
+
// Open Create new personality link in new page
|
102 |
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
103 |
};
|
104 |
|
110 |
var callback_url = getCallBackUrlOs;
|
111 |
var formActionUrlOS = osGutenData.getActionUrlOS;
|
112 |
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
113 |
+
const onConnectOSWPButtonClick = value => {
|
114 |
+
// Open Connect to opinionstage
|
115 |
+
window.location.replace(callback_url);
|
116 |
+
};
|
117 |
// Populate list ajax function
|
118 |
function OsPolulateList() {
|
119 |
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
137 |
props.setAttributes({ buttonText: buttonText});
|
138 |
if(buttonText == 'Change' && embedUrl !='Select'){
|
139 |
props.setAttributes({ embedUrl: embedUrl });
|
140 |
+
}else{
|
141 |
props.setAttributes({ embedUrl: 'Select' });
|
142 |
}
|
143 |
})
|
146 |
});
|
147 |
}
|
148 |
// Checking for Opinion Stage connection
|
149 |
+
if(osGutenData.isOsConnected == ''){
|
150 |
+
$(document).ready(function () {
|
151 |
+
$('span#oswpLauncherContentPopuppersonality , #owspLaunchInputCreate').live('click', function(e) {
|
152 |
+
e.preventDefault();
|
153 |
+
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
154 |
+
});
|
155 |
+
});
|
156 |
return (
|
157 |
<div className={ props.className }>
|
158 |
<div className="os-personality-wrapper components-placeholder">
|
159 |
+
<p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
|
160 |
+
<p className="components-heading">Please connect Opinion Stage to WordPress to start adding personality quizzes</p>
|
161 |
+
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
</div>
|
163 |
</div>
|
164 |
);
|
165 |
}else{
|
166 |
if(dropdownOptions == false){
|
167 |
+
options = [{value:'Select',label:'Select a personality'},{value:'refresh',label:'Refresh'}];
|
168 |
OsPolulateList();
|
169 |
}else{
|
170 |
+
options = [{value:'Select',label:'Select a personality'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
|
171 |
for (var i = 0; i < dropdownOptions.length; i++) {
|
172 |
options[options.length] = {
|
173 |
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
186 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
187 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
188 |
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
189 |
+
var previewBlockOsWidgetID = dropdownOptions[i].id;
|
190 |
+
|
191 |
}
|
192 |
}
|
193 |
}
|
194 |
+
if(embedUrl == 'refresh'){
|
195 |
OsPolulateList();
|
196 |
}
|
197 |
+
var contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
198 |
+
$(document).ready(function () {
|
199 |
+
$('span#oswpLauncherContentPopuppersonality').live('click', function(e) {
|
200 |
+
e.preventDefault();
|
201 |
+
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
202 |
+
var text = $(this).attr('data-os-block');
|
203 |
+
$("button#dropbtn span").text(text);
|
204 |
+
var inputs = $(".filter__itm");
|
205 |
+
for(var i = 0; i < inputs.length; i++){
|
206 |
+
if($(inputs[i]).text() == text){
|
207 |
+
setTimeout(function(){$(inputs[i]).trigger('click');},2000);
|
208 |
+
$('button.content__links-itm').live('click', function(e) {
|
209 |
+
$('.tingle-modal.opinionstage-content-popup').hide();
|
210 |
+
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
211 |
+
});
|
212 |
+
break;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
});
|
216 |
+
});
|
217 |
+
|
218 |
var contentViewEditStatOs = (
|
219 |
<div className="os-personality-wrapper components-placeholder">
|
220 |
+
<p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
|
221 |
+
<span id="oswpLauncherContentPopuppersonality" className="components-button is-button is-default is-block is-primary" data-opinionstage-content-launch data-os-block="personality quiz">Select a Personality Quiz</span>
|
222 |
+
<input type="button" value="Create a New Personality Quiz" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
223 |
<div className="components-placeholder__fieldset">
|
224 |
{contentDropdown}
|
225 |
+
<input type="button" value={buttonText} className="components-button is-button is-default is-large" id="clickMe" onClick={onEmbedButtonClick} />
|
|
|
226 |
</div>
|
227 |
</div>
|
228 |
);
|
229 |
+
|
230 |
+
var dataOpinionStageEmbedUrl = 'https://www.opinionstage.com/api/v1/widgets/'+embedUrl+'/code.json?comments=true&sharing=true&recommendations=false&width=';
|
231 |
+
var OpinionStageDataIframe = 'https://www.opinionstage.com/'+embedUrl+'?wid=0&em=1&comments=null&referring_widget='+embedUrl+'&autoswitch=1&of=&os_utm_source=null';
|
232 |
+
(function(d, s, id){
|
233 |
+
var js,
|
234 |
+
fjs = d.getElementsByTagName(s)[0],
|
235 |
+
r = Math.floor(new Date().getTime() / 1000000);
|
236 |
+
if (d.getElementById(id)) {return;}
|
237 |
+
js = d.createElement(s); js.id = id; js.async=1;
|
238 |
+
js.src = "https://www.opinionstage.com/assets/loader.js?" + r;
|
239 |
+
fjs.parentNode.insertBefore(js, fjs);
|
240 |
+
}(document, 'script', 'os-widget-jssdk'));
|
241 |
+
previewBlockOsWidgetID = 'os-widget-'+previewBlockOsWidgetID;
|
242 |
|
243 |
if(embedUrl != '' && embedUrl != 'Select' && embedUrl){
|
244 |
if(buttonText == 'Embed'){
|
252 |
<img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
|
253 |
<div className="overlay">
|
254 |
<div className="text">
|
255 |
+
<a href={previewBlockOsView} target="_blank"> View </a>
|
256 |
+
<a href={previewBlockOsEdit} target="_blank"> Edit </a>
|
257 |
+
<a href={previewBlockOsStatistics} target="_blank"> Statistics </a>
|
258 |
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onEmbedButtonClick} />
|
259 |
</div>
|
260 |
</div>
|
261 |
</div>
|
262 |
<div className="components-preview__rightBlockContent">
|
263 |
+
<div className="components-placeholder__label">Personality: {previewBlockOsTitle}</div>
|
264 |
</div>
|
265 |
</div>
|
266 |
</div>
|
267 |
);
|
268 |
+
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
269 |
}
|
270 |
}else if(embedUrl == 'Select' || embedUrl == '' || embedUrl == 'refresh'){
|
271 |
contentViewEditStatOs
|
273 |
props.setAttributes({ buttonText: 'Embed'});
|
274 |
contentViewEditStatOs
|
275 |
}
|
276 |
+
|
277 |
+
|
278 |
return (
|
279 |
+
<div className={ props.className }>
|
280 |
+
{contentViewEditStatOs}
|
281 |
</div>
|
282 |
);
|
283 |
}
|
284 |
},
|
285 |
+
save: function( {attributes: {embedUrl, oswpUrlShortcode, lockEmbed, buttonText}} ) {
|
286 |
return (
|
287 |
+
<div class="os-personality-wrapper" data-type="personality" data-test-url={oswpUrlShortcode} data-lock-embed={lockEmbed} data-button-text={buttonText}>
|
288 |
+
[os-widget path="{oswpUrlShortcode}"]
|
289 |
</div>
|
290 |
);
|
291 |
},
|
gutenberg/personality/src/block/editor.scss
CHANGED
@@ -17,11 +17,12 @@
|
|
17 |
height: 30px;
|
18 |
line-height: 25px;
|
19 |
padding: 0 12px 2px;
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
.os-personality-wrapper .is-block {
|
23 |
-
display: block;
|
24 |
-
width: 100%;
|
25 |
margin-top: 10px;
|
26 |
}
|
27 |
.components-base-control.components-select-control__input {
|
@@ -49,6 +50,10 @@
|
|
49 |
width: 100%;
|
50 |
float: left;
|
51 |
}
|
|
|
|
|
|
|
|
|
52 |
.components-preview__rightBlockContent .components-placeholder__label {
|
53 |
font-size: 18px;
|
54 |
font-weight: bold;
|
@@ -177,3 +182,12 @@ p.components-heading {
|
|
177 |
.os-personality-wrapper.components-placeholder {
|
178 |
transition: 1s;
|
179 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
height: 30px;
|
18 |
line-height: 25px;
|
19 |
padding: 0 12px 2px;
|
20 |
+
width: 100%;
|
21 |
+
max-width: 50%;
|
22 |
+
display: block;
|
23 |
}
|
24 |
|
25 |
.os-personality-wrapper .is-block {
|
|
|
|
|
26 |
margin-top: 10px;
|
27 |
}
|
28 |
.components-base-control.components-select-control__input {
|
50 |
width: 100%;
|
51 |
float: left;
|
52 |
}
|
53 |
+
components-placeholder__fieldset{
|
54 |
+
visibility: hidden;
|
55 |
+
opacity :0;
|
56 |
+
}
|
57 |
.components-preview__rightBlockContent .components-placeholder__label {
|
58 |
font-size: 18px;
|
59 |
font-weight: bold;
|
182 |
.os-personality-wrapper.components-placeholder {
|
183 |
transition: 1s;
|
184 |
}
|
185 |
+
.os-personality-wrapper .wp-block-opinion-stage-block-os-personality .components-placeholder__fieldset {
|
186 |
+
visibility: hidden;
|
187 |
+
opacity: 0;
|
188 |
+
}
|
189 |
+
.os-personality-wrapper .components-placeholder__fieldset {
|
190 |
+
visibility: hidden;
|
191 |
+
opacity: 0;
|
192 |
+
height: 0;
|
193 |
+
}
|
gutenberg/poll/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),l=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}var o,a,i,l,c,s,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),h=(n.n(f),wp.i18n.__),d=wp.blocks.registerBlockType,b=wp.components,g=b.SelectControl,v=(b.TextControl,wp.editor.RichText,!1);d("opinion-stage/block-os-poll",{title:h("Poll"),icon:"chart-bar",category:"opinion-stage",keywords:[h("Opinion Stage Poll"),h("Opinion Stage Poll Insert")],attributes:{embedUrl:{source:"attribute",attribute:"data-embed-url",selector:"div[data-embed-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=poll&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,v=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<v.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(v[n].attributes["landing-page-url"]),s=r.pathname;if(t==s){o=v[n].attributes.title,a=v[n].attributes["image-url"],i=v[n].attributes["landing-page-url"],l=v[n].attributes["edit-url"],c=v[n].attributes["stats-url"];break}}}}),h=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),O=wp.element.createElement(g,{options:s,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})},d=osGutenData.onCreateButtonClickOs+"?w_type=poll&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",b=function(e){window.open(d,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var w=osGutenData.callbackUrlOs,y=w,E=osGutenData.getActionUrlOS,_=osGutenData.getLogoImageLink;if(""==osGutenData.isOsConnected)return wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-poll-wrapper components-placeholder"},wp.element.createElement("div",{className:"components-placeholder__label"},"Connect WordPress with Opinion Stage to get started"),wp.element.createElement("form",{method:"get",action:E,className:"components-placeholder__fieldset"},wp.element.createElement("input",{type:"hidden",name:"utm_source",value:"wordpress"}),wp.element.createElement("input",{type:"hidden",name:"utm_campaign",value:"WPMainPI"}),wp.element.createElement("input",{type:"hidden",name:"utm_medium",value:"link"}),wp.element.createElement("input",{type:"hidden",name:"o",value:"wp35e8"}),wp.element.createElement("input",{type:"hidden",name:"callback",id:"myvalue",value:y}),wp.element.createElement("input",{id:"os-email",type:"email",name:"email",placeholder:"Enter Your Email",className:"components-placeholder__input","data-os-email-input":""}),wp.element.createElement("button",{class:"opinionstage-connect-btn opinionstage-blue-btn",type:"submit",className:"components-button is-button is-default is-block is-primary",id:"os-start-login","data-os-login":""},"CONNECT"))));if(0==v)s=[{value:"Select",label:"Select a Poll"},{value:"refresh",label:"Refresh"}],t();else{s=[{value:"Select",label:"Select a Poll"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var x=0;x<v.length;x++){s[s.length]={value:v[x].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:v[x].attributes.title};var k=function(e){var t=document.createElement("a");return t.href=e,t}(v[x].attributes["landing-page-url"]),N=k.pathname;u==N&&(o=v[x].attributes.title,a=v[x].attributes["image-url"],i=v[x].attributes["landing-page-url"],l=v[x].attributes["edit-url"],c=v[x].attributes["stats-url"])}}"refresh"==u&&t();var O=wp.element.createElement(g,{options:s,value:u,onChange:f,className:"components-select-control__input"}),L=wp.element.createElement("div",{className:"os-poll-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:_,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-placeholder__label"},"Select an existing poll or create a new one"),wp.element.createElement("div",{className:"components-placeholder__fieldset"},O,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",onClick:h}),wp.element.createElement("input",{type:"button",value:"Create New Poll",className:"components-button is-button is-default is-block is-primary",onClick:b})));return""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(L=wp.element.createElement("div",{className:"os-poll-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:_,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,classname:"components-button is-button is-default is-large",target:"_blank"}," View "),wp.element.createElement("a",{href:l,classname:"components-button is-button is-default is-large",target:"_blank"}," Edit "),wp.element.createElement("a",{href:c,classname:"components-button is-button is-default is-large",target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:h})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Poll: ",o)))),O=wp.element.createElement(g,{options:s,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},L)},save:function(e){var t=e.attributes,n=t.embedUrl,r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-poll-wrapper","data-type":"Poll","data-embed-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),l=new f(r||[]);return i._invoke=s(e,n,l),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,o,a,i){var l=r(e[n],e,o);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"===typeof s&&v.call(s,"__await")?Promise.resolve(s.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(s).then(function(e){c.value=e,a(c)},i)}i(l.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function s(e,t,n){var o=N;return function(a,i){if(o===L)throw new Error("Generator is already running");if(o===P){if("throw"===a)throw i;return d()}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=u(l,n);if(c){if(c===S)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=P,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=L;var s=r(e,t,n);if("normal"===s.type){if(o=n.done?P:O,s.arg===S)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=P,n.method="throw",n.arg=s.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===b){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=b,u(e,t),"throw"===t.method))return S;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return S}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,S;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=b),t.delegate=null,S):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,S)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function h(e){if(e){var t=e[y];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(v.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=b,t.done=!0,t};return r.next=r}}return{next:d}}function d(){return{value:b,done:!0}}var b,g=Object.prototype,v=g.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",_=w.toStringTag||"@@toStringTag",x="object"===typeof e,k=t.regeneratorRuntime;if(k)return void(x&&(e.exports=k));k=t.regeneratorRuntime=x?e.exports:{},k.wrap=n;var N="suspendedStart",O="suspendedYield",L="executing",P="completed",S={},T={};T[y]=function(){return this};var C=Object.getPrototypeOf,j=C&&C(C(h([])));j&&j!==g&&v.call(j,y)&&(T=j);var G=i.prototype=o.prototype=Object.create(T);a.prototype=G.constructor=i,i.constructor=a,i[_]=a.displayName="GeneratorFunction",k.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},k.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_ in e||(e[_]="GeneratorFunction")),e.prototype=Object.create(G),e},k.awrap=function(e){return{__await:e}},l(c.prototype),c.prototype[E]=function(){return this},k.AsyncIterator=c,k.async=function(e,t,r,o){var a=new c(n(e,t,r,o));return k.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},l(G),G[_]="Generator",G[y]=function(){return this},G.toString=function(){return"[object Generator]"},k.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},k.values=h,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=b,this.done=!1,this.delegate=null,this.method="next",this.arg=b,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&v.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=b)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=b),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=v.call(o,"catchLoc"),l=v.call(o,"finallyLoc");if(i&&l){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&v.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,S):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),S},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),S}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:h(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=b),S}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
1 |
+
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),l=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}var o,a,i,l,c,s,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),d=(n.n(f),wp.i18n.__),h=wp.blocks.registerBlockType,g=wp.components,v=g.SelectControl,b=(g.TextControl,wp.editor.RichText,!1);h("opinion-stage/block-os-poll",{title:d("Poll"),icon:"chart-bar",category:"opinion-stage",keywords:[d("Opinion Stage Poll"),d("Opinion Stage Poll")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},oswpUrlShortcode:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=poll&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,b=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.oswpUrlShortcode,n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<b.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(b[n].attributes["landing-page-url"]),s=r.pathname;if(t==s){o=b[n].attributes.title,a=b[n].attributes["image-url"],i=b[n].attributes["landing-page-url"],l=b[n].attributes["edit-url"],c=b[n].attributes["stats-url"];break}}}}),d=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),L=wp.element.createElement(v,{id:"selectID",options:s,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})};window.verifyOSInsert=function(t){e.setAttributes({oswpUrlShortcode:t});for(var n=document.getElementById("selectID").options,r=0;r<n.length;r++)if(n[r].value==t){n[r].defaultSelected=!0,e.setAttributes({lockEmbed:!0,buttonText:"Change",embedUrl:t});break}};var h=osGutenData.onCreateButtonClickOs+"?w_type=poll&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",g=function(e){window.open(h,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var w=osGutenData.callbackUrlOs,y=w,E=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),x=function(e){window.location.replace(y)};if(""==osGutenData.isOsConnected)return $(document).ready(function(){$("span#oswpLauncherContentPopuppoll , #owspLaunchInputCreate").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500)})}),wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-poll-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("p",{className:"components-heading"},"Please connect Opinion Stage to WordPress to start adding polls"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:x},"Connect")));if(0==b)s=[{value:"Select",label:"Select a poll"},{value:"refresh",label:"Refresh"}],t();else{s=[{value:"Select",label:"Select a poll"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var k=0;k<b.length;k++){s[s.length]={value:b[k].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:b[k].attributes.title};var _=function(e){var t=document.createElement("a");return t.href=e,t}(b[k].attributes["landing-page-url"]),N=_.pathname;if(u==N){o=b[k].attributes.title,a=b[k].attributes["image-url"],i=b[k].attributes["landing-page-url"],l=b[k].attributes["edit-url"],c=b[k].attributes["stats-url"];var O=b[k].id}}}"refresh"==u&&t();var L=wp.element.createElement(v,{id:"selectID",options:s,value:u,onChange:f,className:"components-select-control__input"});$(document).ready(function(){$("span#oswpLauncherContentPopuppoll").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var t=$(this).attr("data-os-block");$("button#dropbtn span").text(t);for(var n=$(".filter__itm"),r=0;r<n.length;r++)if($(n[r]).text()==t){setTimeout(function(){$(n[r]).trigger("click")},2e3),$("button.content__links-itm").live("click",function(e){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}})});var S=wp.element.createElement("div",{className:"os-poll-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("span",{id:"oswpLauncherContentPopuppoll",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"poll"},"Select a Poll"),wp.element.createElement("input",{type:"button",value:"Create a New Poll",className:"components-button is-button is-default is-block is-primary",onClick:g}),wp.element.createElement("div",{className:"components-placeholder__fieldset"},L,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",id:"clickMe",onClick:d})));return function(e,t,n){var r,o=e.getElementsByTagName(t)[0],a=Math.floor((new Date).getTime()/1e6);e.getElementById(n)||(r=e.createElement(t),r.id=n,r.async=1,r.src="https://www.opinionstage.com/assets/loader.js?"+a,o.parentNode.insertBefore(r,o))}(document,"script","os-widget-jssdk"),O="os-widget-"+O,""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(S=wp.element.createElement("div",{className:"os-poll-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,target:"_blank"}," View "),wp.element.createElement("a",{href:l,target:"_blank"}," Edit "),wp.element.createElement("a",{href:c,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:d})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Poll: ",o)))),L=wp.element.createElement(v,{id:"selectID",options:s,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},S)},save:function(e){var t=e.attributes,n=(t.embedUrl,t.oswpUrlShortcode),r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-poll-wrapper","data-type":"poll","data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),l=new f(r||[]);return i._invoke=s(e,n,l),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,o,a,i){var l=r(e[n],e,o);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"===typeof s&&b.call(s,"__await")?Promise.resolve(s.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(s).then(function(e){c.value=e,a(c)},i)}i(l.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function s(e,t,n){var o=N;return function(a,i){if(o===L)throw new Error("Generator is already running");if(o===S){if("throw"===a)throw i;return h()}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=u(l,n);if(c){if(c===P)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=S,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=L;var s=r(e,t,n);if("normal"===s.type){if(o=n.done?S:O,s.arg===P)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=S,n.method="throw",n.arg=s.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===g){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=g,u(e,t),"throw"===t.method))return P;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return P}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,P;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=g),t.delegate=null,P):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,P)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[y];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(b.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=g,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:g,done:!0}}var g,v=Object.prototype,b=v.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",x=w.toStringTag||"@@toStringTag",k="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(k&&(e.exports=_));_=t.regeneratorRuntime=k?e.exports:{},_.wrap=n;var N="suspendedStart",O="suspendedYield",L="executing",S="completed",P={},T={};T[y]=function(){return this};var C=Object.getPrototypeOf,j=C&&C(C(d([])));j&&j!==v&&b.call(j,y)&&(T=j);var A=i.prototype=o.prototype=Object.create(T);a.prototype=A.constructor=i,i.constructor=a,i[x]=a.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,x in e||(e[x]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},l(c.prototype),c.prototype[E]=function(){return this},_.AsyncIterator=c,_.async=function(e,t,r,o){var a=new c(n(e,t,r,o));return _.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},l(A),A[x]="Generator",A[y]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&b.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=b.call(o,"catchLoc"),l=b.call(o,"finallyLoc");if(i&&l){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,P):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),P},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),P}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=g),P}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
gutenberg/poll/dist/blocks.editor.build.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wp-block-cgb-block-sampleblock{background:#bada55;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}.os-poll-wrapper .is-large,.os-poll-wrapper .is-block{height:30px;line-height:25px;padding:0 12px 2px}.os-poll-wrapper .is-block{
|
1 |
+
.wp-block-cgb-block-sampleblock{background:#bada55;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}.os-poll-wrapper .is-large,.os-poll-wrapper .is-block{height:30px;line-height:25px;padding:0 12px 2px;width:100%;max-width:50%;display:block}.os-poll-wrapper .is-block{margin-top:10px}.components-base-control.components-select-control__input{width:100%;float:left;max-width:80%;margin-right:10px}.os-poll-wrapper .components-preview__block{width:100%;max-width:100%;padding:10px;background:#fdfdfd;-webkit-box-shadow:0px 1px 2px 0px #3fb2c145;box-shadow:0px 1px 2px 0px #3fb2c145;-webkit-transition:0.2s;-o-transition:0.2s;transition:0.2s}.components-preview__leftBlockImage{width:100%;float:left}.block-editor__container .components-preview__leftBlockImage img{width:100%}.components-preview__rightBlockContent{width:100%;float:left}components-placeholder__fieldset{visibility:hidden;opacity:0}.components-preview__rightBlockContent .components-placeholder__label{font-size:18px;font-weight:bold;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;margin:0px;line-height:20px;margin:0px auto;margin-top:20px;margin-bottom:10px}ul.components-edit-view-stats__Block{list-style-type:none !important;text-align:left;color:#3fb2c1;font-weight:bold;margin-top:10px !important}ul.components-edit-view-stats__Block li{width:100%;max-width:30%;display:inline-block;float:left;margin-top:12px;text-align:center;margin:6px;padding:3px;font-weight:normal;letter-spacing:1px;border-radius:2px}.clear-both-OS__Block{clear:both}ul.components-edit-view-stats__Block li a{color:#fff}ul.components-edit-view-stats__Block li a{color:#fff;text-decoration:none}.components-preview__leftBlockImage{position:relative}.components-preview__leftBlockImage .image{display:block;width:100%;height:auto}.components-preview__leftBlockImage .overlay{position:absolute;top:0;bottom:0;left:0;right:0;height:100%;width:100%;opacity:0;-webkit-transition:.5s ease;-o-transition:.5s ease;transition:.5s ease;background-color:#222120}.components-preview__leftBlockImage:hover .overlay{opacity:0.8}.components-preview__leftBlockImage .text{color:white;font-size:20px;position:absolute;top:50%;left:50%;-webkit-transpoll:translate(-50%, -50%);-ms-transpoll:translate(-50%, -50%);transpoll:translate(-50%, -50%);text-align:center}.components-preview__leftBlockImage .text a{border-radius:5px;border:1px solid #fff;color:#fff;background:transparent;cursor:pointer;display:block;line-height:1;margin:10px auto;padding:10px 8px;text-align:center;text-decoration:none;text-transpoll:uppercase;width:140px}.components-preview__leftBlockImage .text a:hover,.components-preview__block input.left-align:hover{color:#000 !important;background:#fff !important}.components-preview__block .left-align{color:#fff;text-transpoll:uppercase;border:1px solid #FFF;-webkit-box-shadow:0px 0px;box-shadow:0px 0px;text-align:center;font-size:19px;border-radius:5px;padding:0px 32px;height:40px;width:100%;max-width:-webkit-fit-content;max-width:-moz-fit-content;max-width:fit-content;background:transparent}.components-preview__block .left-align:hover{background:transparent !important;color:#fff !important;border-color:#fff !important;-webkit-box-shadow:0px 0px !important;box-shadow:0px 0px !important}p.components-heading{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-weight:600;text-align:center}.os-poll-wrapper.components-placeholder{-webkit-transition:1s;-o-transition:1s;transition:1s}.os-poll-wrapper .wp-block-opinion-stage-block-os-poll .components-placeholder__fieldset{visibility:hidden;opacity:0}.os-poll-wrapper .components-placeholder__fieldset{visibility:hidden;opacity:0;height:0}
|
gutenberg/poll/src/.DS_Store
CHANGED
Binary file
|
gutenberg/poll/src/block/block.js
CHANGED
@@ -20,13 +20,18 @@ var options;
|
|
20 |
category: 'opinion-stage',
|
21 |
keywords: [
|
22 |
__( 'Opinion Stage Poll' ),
|
23 |
-
__( 'Opinion Stage Poll
|
24 |
],
|
25 |
attributes: {
|
26 |
embedUrl: {
|
27 |
source: 'attribute',
|
28 |
-
attribute: 'data-
|
29 |
-
selector: 'div[data-
|
|
|
|
|
|
|
|
|
|
|
30 |
},
|
31 |
lockEmbed: {
|
32 |
source: 'attribute',
|
@@ -37,10 +42,10 @@ var options;
|
|
37 |
source: 'attribute',
|
38 |
attribute: 'data-button-text',
|
39 |
selector: 'div[data-button-text]'
|
40 |
-
},
|
41 |
},
|
42 |
edit: function( props ) {
|
43 |
-
let {attributes: {embedUrl, lockEmbed, buttonText}, setAttributes} = props;
|
44 |
const onDropdownChange = val => {
|
45 |
if(val == ''){
|
46 |
props.setAttributes({ embedUrl: '' });
|
@@ -59,7 +64,7 @@ var options;
|
|
59 |
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
60 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
61 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
62 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
63 |
break;
|
64 |
}
|
65 |
}
|
@@ -72,13 +77,25 @@ var options;
|
|
72 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
73 |
}else{
|
74 |
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
75 |
-
contentDropdown = (<SelectControl options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
76 |
}
|
77 |
}else{
|
78 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
79 |
}
|
80 |
};
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=poll&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
83 |
const onCreateButtonClick = value => {
|
84 |
// Open Create new poll link in new page
|
@@ -93,7 +110,10 @@ var options;
|
|
93 |
var callback_url = getCallBackUrlOs;
|
94 |
var formActionUrlOS = osGutenData.getActionUrlOS;
|
95 |
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
96 |
-
|
|
|
|
|
|
|
97 |
// Populate list ajax function
|
98 |
function OsPolulateList() {
|
99 |
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
@@ -117,7 +137,7 @@ var options;
|
|
117 |
props.setAttributes({ buttonText: buttonText});
|
118 |
if(buttonText == 'Change' && embedUrl !='Select'){
|
119 |
props.setAttributes({ embedUrl: embedUrl });
|
120 |
-
}else{
|
121 |
props.setAttributes({ embedUrl: 'Select' });
|
122 |
}
|
123 |
})
|
@@ -126,29 +146,28 @@ var options;
|
|
126 |
});
|
127 |
}
|
128 |
// Checking for Opinion Stage connection
|
129 |
-
if(osGutenData.isOsConnected == ''){
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
return (
|
131 |
<div className={ props.className }>
|
132 |
<div className="os-poll-wrapper components-placeholder">
|
133 |
-
|
134 |
-
|
135 |
-
<
|
136 |
-
<input type="hidden" name="utm_campaign" value="WPMainPI"/>
|
137 |
-
<input type="hidden" name="utm_medium" value="link"/>
|
138 |
-
<input type="hidden" name="o" value="wp35e8"/>
|
139 |
-
<input type="hidden" name="callback" id="myvalue" value={callback_url} />
|
140 |
-
<input id="os-email" type="email" name="email" placeholder="Enter Your Email" className="components-placeholder__input" data-os-email-input=""/>
|
141 |
-
<button class="opinionstage-connect-btn opinionstage-blue-btn" type="submit" className="components-button is-button is-default is-block is-primary" id="os-start-login" data-os-login="">CONNECT</button>
|
142 |
-
</form>
|
143 |
</div>
|
144 |
</div>
|
145 |
);
|
146 |
}else{
|
147 |
if(dropdownOptions == false){
|
148 |
-
options = [{value:'Select',label:'Select a
|
149 |
OsPolulateList();
|
150 |
}else{
|
151 |
-
options = [{value:'Select',label:'Select a
|
152 |
for (var i = 0; i < dropdownOptions.length; i++) {
|
153 |
options[options.length] = {
|
154 |
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
@@ -167,26 +186,59 @@ var options;
|
|
167 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
168 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
169 |
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
|
|
|
|
170 |
}
|
171 |
}
|
172 |
}
|
173 |
-
if(embedUrl == 'refresh'){
|
174 |
OsPolulateList();
|
175 |
}
|
176 |
-
var contentDropdown = (<SelectControl options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
var contentViewEditStatOs = (
|
179 |
<div className="os-poll-wrapper components-placeholder">
|
180 |
-
|
181 |
-
|
|
|
182 |
<div className="components-placeholder__fieldset">
|
183 |
{contentDropdown}
|
184 |
-
<input type="button" value={buttonText} className="components-button is-button is-default is-large" onClick={onEmbedButtonClick} />
|
185 |
-
<input type="button" value="Create New Poll" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
186 |
</div>
|
187 |
</div>
|
188 |
);
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
if(embedUrl != '' && embedUrl != 'Select' && embedUrl){
|
192 |
if(buttonText == 'Embed'){
|
@@ -200,9 +252,9 @@ var options;
|
|
200 |
<img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
|
201 |
<div className="overlay">
|
202 |
<div className="text">
|
203 |
-
<a href={previewBlockOsView}
|
204 |
-
<a href={previewBlockOsEdit}
|
205 |
-
<a href={previewBlockOsStatistics}
|
206 |
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onEmbedButtonClick} />
|
207 |
</div>
|
208 |
</div>
|
@@ -213,7 +265,7 @@ var options;
|
|
213 |
</div>
|
214 |
</div>
|
215 |
);
|
216 |
-
contentDropdown = (<SelectControl options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
217 |
}
|
218 |
}else if(embedUrl == 'Select' || embedUrl == '' || embedUrl == 'refresh'){
|
219 |
contentViewEditStatOs
|
@@ -221,17 +273,19 @@ var options;
|
|
221 |
props.setAttributes({ buttonText: 'Embed'});
|
222 |
contentViewEditStatOs
|
223 |
}
|
|
|
|
|
224 |
return (
|
225 |
-
|
226 |
-
{contentViewEditStatOs}
|
227 |
</div>
|
228 |
);
|
229 |
}
|
230 |
},
|
231 |
-
save: function( {attributes: {embedUrl, lockEmbed, buttonText}} ) {
|
232 |
return (
|
233 |
-
<div class="os-poll-wrapper" data-type="
|
234 |
-
[os-widget path="{
|
235 |
</div>
|
236 |
);
|
237 |
},
|
20 |
category: 'opinion-stage',
|
21 |
keywords: [
|
22 |
__( 'Opinion Stage Poll' ),
|
23 |
+
__( 'Opinion Stage Poll' ),
|
24 |
],
|
25 |
attributes: {
|
26 |
embedUrl: {
|
27 |
source: 'attribute',
|
28 |
+
attribute: 'data-test-url',
|
29 |
+
selector: 'div[data-test-url]'
|
30 |
+
},
|
31 |
+
oswpUrlShortcode: {
|
32 |
+
source: 'attribute',
|
33 |
+
attribute: 'data-test-url',
|
34 |
+
selector: 'div[data-test-url]'
|
35 |
},
|
36 |
lockEmbed: {
|
37 |
source: 'attribute',
|
42 |
source: 'attribute',
|
43 |
attribute: 'data-button-text',
|
44 |
selector: 'div[data-button-text]'
|
45 |
+
},
|
46 |
},
|
47 |
edit: function( props ) {
|
48 |
+
let {attributes: {embedUrl, oswpUrlShortcode, lockEmbed, buttonText}, setAttributes} = props;
|
49 |
const onDropdownChange = val => {
|
50 |
if(val == ''){
|
51 |
props.setAttributes({ embedUrl: '' });
|
64 |
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
65 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
66 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
67 |
+
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
68 |
break;
|
69 |
}
|
70 |
}
|
77 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
78 |
}else{
|
79 |
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
80 |
+
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
81 |
}
|
82 |
}else{
|
83 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
84 |
}
|
85 |
};
|
86 |
|
87 |
+
window.verifyOSInsert = function(widget){
|
88 |
+
props.setAttributes({ oswpUrlShortcode: widget });
|
89 |
+
var myOpts = document.getElementById('selectID').options;
|
90 |
+
for(var i = 0; i < myOpts.length; i++){
|
91 |
+
if(myOpts[i].value == widget){
|
92 |
+
myOpts[i].defaultSelected = true;
|
93 |
+
props.setAttributes({ lockEmbed: true, buttonText: "Change", embedUrl: widget });
|
94 |
+
break;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=poll&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
100 |
const onCreateButtonClick = value => {
|
101 |
// Open Create new poll link in new page
|
110 |
var callback_url = getCallBackUrlOs;
|
111 |
var formActionUrlOS = osGutenData.getActionUrlOS;
|
112 |
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
113 |
+
const onConnectOSWPButtonClick = value => {
|
114 |
+
// Open Connect to opinionstage
|
115 |
+
window.location.replace(callback_url);
|
116 |
+
};
|
117 |
// Populate list ajax function
|
118 |
function OsPolulateList() {
|
119 |
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
137 |
props.setAttributes({ buttonText: buttonText});
|
138 |
if(buttonText == 'Change' && embedUrl !='Select'){
|
139 |
props.setAttributes({ embedUrl: embedUrl });
|
140 |
+
}else{
|
141 |
props.setAttributes({ embedUrl: 'Select' });
|
142 |
}
|
143 |
})
|
146 |
});
|
147 |
}
|
148 |
// Checking for Opinion Stage connection
|
149 |
+
if(osGutenData.isOsConnected == ''){
|
150 |
+
$(document).ready(function () {
|
151 |
+
$('span#oswpLauncherContentPopuppoll , #owspLaunchInputCreate').live('click', function(e) {
|
152 |
+
e.preventDefault();
|
153 |
+
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
154 |
+
});
|
155 |
+
});
|
156 |
return (
|
157 |
<div className={ props.className }>
|
158 |
<div className="os-poll-wrapper components-placeholder">
|
159 |
+
<p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
|
160 |
+
<p className="components-heading">Please connect Opinion Stage to WordPress to start adding polls</p>
|
161 |
+
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
</div>
|
163 |
</div>
|
164 |
);
|
165 |
}else{
|
166 |
if(dropdownOptions == false){
|
167 |
+
options = [{value:'Select',label:'Select a poll'},{value:'refresh',label:'Refresh'}];
|
168 |
OsPolulateList();
|
169 |
}else{
|
170 |
+
options = [{value:'Select',label:'Select a poll'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
|
171 |
for (var i = 0; i < dropdownOptions.length; i++) {
|
172 |
options[options.length] = {
|
173 |
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
186 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
187 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
188 |
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
189 |
+
var previewBlockOsWidgetID = dropdownOptions[i].id;
|
190 |
+
|
191 |
}
|
192 |
}
|
193 |
}
|
194 |
+
if(embedUrl == 'refresh'){
|
195 |
OsPolulateList();
|
196 |
}
|
197 |
+
var contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
198 |
+
$(document).ready(function () {
|
199 |
+
$('span#oswpLauncherContentPopuppoll').live('click', function(e) {
|
200 |
+
e.preventDefault();
|
201 |
+
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
202 |
+
var text = $(this).attr('data-os-block');
|
203 |
+
$("button#dropbtn span").text(text);
|
204 |
+
var inputs = $(".filter__itm");
|
205 |
+
for(var i = 0; i < inputs.length; i++){
|
206 |
+
if($(inputs[i]).text() == text){
|
207 |
+
setTimeout(function(){$(inputs[i]).trigger('click');},2000);
|
208 |
+
$('button.content__links-itm').live('click', function(e) {
|
209 |
+
$('.tingle-modal.opinionstage-content-popup').hide();
|
210 |
+
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
211 |
+
});
|
212 |
+
break;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
});
|
216 |
+
});
|
217 |
+
|
218 |
var contentViewEditStatOs = (
|
219 |
<div className="os-poll-wrapper components-placeholder">
|
220 |
+
<p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
|
221 |
+
<span id="oswpLauncherContentPopuppoll" className="components-button is-button is-default is-block is-primary" data-opinionstage-content-launch data-os-block="poll">Select a Poll</span>
|
222 |
+
<input type="button" value="Create a New Poll" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
223 |
<div className="components-placeholder__fieldset">
|
224 |
{contentDropdown}
|
225 |
+
<input type="button" value={buttonText} className="components-button is-button is-default is-large" id="clickMe" onClick={onEmbedButtonClick} />
|
|
|
226 |
</div>
|
227 |
</div>
|
228 |
);
|
229 |
+
|
230 |
+
var dataOpinionStageEmbedUrl = 'https://www.opinionstage.com/api/v1/widgets/'+embedUrl+'/code.json?comments=true&sharing=true&recommendations=false&width=';
|
231 |
+
var OpinionStageDataIframe = 'https://www.opinionstage.com/'+embedUrl+'?wid=0&em=1&comments=null&referring_widget='+embedUrl+'&autoswitch=1&of=&os_utm_source=null';
|
232 |
+
(function(d, s, id){
|
233 |
+
var js,
|
234 |
+
fjs = d.getElementsByTagName(s)[0],
|
235 |
+
r = Math.floor(new Date().getTime() / 1000000);
|
236 |
+
if (d.getElementById(id)) {return;}
|
237 |
+
js = d.createElement(s); js.id = id; js.async=1;
|
238 |
+
js.src = "https://www.opinionstage.com/assets/loader.js?" + r;
|
239 |
+
fjs.parentNode.insertBefore(js, fjs);
|
240 |
+
}(document, 'script', 'os-widget-jssdk'));
|
241 |
+
previewBlockOsWidgetID = 'os-widget-'+previewBlockOsWidgetID;
|
242 |
|
243 |
if(embedUrl != '' && embedUrl != 'Select' && embedUrl){
|
244 |
if(buttonText == 'Embed'){
|
252 |
<img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
|
253 |
<div className="overlay">
|
254 |
<div className="text">
|
255 |
+
<a href={previewBlockOsView} target="_blank"> View </a>
|
256 |
+
<a href={previewBlockOsEdit} target="_blank"> Edit </a>
|
257 |
+
<a href={previewBlockOsStatistics} target="_blank"> Statistics </a>
|
258 |
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onEmbedButtonClick} />
|
259 |
</div>
|
260 |
</div>
|
265 |
</div>
|
266 |
</div>
|
267 |
);
|
268 |
+
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
269 |
}
|
270 |
}else if(embedUrl == 'Select' || embedUrl == '' || embedUrl == 'refresh'){
|
271 |
contentViewEditStatOs
|
273 |
props.setAttributes({ buttonText: 'Embed'});
|
274 |
contentViewEditStatOs
|
275 |
}
|
276 |
+
|
277 |
+
|
278 |
return (
|
279 |
+
<div className={ props.className }>
|
280 |
+
{contentViewEditStatOs}
|
281 |
</div>
|
282 |
);
|
283 |
}
|
284 |
},
|
285 |
+
save: function( {attributes: {embedUrl, oswpUrlShortcode, lockEmbed, buttonText}} ) {
|
286 |
return (
|
287 |
+
<div class="os-poll-wrapper" data-type="poll" data-test-url={oswpUrlShortcode} data-lock-embed={lockEmbed} data-button-text={buttonText}>
|
288 |
+
[os-widget path="{oswpUrlShortcode}"]
|
289 |
</div>
|
290 |
);
|
291 |
},
|
gutenberg/poll/src/block/editor.scss
CHANGED
@@ -17,11 +17,12 @@
|
|
17 |
height: 30px;
|
18 |
line-height: 25px;
|
19 |
padding: 0 12px 2px;
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
.os-poll-wrapper .is-block {
|
23 |
-
display: block;
|
24 |
-
width: 100%;
|
25 |
margin-top: 10px;
|
26 |
}
|
27 |
.components-base-control.components-select-control__input {
|
@@ -49,6 +50,10 @@
|
|
49 |
width: 100%;
|
50 |
float: left;
|
51 |
}
|
|
|
|
|
|
|
|
|
52 |
.components-preview__rightBlockContent .components-placeholder__label {
|
53 |
font-size: 18px;
|
54 |
font-weight: bold;
|
@@ -125,9 +130,9 @@ ul.components-edit-view-stats__Block li a {
|
|
125 |
position: absolute;
|
126 |
top: 50%;
|
127 |
left: 50%;
|
128 |
-
-webkit-
|
129 |
-
-ms-
|
130 |
-
|
131 |
text-align: center;
|
132 |
}
|
133 |
.components-preview__leftBlockImage .text a{
|
@@ -142,7 +147,7 @@ ul.components-edit-view-stats__Block li a {
|
|
142 |
padding: 10px 8px;
|
143 |
text-align: center;
|
144 |
text-decoration: none;
|
145 |
-
text-
|
146 |
width: 140px;
|
147 |
}
|
148 |
.components-preview__leftBlockImage .text a:hover, .components-preview__block input.left-align:hover {
|
@@ -151,7 +156,7 @@ ul.components-edit-view-stats__Block li a {
|
|
151 |
}
|
152 |
.components-preview__block .left-align {
|
153 |
color: #fff;
|
154 |
-
text-
|
155 |
border: 1px solid #FFF;
|
156 |
box-shadow: 0px 0px;
|
157 |
text-align: center;
|
@@ -177,3 +182,12 @@ p.components-heading {
|
|
177 |
.os-poll-wrapper.components-placeholder {
|
178 |
transition: 1s;
|
179 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
height: 30px;
|
18 |
line-height: 25px;
|
19 |
padding: 0 12px 2px;
|
20 |
+
width: 100%;
|
21 |
+
max-width: 50%;
|
22 |
+
display: block;
|
23 |
}
|
24 |
|
25 |
.os-poll-wrapper .is-block {
|
|
|
|
|
26 |
margin-top: 10px;
|
27 |
}
|
28 |
.components-base-control.components-select-control__input {
|
50 |
width: 100%;
|
51 |
float: left;
|
52 |
}
|
53 |
+
components-placeholder__fieldset{
|
54 |
+
visibility: hidden;
|
55 |
+
opacity :0;
|
56 |
+
}
|
57 |
.components-preview__rightBlockContent .components-placeholder__label {
|
58 |
font-size: 18px;
|
59 |
font-weight: bold;
|
130 |
position: absolute;
|
131 |
top: 50%;
|
132 |
left: 50%;
|
133 |
+
-webkit-transpoll: translate(-50%, -50%);
|
134 |
+
-ms-transpoll: translate(-50%, -50%);
|
135 |
+
transpoll: translate(-50%, -50%);
|
136 |
text-align: center;
|
137 |
}
|
138 |
.components-preview__leftBlockImage .text a{
|
147 |
padding: 10px 8px;
|
148 |
text-align: center;
|
149 |
text-decoration: none;
|
150 |
+
text-transpoll: uppercase;
|
151 |
width: 140px;
|
152 |
}
|
153 |
.components-preview__leftBlockImage .text a:hover, .components-preview__block input.left-align:hover {
|
156 |
}
|
157 |
.components-preview__block .left-align {
|
158 |
color: #fff;
|
159 |
+
text-transpoll: uppercase;
|
160 |
border: 1px solid #FFF;
|
161 |
box-shadow: 0px 0px;
|
162 |
text-align: center;
|
182 |
.os-poll-wrapper.components-placeholder {
|
183 |
transition: 1s;
|
184 |
}
|
185 |
+
.os-poll-wrapper .wp-block-opinion-stage-block-os-poll .components-placeholder__fieldset {
|
186 |
+
visibility: hidden;
|
187 |
+
opacity: 0;
|
188 |
+
}
|
189 |
+
.os-poll-wrapper .components-placeholder__fieldset {
|
190 |
+
visibility: hidden;
|
191 |
+
opacity: 0;
|
192 |
+
height: 0;
|
193 |
+
}
|
gutenberg/slideshow/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),l=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}var o,a,i,l,s,c,u=n(2),p=n.n(u),m=n(5),h=(n.n(m),n(6)),d=(n.n(h),wp.i18n.__),f=wp.blocks.registerBlockType,b=wp.components,v=b.SelectControl,g=(b.TextControl,wp.editor.RichText,!1);f("opinion-stage/block-os-slideshow",{title:d("Slideshow"),icon:"playlist-video",category:"opinion-stage",keywords:[d("Opinion Stage Slideshow"),d("Opinion Stage Slideshow Insert")],attributes:{embedUrl:{source:"attribute",attribute:"data-embed-url",selector:"div[data-embed-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=slideshow&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,g=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.lockEmbed,n.buttonText),h=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<g.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(g[n].attributes["landing-page-url"]),c=r.pathname;if(t==c){o=g[n].attributes.title,a=g[n].attributes["image-url"],i=g[n].attributes["landing-page-url"],l=g[n].attributes["edit-url"],s=g[n].attributes["stats-url"];break}}}}),d=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),O=wp.element.createElement(v,{options:c,value:u,onChange:h,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})},f=osGutenData.onCreateButtonClickOs+"?w_type=slideshow&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",b=function(e){window.open(f,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var w=osGutenData.callbackUrlOs,y=w,E=osGutenData.getActionUrlOS,_=osGutenData.getLogoImageLink;if(""==osGutenData.isOsConnected)return wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-slideshow-wrapper components-placeholder"},wp.element.createElement("div",{className:"components-placeholder__label"},"Connect WordPress with Opinion Stage to get started"),wp.element.createElement("form",{method:"get",action:E,className:"components-placeholder__fieldset"},wp.element.createElement("input",{type:"hidden",name:"utm_source",value:"wordpress"}),wp.element.createElement("input",{type:"hidden",name:"utm_campaign",value:"WPMainPI"}),wp.element.createElement("input",{type:"hidden",name:"utm_medium",value:"link"}),wp.element.createElement("input",{type:"hidden",name:"o",value:"wp35e8"}),wp.element.createElement("input",{type:"hidden",name:"callback",id:"myvalue",value:y}),wp.element.createElement("input",{id:"os-email",type:"email",name:"email",placeholder:"Enter Your Email",className:"components-placeholder__input","data-os-email-input":""}),wp.element.createElement("button",{class:"opinionstage-connect-btn opinionstage-blue-btn",type:"submit",className:"components-button is-button is-default is-block is-primary",id:"os-start-login","data-os-login":""},"CONNECT"))));if(0==g)c=[{value:"Select",label:"Select a Slideshow"},{value:"refresh",label:"Refresh"}],t();else{c=[{value:"Select",label:"Select a Slideshow"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var x=0;x<g.length;x++){c[c.length]={value:g[x].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:g[x].attributes.title};var k=function(e){var t=document.createElement("a");return t.href=e,t}(g[x].attributes["landing-page-url"]),N=k.pathname;u==N&&(o=g[x].attributes.title,a=g[x].attributes["image-url"],i=g[x].attributes["landing-page-url"],l=g[x].attributes["edit-url"],s=g[x].attributes["stats-url"])}}"refresh"==u&&t();var O=wp.element.createElement(v,{options:c,value:u,onChange:h,className:"components-select-control__input"}),S=wp.element.createElement("div",{className:"os-slideshow-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:_,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-placeholder__label"},"Select an existing slideshow or create a new one"),wp.element.createElement("div",{className:"components-placeholder__fieldset"},O,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",onClick:d}),wp.element.createElement("input",{type:"button",value:"Create New Slideshow",className:"components-button is-button is-default is-block is-primary",onClick:b})));return""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(S=wp.element.createElement("div",{className:"os-slideshow-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:_,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,classname:"components-button is-button is-default is-large",target:"_blank"}," View "),wp.element.createElement("a",{href:l,classname:"components-button is-button is-default is-large",target:"_blank"}," Edit "),wp.element.createElement("a",{href:s,classname:"components-button is-button is-default is-large",target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:d})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Slideshow: ",o)))),O=wp.element.createElement(v,{options:c,value:u,disabled:!0,onChange:h,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},S)},save:function(e){var t=e.attributes,n=t.embedUrl,r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-slideshow-wrapper","data-type":"slideshow","data-embed-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),l=new h(r||[]);return i._invoke=c(e,n,l),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function s(e){function t(n,o,a,i){var l=r(e[n],e,o);if("throw"!==l.type){var s=l.arg,c=s.value;return c&&"object"===typeof c&&g.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(c).then(function(e){s.value=e,a(s)},i)}i(l.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function c(e,t,n){var o=N;return function(a,i){if(o===S)throw new Error("Generator is already running");if(o===L){if("throw"===a)throw i;return f()}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var s=u(l,n);if(s){if(s===T)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=L,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=S;var c=r(e,t,n);if("normal"===c.type){if(o=n.done?L:O,c.arg===T)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=L,n.method="throw",n.arg=c.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===b){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=b,u(e,t),"throw"===t.method))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,T;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=b),t.delegate=null,T):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function h(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[y];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(g.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=b,t.done=!0,t};return r.next=r}}return{next:f}}function f(){return{value:b,done:!0}}var b,v=Object.prototype,g=v.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",_=w.toStringTag||"@@toStringTag",x="object"===typeof e,k=t.regeneratorRuntime;if(k)return void(x&&(e.exports=k));k=t.regeneratorRuntime=x?e.exports:{},k.wrap=n;var N="suspendedStart",O="suspendedYield",S="executing",L="completed",T={},C={};C[y]=function(){return this};var P=Object.getPrototypeOf,j=P&&P(P(d([])));j&&j!==v&&g.call(j,y)&&(C=j);var G=i.prototype=o.prototype=Object.create(C);a.prototype=G.constructor=i,i.constructor=a,i[_]=a.displayName="GeneratorFunction",k.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},k.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_ in e||(e[_]="GeneratorFunction")),e.prototype=Object.create(G),e},k.awrap=function(e){return{__await:e}},l(s.prototype),s.prototype[E]=function(){return this},k.AsyncIterator=s,k.async=function(e,t,r,o){var a=new s(n(e,t,r,o));return k.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},l(G),G[_]="Generator",G[y]=function(){return this},G.toString=function(){return"[object Generator]"},k.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},k.values=d,h.prototype={constructor:h,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=b,this.done=!1,this.delegate=null,this.method="next",this.arg=b,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&g.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=b)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=b),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=g.call(o,"catchLoc"),l=g.call(o,"finallyLoc");if(i&&l){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&g.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,T):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=b),T}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
1 |
+
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),s=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});e(s)}return r("next")})}}var o,a,i,s,l,c,u=n(2),p=n.n(u),m=n(5),d=(n.n(m),n(6)),h=(n.n(d),wp.i18n.__),f=wp.blocks.registerBlockType,g=wp.components,v=g.SelectControl,w=(g.TextControl,wp.editor.RichText,!1);f("opinion-stage/block-os-slideshow",{title:h("Slideshow"),icon:"playlist-video",category:"opinion-stage",keywords:[h("Opinion Stage Slideshow"),h("Opinion Stage Slideshow")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},oswpUrlShortcode:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=slideshow&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,w=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.oswpUrlShortcode,n.lockEmbed,n.buttonText),d=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<w.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(w[n].attributes["landing-page-url"]),c=r.pathname;if(t==c){o=w[n].attributes.title,a=w[n].attributes["image-url"],i=w[n].attributes["landing-page-url"],s=w[n].attributes["edit-url"],l=w[n].attributes["stats-url"];break}}}}),h=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),O=wp.element.createElement(v,{id:"selectID",options:c,value:u,onChange:d,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})};window.verifyOSInsert=function(t){e.setAttributes({oswpUrlShortcode:t});for(var n=document.getElementById("selectID").options,r=0;r<n.length;r++)if(n[r].value==t){n[r].defaultSelected=!0,e.setAttributes({lockEmbed:!0,buttonText:"Change",embedUrl:t});break}};var f=osGutenData.onCreateButtonClickOs+"?w_type=slideshow&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",g=function(e){window.open(f,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var b=osGutenData.callbackUrlOs,y=b,E=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink);console.log(y);var x=function(e){window.location.replace(y)};if(""==osGutenData.isOsConnected)return $(document).ready(function(){$("span#oswpLauncherContentPopupslideshow , #owspLaunchInputCreate").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500)})}),wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-slideshow-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("p",{className:"components-heading"},"Please connect Opinion Stage to WordPress to start adding slideshows"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:x},"Connect")));if(0==w)c=[{value:"Select",label:"Select a slideshow"},{value:"refresh",label:"Refresh"}],t();else{c=[{value:"Select",label:"Select a slideshow"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var k=0;k<w.length;k++){c[c.length]={value:w[k].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:w[k].attributes.title};var _=function(e){var t=document.createElement("a");return t.href=e,t}(w[k].attributes["landing-page-url"]),N=_.pathname;if(u==N){o=w[k].attributes.title,a=w[k].attributes["image-url"],i=w[k].attributes["landing-page-url"],s=w[k].attributes["edit-url"],l=w[k].attributes["stats-url"];var S=w[k].id}}}"refresh"==u&&t();var O=wp.element.createElement(v,{id:"selectID",options:c,value:u,onChange:d,className:"components-select-control__input"});$(document).ready(function(){$("span#oswpLauncherContentPopupslideshow").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var t=$(this).attr("data-os-block");$("button#dropbtn span").text(t);for(var n=$(".filter__itm"),r=0;r<n.length;r++)if($(n[r]).text()==t){setTimeout(function(){$(n[r]).trigger("click")},2e3),$("button.content__links-itm").live("click",function(e){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}})});var L=wp.element.createElement("div",{className:"os-slideshow-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("span",{id:"oswpLauncherContentPopupslideshow",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"slideshow"},"Select a Slideshow"),wp.element.createElement("input",{type:"button",value:"Create a New Slideshow",className:"components-button is-button is-default is-block is-primary",onClick:g}),wp.element.createElement("div",{className:"components-placeholder__fieldset"},O,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",id:"clickMe",onClick:h})));return function(e,t,n){var r,o=e.getElementsByTagName(t)[0],a=Math.floor((new Date).getTime()/1e6);e.getElementById(n)||(r=e.createElement(t),r.id=n,r.async=1,r.src="https://www.opinionstage.com/assets/loader.js?"+a,o.parentNode.insertBefore(r,o))}(document,"script","os-widget-jssdk"),S="os-widget-"+S,""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(L=wp.element.createElement("div",{className:"os-slideshow-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,target:"_blank"}," View "),wp.element.createElement("a",{href:s,target:"_blank"}," Edit "),wp.element.createElement("a",{href:l,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:h})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Slideshow: ",o)))),O=wp.element.createElement(v,{id:"selectID",options:c,value:u,disabled:!0,onChange:d,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},L)},save:function(e){var t=e.attributes,n=(t.embedUrl,t.oswpUrlShortcode),r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-slideshow-wrapper","data-type":"slideshow","data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),s=new d(r||[]);return i._invoke=c(e,n,s),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function l(e){function t(n,o,a,i){var s=r(e[n],e,o);if("throw"!==s.type){var l=s.arg,c=l.value;return c&&"object"===typeof c&&w.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(c).then(function(e){l.value=e,a(l)},i)}i(s.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function c(e,t,n){var o=N;return function(a,i){if(o===O)throw new Error("Generator is already running");if(o===L){if("throw"===a)throw i;return f()}for(n.method=a,n.arg=i;;){var s=n.delegate;if(s){var l=u(s,n);if(l){if(l===T)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=L,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=O;var c=r(e,t,n);if("normal"===c.type){if(o=n.done?L:S,c.arg===T)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=L,n.method="throw",n.arg=c.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===g){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=g,u(e,t),"throw"===t.method))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,T;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=g),t.delegate=null,T):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function d(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function h(e){if(e){var t=e[y];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(w.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=g,t.done=!0,t};return r.next=r}}return{next:f}}function f(){return{value:g,done:!0}}var g,v=Object.prototype,w=v.hasOwnProperty,b="function"===typeof Symbol?Symbol:{},y=b.iterator||"@@iterator",E=b.asyncIterator||"@@asyncIterator",x=b.toStringTag||"@@toStringTag",k="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(k&&(e.exports=_));_=t.regeneratorRuntime=k?e.exports:{},_.wrap=n;var N="suspendedStart",S="suspendedYield",O="executing",L="completed",T={},C={};C[y]=function(){return this};var P=Object.getPrototypeOf,j=P&&P(P(h([])));j&&j!==v&&w.call(j,y)&&(C=j);var A=i.prototype=o.prototype=Object.create(C);a.prototype=A.constructor=i,i.constructor=a,i[x]=a.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,x in e||(e[x]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},s(l.prototype),l.prototype[E]=function(){return this},_.AsyncIterator=l,_.async=function(e,t,r,o){var a=new l(n(e,t,r,o));return _.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},s(A),A[x]="Generator",A[y]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=h,d.prototype={constructor:d,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&w.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=w.call(o,"catchLoc"),s=w.call(o,"finallyLoc");if(i&&s){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&w.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,T):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:h(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=g),T}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
gutenberg/slideshow/dist/blocks.editor.build.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wp-block-cgb-block-sampleblock{background:#bada55;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}.os-slideshow-wrapper .is-large,.os-slideshow-wrapper .is-block{height:30px;line-height:25px;padding:0 12px 2px}.os-slideshow-wrapper .is-block{
|
1 |
+
.wp-block-cgb-block-sampleblock{background:#bada55;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}.os-slideshow-wrapper .is-large,.os-slideshow-wrapper .is-block{height:30px;line-height:25px;padding:0 12px 2px;width:100%;max-width:50%;display:block}.os-slideshow-wrapper .is-block{margin-top:10px}.components-base-control.components-select-control__input{width:100%;float:left;max-width:80%;margin-right:10px}.os-slideshow-wrapper .components-preview__block{width:100%;max-width:100%;padding:10px;background:#fdfdfd;-webkit-box-shadow:0px 1px 2px 0px #3fb2c145;box-shadow:0px 1px 2px 0px #3fb2c145;-webkit-transition:0.2s;-o-transition:0.2s;transition:0.2s}.components-preview__leftBlockImage{width:100%;float:left}.block-editor__container .components-preview__leftBlockImage img{width:100%}.components-preview__rightBlockContent{width:100%;float:left}components-placeholder__fieldset{visibility:hidden;opacity:0}.components-preview__rightBlockContent .components-placeholder__label{font-size:18px;font-weight:bold;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;margin:0px;line-height:20px;margin:0px auto;margin-top:20px;margin-bottom:10px}ul.components-edit-view-stats__Block{list-style-type:none !important;text-align:left;color:#3fb2c1;font-weight:bold;margin-top:10px !important}ul.components-edit-view-stats__Block li{width:100%;max-width:30%;display:inline-block;float:left;margin-top:12px;text-align:center;margin:6px;padding:3px;font-weight:normal;letter-spacing:1px;border-radius:2px}.clear-both-OS__Block{clear:both}ul.components-edit-view-stats__Block li a{color:#fff}ul.components-edit-view-stats__Block li a{color:#fff;text-decoration:none}.components-preview__leftBlockImage{position:relative}.components-preview__leftBlockImage .image{display:block;width:100%;height:auto}.components-preview__leftBlockImage .overlay{position:absolute;top:0;bottom:0;left:0;right:0;height:100%;width:100%;opacity:0;-webkit-transition:.5s ease;-o-transition:.5s ease;transition:.5s ease;background-color:#222120}.components-preview__leftBlockImage:hover .overlay{opacity:0.8}.components-preview__leftBlockImage .text{color:white;font-size:20px;position:absolute;top:50%;left:50%;-webkit-transslideshow:translate(-50%, -50%);-ms-transslideshow:translate(-50%, -50%);transslideshow:translate(-50%, -50%);text-align:center}.components-preview__leftBlockImage .text a{border-radius:5px;border:1px solid #fff;color:#fff;background:transparent;cursor:pointer;display:block;line-height:1;margin:10px auto;padding:10px 8px;text-align:center;text-decoration:none;text-transslideshow:uppercase;width:140px}.components-preview__leftBlockImage .text a:hover,.components-preview__block input.left-align:hover{color:#000 !important;background:#fff !important}.components-preview__block .left-align{color:#fff;text-transslideshow:uppercase;border:1px solid #FFF;-webkit-box-shadow:0px 0px;box-shadow:0px 0px;text-align:center;font-size:19px;border-radius:5px;padding:0px 32px;height:40px;width:100%;max-width:-webkit-fit-content;max-width:-moz-fit-content;max-width:fit-content;background:transparent}.components-preview__block .left-align:hover{background:transparent !important;color:#fff !important;border-color:#fff !important;-webkit-box-shadow:0px 0px !important;box-shadow:0px 0px !important}p.components-heading{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-weight:600;text-align:center}.os-slideshow-wrapper.components-placeholder{-webkit-transition:1s;-o-transition:1s;transition:1s}.os-slideshow-wrapper .wp-block-opinion-stage-block-os-slideshow .components-placeholder__fieldset{visibility:hidden;opacity:0}.os-slideshow-wrapper .components-placeholder__fieldset{visibility:hidden;opacity:0;height:0}
|
gutenberg/slideshow/src/.DS_Store
CHANGED
Binary file
|
gutenberg/slideshow/src/block/block.js
CHANGED
@@ -20,13 +20,18 @@ var options;
|
|
20 |
category: 'opinion-stage',
|
21 |
keywords: [
|
22 |
__( 'Opinion Stage Slideshow' ),
|
23 |
-
__( 'Opinion Stage Slideshow
|
24 |
],
|
25 |
attributes: {
|
26 |
embedUrl: {
|
27 |
source: 'attribute',
|
28 |
-
attribute: 'data-
|
29 |
-
selector: 'div[data-
|
|
|
|
|
|
|
|
|
|
|
30 |
},
|
31 |
lockEmbed: {
|
32 |
source: 'attribute',
|
@@ -37,10 +42,10 @@ var options;
|
|
37 |
source: 'attribute',
|
38 |
attribute: 'data-button-text',
|
39 |
selector: 'div[data-button-text]'
|
40 |
-
},
|
41 |
},
|
42 |
edit: function( props ) {
|
43 |
-
let {attributes: {embedUrl, lockEmbed, buttonText}, setAttributes} = props;
|
44 |
const onDropdownChange = val => {
|
45 |
if(val == ''){
|
46 |
props.setAttributes({ embedUrl: '' });
|
@@ -59,7 +64,7 @@ var options;
|
|
59 |
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
60 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
61 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
62 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
63 |
break;
|
64 |
}
|
65 |
}
|
@@ -72,13 +77,25 @@ var options;
|
|
72 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
73 |
}else{
|
74 |
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
75 |
-
contentDropdown = (<SelectControl options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
76 |
}
|
77 |
}else{
|
78 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
79 |
}
|
80 |
};
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=slideshow&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
83 |
const onCreateButtonClick = value => {
|
84 |
// Open Create new slideshow link in new page
|
@@ -93,7 +110,11 @@ var options;
|
|
93 |
var callback_url = getCallBackUrlOs;
|
94 |
var formActionUrlOS = osGutenData.getActionUrlOS;
|
95 |
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
96 |
-
|
|
|
|
|
|
|
|
|
97 |
// Populate list ajax function
|
98 |
function OsPolulateList() {
|
99 |
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
@@ -117,7 +138,7 @@ var options;
|
|
117 |
props.setAttributes({ buttonText: buttonText});
|
118 |
if(buttonText == 'Change' && embedUrl !='Select'){
|
119 |
props.setAttributes({ embedUrl: embedUrl });
|
120 |
-
}else{
|
121 |
props.setAttributes({ embedUrl: 'Select' });
|
122 |
}
|
123 |
})
|
@@ -126,29 +147,28 @@ var options;
|
|
126 |
});
|
127 |
}
|
128 |
// Checking for Opinion Stage connection
|
129 |
-
if(osGutenData.isOsConnected == ''){
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
return (
|
131 |
<div className={ props.className }>
|
132 |
<div className="os-slideshow-wrapper components-placeholder">
|
133 |
-
|
134 |
-
|
135 |
-
<
|
136 |
-
<input type="hidden" name="utm_campaign" value="WPMainPI"/>
|
137 |
-
<input type="hidden" name="utm_medium" value="link"/>
|
138 |
-
<input type="hidden" name="o" value="wp35e8"/>
|
139 |
-
<input type="hidden" name="callback" id="myvalue" value={callback_url} />
|
140 |
-
<input id="os-email" type="email" name="email" placeholder="Enter Your Email" className="components-placeholder__input" data-os-email-input=""/>
|
141 |
-
<button class="opinionstage-connect-btn opinionstage-blue-btn" type="submit" className="components-button is-button is-default is-block is-primary" id="os-start-login" data-os-login="">CONNECT</button>
|
142 |
-
</form>
|
143 |
</div>
|
144 |
</div>
|
145 |
);
|
146 |
}else{
|
147 |
if(dropdownOptions == false){
|
148 |
-
options = [{value:'Select',label:'Select a
|
149 |
OsPolulateList();
|
150 |
}else{
|
151 |
-
options = [{value:'Select',label:'Select a
|
152 |
for (var i = 0; i < dropdownOptions.length; i++) {
|
153 |
options[options.length] = {
|
154 |
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
@@ -167,26 +187,59 @@ var options;
|
|
167 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
168 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
169 |
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
|
|
|
|
170 |
}
|
171 |
}
|
172 |
}
|
173 |
-
if(embedUrl == 'refresh'){
|
174 |
OsPolulateList();
|
175 |
}
|
176 |
-
var contentDropdown = (<SelectControl options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
var contentViewEditStatOs = (
|
179 |
<div className="os-slideshow-wrapper components-placeholder">
|
180 |
-
|
181 |
-
|
|
|
182 |
<div className="components-placeholder__fieldset">
|
183 |
{contentDropdown}
|
184 |
-
<input type="button" value={buttonText} className="components-button is-button is-default is-large" onClick={onEmbedButtonClick} />
|
185 |
-
<input type="button" value="Create New Slideshow" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
186 |
</div>
|
187 |
</div>
|
188 |
);
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
if(embedUrl != '' && embedUrl != 'Select' && embedUrl){
|
192 |
if(buttonText == 'Embed'){
|
@@ -200,9 +253,9 @@ var options;
|
|
200 |
<img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
|
201 |
<div className="overlay">
|
202 |
<div className="text">
|
203 |
-
<a href={previewBlockOsView}
|
204 |
-
<a href={previewBlockOsEdit}
|
205 |
-
<a href={previewBlockOsStatistics}
|
206 |
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onEmbedButtonClick} />
|
207 |
</div>
|
208 |
</div>
|
@@ -213,7 +266,7 @@ var options;
|
|
213 |
</div>
|
214 |
</div>
|
215 |
);
|
216 |
-
contentDropdown = (<SelectControl options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
217 |
}
|
218 |
}else if(embedUrl == 'Select' || embedUrl == '' || embedUrl == 'refresh'){
|
219 |
contentViewEditStatOs
|
@@ -221,17 +274,19 @@ var options;
|
|
221 |
props.setAttributes({ buttonText: 'Embed'});
|
222 |
contentViewEditStatOs
|
223 |
}
|
|
|
|
|
224 |
return (
|
225 |
-
|
226 |
-
{contentViewEditStatOs}
|
227 |
</div>
|
228 |
);
|
229 |
}
|
230 |
},
|
231 |
-
save: function( {attributes: {embedUrl, lockEmbed, buttonText}} ) {
|
232 |
return (
|
233 |
-
<div class="os-slideshow-wrapper" data-type="slideshow" data-
|
234 |
-
[os-widget path="{
|
235 |
</div>
|
236 |
);
|
237 |
},
|
20 |
category: 'opinion-stage',
|
21 |
keywords: [
|
22 |
__( 'Opinion Stage Slideshow' ),
|
23 |
+
__( 'Opinion Stage Slideshow' ),
|
24 |
],
|
25 |
attributes: {
|
26 |
embedUrl: {
|
27 |
source: 'attribute',
|
28 |
+
attribute: 'data-test-url',
|
29 |
+
selector: 'div[data-test-url]'
|
30 |
+
},
|
31 |
+
oswpUrlShortcode: {
|
32 |
+
source: 'attribute',
|
33 |
+
attribute: 'data-test-url',
|
34 |
+
selector: 'div[data-test-url]'
|
35 |
},
|
36 |
lockEmbed: {
|
37 |
source: 'attribute',
|
42 |
source: 'attribute',
|
43 |
attribute: 'data-button-text',
|
44 |
selector: 'div[data-button-text]'
|
45 |
+
},
|
46 |
},
|
47 |
edit: function( props ) {
|
48 |
+
let {attributes: {embedUrl, oswpUrlShortcode, lockEmbed, buttonText}, setAttributes} = props;
|
49 |
const onDropdownChange = val => {
|
50 |
if(val == ''){
|
51 |
props.setAttributes({ embedUrl: '' });
|
64 |
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
65 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
66 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
67 |
+
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
68 |
break;
|
69 |
}
|
70 |
}
|
77 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
78 |
}else{
|
79 |
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
80 |
+
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
81 |
}
|
82 |
}else{
|
83 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
84 |
}
|
85 |
};
|
86 |
|
87 |
+
window.verifyOSInsert = function(widget){
|
88 |
+
props.setAttributes({ oswpUrlShortcode: widget });
|
89 |
+
var myOpts = document.getElementById('selectID').options;
|
90 |
+
for(var i = 0; i < myOpts.length; i++){
|
91 |
+
if(myOpts[i].value == widget){
|
92 |
+
myOpts[i].defaultSelected = true;
|
93 |
+
props.setAttributes({ lockEmbed: true, buttonText: "Change", embedUrl: widget });
|
94 |
+
break;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=slideshow&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
100 |
const onCreateButtonClick = value => {
|
101 |
// Open Create new slideshow link in new page
|
110 |
var callback_url = getCallBackUrlOs;
|
111 |
var formActionUrlOS = osGutenData.getActionUrlOS;
|
112 |
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
113 |
+
console.log(callback_url);
|
114 |
+
const onConnectOSWPButtonClick = value => {
|
115 |
+
// Open Connect to opinionstage
|
116 |
+
window.location.replace(callback_url);
|
117 |
+
};
|
118 |
// Populate list ajax function
|
119 |
function OsPolulateList() {
|
120 |
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
138 |
props.setAttributes({ buttonText: buttonText});
|
139 |
if(buttonText == 'Change' && embedUrl !='Select'){
|
140 |
props.setAttributes({ embedUrl: embedUrl });
|
141 |
+
}else{
|
142 |
props.setAttributes({ embedUrl: 'Select' });
|
143 |
}
|
144 |
})
|
147 |
});
|
148 |
}
|
149 |
// Checking for Opinion Stage connection
|
150 |
+
if(osGutenData.isOsConnected == ''){
|
151 |
+
$(document).ready(function () {
|
152 |
+
$('span#oswpLauncherContentPopupslideshow , #owspLaunchInputCreate').live('click', function(e) {
|
153 |
+
e.preventDefault();
|
154 |
+
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
155 |
+
});
|
156 |
+
});
|
157 |
return (
|
158 |
<div className={ props.className }>
|
159 |
<div className="os-slideshow-wrapper components-placeholder">
|
160 |
+
<p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
|
161 |
+
<p className="components-heading">Please connect Opinion Stage to WordPress to start adding slideshows</p>
|
162 |
+
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
</div>
|
164 |
</div>
|
165 |
);
|
166 |
}else{
|
167 |
if(dropdownOptions == false){
|
168 |
+
options = [{value:'Select',label:'Select a slideshow'},{value:'refresh',label:'Refresh'}];
|
169 |
OsPolulateList();
|
170 |
}else{
|
171 |
+
options = [{value:'Select',label:'Select a slideshow'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
|
172 |
for (var i = 0; i < dropdownOptions.length; i++) {
|
173 |
options[options.length] = {
|
174 |
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
187 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
188 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
189 |
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
190 |
+
var previewBlockOsWidgetID = dropdownOptions[i].id;
|
191 |
+
|
192 |
}
|
193 |
}
|
194 |
}
|
195 |
+
if(embedUrl == 'refresh'){
|
196 |
OsPolulateList();
|
197 |
}
|
198 |
+
var contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
199 |
+
$(document).ready(function () {
|
200 |
+
$('span#oswpLauncherContentPopupslideshow').live('click', function(e) {
|
201 |
+
e.preventDefault();
|
202 |
+
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
203 |
+
var text = $(this).attr('data-os-block');
|
204 |
+
$("button#dropbtn span").text(text);
|
205 |
+
var inputs = $(".filter__itm");
|
206 |
+
for(var i = 0; i < inputs.length; i++){
|
207 |
+
if($(inputs[i]).text() == text){
|
208 |
+
setTimeout(function(){$(inputs[i]).trigger('click');},2000);
|
209 |
+
$('button.content__links-itm').live('click', function(e) {
|
210 |
+
$('.tingle-modal.opinionstage-content-popup').hide();
|
211 |
+
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
212 |
+
});
|
213 |
+
break;
|
214 |
+
}
|
215 |
+
}
|
216 |
+
});
|
217 |
+
});
|
218 |
+
|
219 |
var contentViewEditStatOs = (
|
220 |
<div className="os-slideshow-wrapper components-placeholder">
|
221 |
+
<p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
|
222 |
+
<span id="oswpLauncherContentPopupslideshow" className="components-button is-button is-default is-block is-primary" data-opinionstage-content-launch data-os-block="slideshow">Select a Slideshow</span>
|
223 |
+
<input type="button" value="Create a New Slideshow" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
224 |
<div className="components-placeholder__fieldset">
|
225 |
{contentDropdown}
|
226 |
+
<input type="button" value={buttonText} className="components-button is-button is-default is-large" id="clickMe" onClick={onEmbedButtonClick} />
|
|
|
227 |
</div>
|
228 |
</div>
|
229 |
);
|
230 |
+
|
231 |
+
var dataOpinionStageEmbedUrl = 'https://www.opinionstage.com/api/v1/widgets/'+embedUrl+'/code.json?comments=true&sharing=true&recommendations=false&width=';
|
232 |
+
var OpinionStageDataIframe = 'https://www.opinionstage.com/'+embedUrl+'?wid=0&em=1&comments=null&referring_widget='+embedUrl+'&autoswitch=1&of=&os_utm_source=null';
|
233 |
+
(function(d, s, id){
|
234 |
+
var js,
|
235 |
+
fjs = d.getElementsByTagName(s)[0],
|
236 |
+
r = Math.floor(new Date().getTime() / 1000000);
|
237 |
+
if (d.getElementById(id)) {return;}
|
238 |
+
js = d.createElement(s); js.id = id; js.async=1;
|
239 |
+
js.src = "https://www.opinionstage.com/assets/loader.js?" + r;
|
240 |
+
fjs.parentNode.insertBefore(js, fjs);
|
241 |
+
}(document, 'script', 'os-widget-jssdk'));
|
242 |
+
previewBlockOsWidgetID = 'os-widget-'+previewBlockOsWidgetID;
|
243 |
|
244 |
if(embedUrl != '' && embedUrl != 'Select' && embedUrl){
|
245 |
if(buttonText == 'Embed'){
|
253 |
<img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
|
254 |
<div className="overlay">
|
255 |
<div className="text">
|
256 |
+
<a href={previewBlockOsView} target="_blank"> View </a>
|
257 |
+
<a href={previewBlockOsEdit} target="_blank"> Edit </a>
|
258 |
+
<a href={previewBlockOsStatistics} target="_blank"> Statistics </a>
|
259 |
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onEmbedButtonClick} />
|
260 |
</div>
|
261 |
</div>
|
266 |
</div>
|
267 |
</div>
|
268 |
);
|
269 |
+
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
270 |
}
|
271 |
}else if(embedUrl == 'Select' || embedUrl == '' || embedUrl == 'refresh'){
|
272 |
contentViewEditStatOs
|
274 |
props.setAttributes({ buttonText: 'Embed'});
|
275 |
contentViewEditStatOs
|
276 |
}
|
277 |
+
|
278 |
+
|
279 |
return (
|
280 |
+
<div className={ props.className }>
|
281 |
+
{contentViewEditStatOs}
|
282 |
</div>
|
283 |
);
|
284 |
}
|
285 |
},
|
286 |
+
save: function( {attributes: {embedUrl, oswpUrlShortcode, lockEmbed, buttonText}} ) {
|
287 |
return (
|
288 |
+
<div class="os-slideshow-wrapper" data-type="slideshow" data-test-url={oswpUrlShortcode} data-lock-embed={lockEmbed} data-button-text={buttonText}>
|
289 |
+
[os-widget path="{oswpUrlShortcode}"]
|
290 |
</div>
|
291 |
);
|
292 |
},
|
gutenberg/slideshow/src/block/editor.scss
CHANGED
@@ -17,11 +17,12 @@
|
|
17 |
height: 30px;
|
18 |
line-height: 25px;
|
19 |
padding: 0 12px 2px;
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
.os-slideshow-wrapper .is-block {
|
23 |
-
display: block;
|
24 |
-
width: 100%;
|
25 |
margin-top: 10px;
|
26 |
}
|
27 |
.components-base-control.components-select-control__input {
|
@@ -49,6 +50,10 @@
|
|
49 |
width: 100%;
|
50 |
float: left;
|
51 |
}
|
|
|
|
|
|
|
|
|
52 |
.components-preview__rightBlockContent .components-placeholder__label {
|
53 |
font-size: 18px;
|
54 |
font-weight: bold;
|
@@ -177,3 +182,12 @@ p.components-heading {
|
|
177 |
.os-slideshow-wrapper.components-placeholder {
|
178 |
transition: 1s;
|
179 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
height: 30px;
|
18 |
line-height: 25px;
|
19 |
padding: 0 12px 2px;
|
20 |
+
width: 100%;
|
21 |
+
max-width: 50%;
|
22 |
+
display: block;
|
23 |
}
|
24 |
|
25 |
.os-slideshow-wrapper .is-block {
|
|
|
|
|
26 |
margin-top: 10px;
|
27 |
}
|
28 |
.components-base-control.components-select-control__input {
|
50 |
width: 100%;
|
51 |
float: left;
|
52 |
}
|
53 |
+
components-placeholder__fieldset{
|
54 |
+
visibility: hidden;
|
55 |
+
opacity :0;
|
56 |
+
}
|
57 |
.components-preview__rightBlockContent .components-placeholder__label {
|
58 |
font-size: 18px;
|
59 |
font-weight: bold;
|
182 |
.os-slideshow-wrapper.components-placeholder {
|
183 |
transition: 1s;
|
184 |
}
|
185 |
+
.os-slideshow-wrapper .wp-block-opinion-stage-block-os-slideshow .components-placeholder__fieldset {
|
186 |
+
visibility: hidden;
|
187 |
+
opacity: 0;
|
188 |
+
}
|
189 |
+
.os-slideshow-wrapper .components-placeholder__fieldset {
|
190 |
+
visibility: hidden;
|
191 |
+
opacity: 0;
|
192 |
+
height: 0;
|
193 |
+
}
|
gutenberg/survey/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(a,o){try{var i=t[a](o),l=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}var a,o,i,l,s,c,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),h=(n.n(f),wp.i18n.__),d=wp.blocks.registerBlockType,v=wp.components,b=v.SelectControl,g=(v.TextControl,wp.editor.RichText,!1);d("opinion-stage/block-os-survey",{title:h("Survey"),icon:"list-view",category:"opinion-stage",keywords:[h("Opinion Stage Survey"),h("Opinion Stage Survey Insert")],attributes:{embedUrl:{source:"attribute",attribute:"data-embed-url",selector:"div[data-embed-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,a=osGutenData.OswpClientToken,o=osGutenData.OswpFetchDataUrl+"?type=survey&page=1&per_page=99";fetch(o,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":a}}).then(function(){var n=r(p.a.mark(function n(r){var a;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:a=t.sent,a=a.data,g=a,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<g.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(g[n].attributes["landing-page-url"]),c=r.pathname;if(t==c){a=g[n].attributes.title,o=g[n].attributes["image-url"],i=g[n].attributes["landing-page-url"],l=g[n].attributes["edit-url"],s=g[n].attributes["stats-url"];break}}}}),h=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),O=wp.element.createElement(b,{options:c,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})},d=osGutenData.onCreateButtonClickOs+"?w_type=survey&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",v=function(e){window.open(d,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var y=osGutenData.callbackUrlOs,w=y,E=osGutenData.getActionUrlOS,_=osGutenData.getLogoImageLink;if(""==osGutenData.isOsConnected)return wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-survey-wrapper components-placeholder"},wp.element.createElement("div",{className:"components-placeholder__label"},"Connect WordPress with Opinion Stage to get started"),wp.element.createElement("form",{method:"get",action:E,className:"components-placeholder__fieldset"},wp.element.createElement("input",{type:"hidden",name:"utm_source",value:"wordpress"}),wp.element.createElement("input",{type:"hidden",name:"utm_campaign",value:"WPMainPI"}),wp.element.createElement("input",{type:"hidden",name:"utm_medium",value:"link"}),wp.element.createElement("input",{type:"hidden",name:"o",value:"wp35e8"}),wp.element.createElement("input",{type:"hidden",name:"callback",id:"myvalue",value:w}),wp.element.createElement("input",{id:"os-email",type:"email",name:"email",placeholder:"Enter Your Email",className:"components-placeholder__input","data-os-email-input":""}),wp.element.createElement("button",{class:"opinionstage-connect-btn opinionstage-blue-btn",type:"submit",className:"components-button is-button is-default is-block is-primary",id:"os-start-login","data-os-login":""},"CONNECT"))));if(0==g)c=[{value:"Select",label:"Select a Survey"},{value:"refresh",label:"Refresh"}],t();else{c=[{value:"Select",label:"Select a Survey"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var x=0;x<g.length;x++){c[c.length]={value:g[x].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:g[x].attributes.title};var k=function(e){var t=document.createElement("a");return t.href=e,t}(g[x].attributes["landing-page-url"]),N=k.pathname;u==N&&(a=g[x].attributes.title,o=g[x].attributes["image-url"],i=g[x].attributes["landing-page-url"],l=g[x].attributes["edit-url"],s=g[x].attributes["stats-url"])}}"refresh"==u&&t();var O=wp.element.createElement(b,{options:c,value:u,onChange:f,className:"components-select-control__input"}),S=wp.element.createElement("div",{className:"os-survey-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:_,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-placeholder__label"},"Select an existing survey or create a new one"),wp.element.createElement("div",{className:"components-placeholder__fieldset"},O,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",onClick:h}),wp.element.createElement("input",{type:"button",value:"Create New Survey",className:"components-button is-button is-default is-block is-primary",onClick:v})));return""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(S=wp.element.createElement("div",{className:"os-survey-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:_,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:o,alt:a,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,classname:"components-button is-button is-default is-large",target:"_blank"}," View "),wp.element.createElement("a",{href:l,classname:"components-button is-button is-default is-large",target:"_blank"}," Edit "),wp.element.createElement("a",{href:s,classname:"components-button is-button is-default is-large",target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:h})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Survey: ",a)))),O=wp.element.createElement(b,{options:c,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},S)},save:function(e){var t=e.attributes,n=t.embedUrl,r=t.lockEmbed,a=t.buttonText;return wp.element.createElement("div",{class:"os-survey-wrapper","data-type":"survey","data-embed-url":n,"data-lock-embed":r,"data-button-text":a},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),a=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=a&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),a)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var o=t&&t.prototype instanceof a?t:a,i=Object.create(o.prototype),l=new f(r||[]);return i._invoke=c(e,n,l),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function a(){}function o(){}function i(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function s(e){function t(n,a,o,i){var l=r(e[n],e,a);if("throw"!==l.type){var s=l.arg,c=s.value;return c&&"object"===typeof c&&g.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,o,i)},function(e){t("throw",e,o,i)}):Promise.resolve(c).then(function(e){s.value=e,o(s)},i)}i(l.arg)}function n(e,n){function r(){return new Promise(function(r,a){t(e,n,r,a)})}return a=a?a.then(r,r):r()}var a;this._invoke=n}function c(e,t,n){var a=N;return function(o,i){if(a===S)throw new Error("Generator is already running");if(a===L){if("throw"===o)throw i;return d()}for(n.method=o,n.arg=i;;){var l=n.delegate;if(l){var s=u(l,n);if(s){if(s===T)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===N)throw a=L,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=S;var c=r(e,t,n);if("normal"===c.type){if(a=n.done?L:O,c.arg===T)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=L,n.method="throw",n.arg=c.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===v){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=v,u(e,t),"throw"===t.method))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var a=r(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,T;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=v),t.delegate=null,T):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function h(e){if(e){var t=e[w];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(g.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=v,t.done=!0,t};return r.next=r}}return{next:d}}function d(){return{value:v,done:!0}}var v,b=Object.prototype,g=b.hasOwnProperty,y="function"===typeof Symbol?Symbol:{},w=y.iterator||"@@iterator",E=y.asyncIterator||"@@asyncIterator",_=y.toStringTag||"@@toStringTag",x="object"===typeof e,k=t.regeneratorRuntime;if(k)return void(x&&(e.exports=k));k=t.regeneratorRuntime=x?e.exports:{},k.wrap=n;var N="suspendedStart",O="suspendedYield",S="executing",L="completed",T={},C={};C[w]=function(){return this};var P=Object.getPrototypeOf,j=P&&P(P(h([])));j&&j!==b&&g.call(j,w)&&(C=j);var G=i.prototype=a.prototype=Object.create(C);o.prototype=G.constructor=i,i.constructor=o,i[_]=o.displayName="GeneratorFunction",k.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===o||"GeneratorFunction"===(t.displayName||t.name))},k.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_ in e||(e[_]="GeneratorFunction")),e.prototype=Object.create(G),e},k.awrap=function(e){return{__await:e}},l(s.prototype),s.prototype[E]=function(){return this},k.AsyncIterator=s,k.async=function(e,t,r,a){var o=new s(n(e,t,r,a));return k.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},l(G),G[_]="Generator",G[w]=function(){return this},G.toString=function(){return"[object Generator]"},k.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},k.values=h,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&g.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=v)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return o.type="throw",o.arg=e,n.next=t,r&&(n.method="next",n.arg=v),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],o=a.completion;if("root"===a.tryLoc)return t("end");if(a.tryLoc<=this.prev){var i=g.call(a,"catchLoc"),l=g.call(a,"finallyLoc");if(i&&l){if(this.prev<a.catchLoc)return t(a.catchLoc,!0);if(this.prev<a.finallyLoc)return t(a.finallyLoc)}else if(i){if(this.prev<a.catchLoc)return t(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return t(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&g.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,T):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;m(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:h(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=v),T}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
1 |
+
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),s=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});e(s)}return r("next")})}}var o,a,i,s,c,l,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),d=(n.n(f),wp.i18n.__),h=wp.blocks.registerBlockType,v=wp.components,g=v.SelectControl,b=(v.TextControl,wp.editor.RichText,!1);h("opinion-stage/block-os-survey",{title:d("Survey"),icon:"list-view",category:"opinion-stage",keywords:[d("Opinion Stage Survey"),d("Opinion Stage Survey")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},oswpUrlShortcode:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=survey&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,b=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.oswpUrlShortcode,n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<b.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(b[n].attributes["landing-page-url"]),l=r.pathname;if(t==l){o=b[n].attributes.title,a=b[n].attributes["image-url"],i=b[n].attributes["landing-page-url"],s=b[n].attributes["edit-url"],c=b[n].attributes["stats-url"];break}}}}),d=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),O=wp.element.createElement(g,{id:"selectID",options:l,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})};window.verifyOSInsert=function(t){e.setAttributes({oswpUrlShortcode:t});for(var n=document.getElementById("selectID").options,r=0;r<n.length;r++)if(n[r].value==t){n[r].defaultSelected=!0,e.setAttributes({lockEmbed:!0,buttonText:"Change",embedUrl:t});break}};var h=osGutenData.onCreateButtonClickOs+"?w_type=survey&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",v=function(e){window.open(h,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var y=osGutenData.callbackUrlOs,w=y,E=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),x=function(e){window.location.replace(w)};if(""==osGutenData.isOsConnected)return $(document).ready(function(){$("span#oswpLauncherContentPopupsurvey , #owspLaunchInputCreate").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500)})}),wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-survey-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("p",{className:"components-heading"},"Please connect Opinion Stage to WordPress to start adding surveys"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:x},"Connect")));if(0==b)l=[{value:"Select",label:"Select a survey"},{value:"refresh",label:"Refresh"}],t();else{l=[{value:"Select",label:"Select a survey"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var k=0;k<b.length;k++){l[l.length]={value:b[k].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:b[k].attributes.title};var _=function(e){var t=document.createElement("a");return t.href=e,t}(b[k].attributes["landing-page-url"]),N=_.pathname;if(u==N){o=b[k].attributes.title,a=b[k].attributes["image-url"],i=b[k].attributes["landing-page-url"],s=b[k].attributes["edit-url"],c=b[k].attributes["stats-url"];var S=b[k].id}}}"refresh"==u&&t();var O=wp.element.createElement(g,{id:"selectID",options:l,value:u,onChange:f,className:"components-select-control__input"});$(document).ready(function(){$("span#oswpLauncherContentPopupsurvey").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var t=$(this).attr("data-os-block");$("button#dropbtn span").text(t);for(var n=$(".filter__itm"),r=0;r<n.length;r++)if($(n[r]).text()==t){setTimeout(function(){$(n[r]).trigger("click")},2e3),$("button.content__links-itm").live("click",function(e){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}})});var L=wp.element.createElement("div",{className:"os-survey-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("span",{id:"oswpLauncherContentPopupsurvey",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"survey"},"Select a Survey"),wp.element.createElement("input",{type:"button",value:"Create a New Survey",className:"components-button is-button is-default is-block is-primary",onClick:v}),wp.element.createElement("div",{className:"components-placeholder__fieldset"},O,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",id:"clickMe",onClick:d})));return function(e,t,n){var r,o=e.getElementsByTagName(t)[0],a=Math.floor((new Date).getTime()/1e6);e.getElementById(n)||(r=e.createElement(t),r.id=n,r.async=1,r.src="https://www.opinionstage.com/assets/loader.js?"+a,o.parentNode.insertBefore(r,o))}(document,"script","os-widget-jssdk"),S="os-widget-"+S,""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(L=wp.element.createElement("div",{className:"os-survey-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,target:"_blank"}," View "),wp.element.createElement("a",{href:s,target:"_blank"}," Edit "),wp.element.createElement("a",{href:c,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:d})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Survey: ",o)))),O=wp.element.createElement(g,{id:"selectID",options:l,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},L)},save:function(e){var t=e.attributes,n=(t.embedUrl,t.oswpUrlShortcode),r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-survey-wrapper","data-type":"survey","data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),s=new f(r||[]);return i._invoke=l(e,n,s),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,o,a,i){var s=r(e[n],e,o);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"===typeof l&&b.call(l,"__await")?Promise.resolve(l.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(l).then(function(e){c.value=e,a(c)},i)}i(s.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function l(e,t,n){var o=N;return function(a,i){if(o===O)throw new Error("Generator is already running");if(o===L){if("throw"===a)throw i;return h()}for(n.method=a,n.arg=i;;){var s=n.delegate;if(s){var c=u(s,n);if(c){if(c===T)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=L,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=O;var l=r(e,t,n);if("normal"===l.type){if(o=n.done?L:S,l.arg===T)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=L,n.method="throw",n.arg=l.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===v){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=v,u(e,t),"throw"===t.method))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,T;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=v),t.delegate=null,T):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[w];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(b.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=v,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:v,done:!0}}var v,g=Object.prototype,b=g.hasOwnProperty,y="function"===typeof Symbol?Symbol:{},w=y.iterator||"@@iterator",E=y.asyncIterator||"@@asyncIterator",x=y.toStringTag||"@@toStringTag",k="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(k&&(e.exports=_));_=t.regeneratorRuntime=k?e.exports:{},_.wrap=n;var N="suspendedStart",S="suspendedYield",O="executing",L="completed",T={},C={};C[w]=function(){return this};var P=Object.getPrototypeOf,j=P&&P(P(d([])));j&&j!==g&&b.call(j,w)&&(C=j);var A=i.prototype=o.prototype=Object.create(C);a.prototype=A.constructor=i,i.constructor=a,i[x]=a.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,x in e||(e[x]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},s(c.prototype),c.prototype[E]=function(){return this},_.AsyncIterator=c,_.async=function(e,t,r,o){var a=new c(n(e,t,r,o));return _.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},s(A),A[x]="Generator",A[w]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&b.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=v)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=v),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=b.call(o,"catchLoc"),s=b.call(o,"finallyLoc");if(i&&s){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,T):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=v),T}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
gutenberg/survey/dist/blocks.editor.build.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wp-block-cgb-block-sampleblock{background:#bada55;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}.os-survey-wrapper .is-large,.os-survey-wrapper .is-block{height:30px;line-height:25px;padding:0 12px 2px}.os-survey-wrapper .is-block{
|
1 |
+
.wp-block-cgb-block-sampleblock{background:#bada55;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}.os-survey-wrapper .is-large,.os-survey-wrapper .is-block{height:30px;line-height:25px;padding:0 12px 2px;width:100%;max-width:50%;display:block}.os-survey-wrapper .is-block{margin-top:10px}.components-base-control.components-select-control__input{width:100%;float:left;max-width:80%;margin-right:10px}.os-survey-wrapper .components-preview__block{width:100%;max-width:100%;padding:10px;background:#fdfdfd;-webkit-box-shadow:0px 1px 2px 0px #3fb2c145;box-shadow:0px 1px 2px 0px #3fb2c145;-webkit-transition:0.2s;-o-transition:0.2s;transition:0.2s}.components-preview__leftBlockImage{width:100%;float:left}.block-editor__container .components-preview__leftBlockImage img{width:100%}.components-preview__rightBlockContent{width:100%;float:left}components-placeholder__fieldset{visibility:hidden;opacity:0}.components-preview__rightBlockContent .components-placeholder__label{font-size:18px;font-weight:bold;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;margin:0px;line-height:20px;margin:0px auto;margin-top:20px;margin-bottom:10px}ul.components-edit-view-stats__Block{list-style-type:none !important;text-align:left;color:#3fb2c1;font-weight:bold;margin-top:10px !important}ul.components-edit-view-stats__Block li{width:100%;max-width:30%;display:inline-block;float:left;margin-top:12px;text-align:center;margin:6px;padding:3px;font-weight:normal;letter-spacing:1px;border-radius:2px}.clear-both-OS__Block{clear:both}ul.components-edit-view-stats__Block li a{color:#fff}ul.components-edit-view-stats__Block li a{color:#fff;text-decoration:none}.components-preview__leftBlockImage{position:relative}.components-preview__leftBlockImage .image{display:block;width:100%;height:auto}.components-preview__leftBlockImage .overlay{position:absolute;top:0;bottom:0;left:0;right:0;height:100%;width:100%;opacity:0;-webkit-transition:.5s ease;-o-transition:.5s ease;transition:.5s ease;background-color:#222120}.components-preview__leftBlockImage:hover .overlay{opacity:0.8}.components-preview__leftBlockImage .text{color:white;font-size:20px;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);transform:translate(-50%, -50%);text-align:center}.components-preview__leftBlockImage .text a{border-radius:5px;border:1px solid #fff;color:#fff;background:transparent;cursor:pointer;display:block;line-height:1;margin:10px auto;padding:10px 8px;text-align:center;text-decoration:none;text-transform:uppercase;width:140px}.components-preview__leftBlockImage .text a:hover,.components-preview__block input.left-align:hover{color:#000 !important;background:#fff !important}.components-preview__block .left-align{color:#fff;text-transform:uppercase;border:1px solid #FFF;-webkit-box-shadow:0px 0px;box-shadow:0px 0px;text-align:center;font-size:19px;border-radius:5px;padding:0px 32px;height:40px;width:100%;max-width:-webkit-fit-content;max-width:-moz-fit-content;max-width:fit-content;background:transparent}.components-preview__block .left-align:hover{background:transparent !important;color:#fff !important;border-color:#fff !important;-webkit-box-shadow:0px 0px !important;box-shadow:0px 0px !important}p.components-heading{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-weight:600;text-align:center}.os-survey-wrapper.components-placeholder{-webkit-transition:1s;-o-transition:1s;transition:1s}.os-survey-wrapper .wp-block-opinion-stage-block-os-survey .components-placeholder__fieldset{visibility:hidden;opacity:0}.os-survey-wrapper .components-placeholder__fieldset{visibility:hidden;opacity:0;height:0}
|
gutenberg/survey/src/.DS_Store
CHANGED
Binary file
|
gutenberg/survey/src/block/block.js
CHANGED
@@ -20,13 +20,18 @@ var options;
|
|
20 |
category: 'opinion-stage',
|
21 |
keywords: [
|
22 |
__( 'Opinion Stage Survey' ),
|
23 |
-
__( 'Opinion Stage Survey
|
24 |
],
|
25 |
attributes: {
|
26 |
embedUrl: {
|
27 |
source: 'attribute',
|
28 |
-
attribute: 'data-
|
29 |
-
selector: 'div[data-
|
|
|
|
|
|
|
|
|
|
|
30 |
},
|
31 |
lockEmbed: {
|
32 |
source: 'attribute',
|
@@ -37,10 +42,10 @@ var options;
|
|
37 |
source: 'attribute',
|
38 |
attribute: 'data-button-text',
|
39 |
selector: 'div[data-button-text]'
|
40 |
-
},
|
41 |
},
|
42 |
edit: function( props ) {
|
43 |
-
let {attributes: {embedUrl, lockEmbed, buttonText}, setAttributes} = props;
|
44 |
const onDropdownChange = val => {
|
45 |
if(val == ''){
|
46 |
props.setAttributes({ embedUrl: '' });
|
@@ -59,7 +64,7 @@ var options;
|
|
59 |
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
60 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
61 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
62 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
63 |
break;
|
64 |
}
|
65 |
}
|
@@ -72,13 +77,25 @@ var options;
|
|
72 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
73 |
}else{
|
74 |
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
75 |
-
contentDropdown = (<SelectControl options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
76 |
}
|
77 |
}else{
|
78 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
79 |
}
|
80 |
};
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=survey&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
83 |
const onCreateButtonClick = value => {
|
84 |
// Open Create new survey link in new page
|
@@ -93,7 +110,10 @@ var options;
|
|
93 |
var callback_url = getCallBackUrlOs;
|
94 |
var formActionUrlOS = osGutenData.getActionUrlOS;
|
95 |
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
96 |
-
|
|
|
|
|
|
|
97 |
// Populate list ajax function
|
98 |
function OsPolulateList() {
|
99 |
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
@@ -117,7 +137,7 @@ var options;
|
|
117 |
props.setAttributes({ buttonText: buttonText});
|
118 |
if(buttonText == 'Change' && embedUrl !='Select'){
|
119 |
props.setAttributes({ embedUrl: embedUrl });
|
120 |
-
}else{
|
121 |
props.setAttributes({ embedUrl: 'Select' });
|
122 |
}
|
123 |
})
|
@@ -126,29 +146,28 @@ var options;
|
|
126 |
});
|
127 |
}
|
128 |
// Checking for Opinion Stage connection
|
129 |
-
if(osGutenData.isOsConnected == ''){
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
return (
|
131 |
<div className={ props.className }>
|
132 |
<div className="os-survey-wrapper components-placeholder">
|
133 |
-
|
134 |
-
|
135 |
-
<
|
136 |
-
<input type="hidden" name="utm_campaign" value="WPMainPI"/>
|
137 |
-
<input type="hidden" name="utm_medium" value="link"/>
|
138 |
-
<input type="hidden" name="o" value="wp35e8"/>
|
139 |
-
<input type="hidden" name="callback" id="myvalue" value={callback_url} />
|
140 |
-
<input id="os-email" type="email" name="email" placeholder="Enter Your Email" className="components-placeholder__input" data-os-email-input=""/>
|
141 |
-
<button class="opinionstage-connect-btn opinionstage-blue-btn" type="submit" className="components-button is-button is-default is-block is-primary" id="os-start-login" data-os-login="">CONNECT</button>
|
142 |
-
</form>
|
143 |
</div>
|
144 |
</div>
|
145 |
);
|
146 |
}else{
|
147 |
if(dropdownOptions == false){
|
148 |
-
options = [{value:'Select',label:'Select a
|
149 |
OsPolulateList();
|
150 |
}else{
|
151 |
-
options = [{value:'Select',label:'Select a
|
152 |
for (var i = 0; i < dropdownOptions.length; i++) {
|
153 |
options[options.length] = {
|
154 |
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
@@ -167,26 +186,59 @@ var options;
|
|
167 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
168 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
169 |
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
|
|
|
|
170 |
}
|
171 |
}
|
172 |
}
|
173 |
-
if(embedUrl == 'refresh'){
|
174 |
OsPolulateList();
|
175 |
}
|
176 |
-
var contentDropdown = (<SelectControl options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
var contentViewEditStatOs = (
|
179 |
<div className="os-survey-wrapper components-placeholder">
|
180 |
-
|
181 |
-
|
|
|
182 |
<div className="components-placeholder__fieldset">
|
183 |
{contentDropdown}
|
184 |
-
<input type="button" value={buttonText} className="components-button is-button is-default is-large" onClick={onEmbedButtonClick} />
|
185 |
-
<input type="button" value="Create New Survey" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
186 |
</div>
|
187 |
</div>
|
188 |
);
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
if(embedUrl != '' && embedUrl != 'Select' && embedUrl){
|
192 |
if(buttonText == 'Embed'){
|
@@ -200,9 +252,9 @@ var options;
|
|
200 |
<img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
|
201 |
<div className="overlay">
|
202 |
<div className="text">
|
203 |
-
<a href={previewBlockOsView}
|
204 |
-
<a href={previewBlockOsEdit}
|
205 |
-
<a href={previewBlockOsStatistics}
|
206 |
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onEmbedButtonClick} />
|
207 |
</div>
|
208 |
</div>
|
@@ -213,7 +265,7 @@ var options;
|
|
213 |
</div>
|
214 |
</div>
|
215 |
);
|
216 |
-
contentDropdown = (<SelectControl options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
217 |
}
|
218 |
}else if(embedUrl == 'Select' || embedUrl == '' || embedUrl == 'refresh'){
|
219 |
contentViewEditStatOs
|
@@ -221,17 +273,19 @@ var options;
|
|
221 |
props.setAttributes({ buttonText: 'Embed'});
|
222 |
contentViewEditStatOs
|
223 |
}
|
|
|
|
|
224 |
return (
|
225 |
-
|
226 |
-
{contentViewEditStatOs}
|
227 |
</div>
|
228 |
);
|
229 |
}
|
230 |
},
|
231 |
-
save: function( {attributes: {embedUrl, lockEmbed, buttonText}} ) {
|
232 |
return (
|
233 |
-
<div class="os-survey-wrapper" data-type="survey" data-
|
234 |
-
[os-widget path="{
|
235 |
</div>
|
236 |
);
|
237 |
},
|
20 |
category: 'opinion-stage',
|
21 |
keywords: [
|
22 |
__( 'Opinion Stage Survey' ),
|
23 |
+
__( 'Opinion Stage Survey' ),
|
24 |
],
|
25 |
attributes: {
|
26 |
embedUrl: {
|
27 |
source: 'attribute',
|
28 |
+
attribute: 'data-test-url',
|
29 |
+
selector: 'div[data-test-url]'
|
30 |
+
},
|
31 |
+
oswpUrlShortcode: {
|
32 |
+
source: 'attribute',
|
33 |
+
attribute: 'data-test-url',
|
34 |
+
selector: 'div[data-test-url]'
|
35 |
},
|
36 |
lockEmbed: {
|
37 |
source: 'attribute',
|
42 |
source: 'attribute',
|
43 |
attribute: 'data-button-text',
|
44 |
selector: 'div[data-button-text]'
|
45 |
+
},
|
46 |
},
|
47 |
edit: function( props ) {
|
48 |
+
let {attributes: {embedUrl, oswpUrlShortcode, lockEmbed, buttonText}, setAttributes} = props;
|
49 |
const onDropdownChange = val => {
|
50 |
if(val == ''){
|
51 |
props.setAttributes({ embedUrl: '' });
|
64 |
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
65 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
66 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
67 |
+
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
68 |
break;
|
69 |
}
|
70 |
}
|
77 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
78 |
}else{
|
79 |
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
80 |
+
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
81 |
}
|
82 |
}else{
|
83 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
84 |
}
|
85 |
};
|
86 |
|
87 |
+
window.verifyOSInsert = function(widget){
|
88 |
+
props.setAttributes({ oswpUrlShortcode: widget });
|
89 |
+
var myOpts = document.getElementById('selectID').options;
|
90 |
+
for(var i = 0; i < myOpts.length; i++){
|
91 |
+
if(myOpts[i].value == widget){
|
92 |
+
myOpts[i].defaultSelected = true;
|
93 |
+
props.setAttributes({ lockEmbed: true, buttonText: "Change", embedUrl: widget });
|
94 |
+
break;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=survey&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
100 |
const onCreateButtonClick = value => {
|
101 |
// Open Create new survey link in new page
|
110 |
var callback_url = getCallBackUrlOs;
|
111 |
var formActionUrlOS = osGutenData.getActionUrlOS;
|
112 |
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
113 |
+
const onConnectOSWPButtonClick = value => {
|
114 |
+
// Open Connect to opinionstage
|
115 |
+
window.location.replace(callback_url);
|
116 |
+
};
|
117 |
// Populate list ajax function
|
118 |
function OsPolulateList() {
|
119 |
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
137 |
props.setAttributes({ buttonText: buttonText});
|
138 |
if(buttonText == 'Change' && embedUrl !='Select'){
|
139 |
props.setAttributes({ embedUrl: embedUrl });
|
140 |
+
}else{
|
141 |
props.setAttributes({ embedUrl: 'Select' });
|
142 |
}
|
143 |
})
|
146 |
});
|
147 |
}
|
148 |
// Checking for Opinion Stage connection
|
149 |
+
if(osGutenData.isOsConnected == ''){
|
150 |
+
$(document).ready(function () {
|
151 |
+
$('span#oswpLauncherContentPopupsurvey , #owspLaunchInputCreate').live('click', function(e) {
|
152 |
+
e.preventDefault();
|
153 |
+
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
154 |
+
});
|
155 |
+
});
|
156 |
return (
|
157 |
<div className={ props.className }>
|
158 |
<div className="os-survey-wrapper components-placeholder">
|
159 |
+
<p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
|
160 |
+
<p className="components-heading">Please connect Opinion Stage to WordPress to start adding surveys</p>
|
161 |
+
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
</div>
|
163 |
</div>
|
164 |
);
|
165 |
}else{
|
166 |
if(dropdownOptions == false){
|
167 |
+
options = [{value:'Select',label:'Select a survey'},{value:'refresh',label:'Refresh'}];
|
168 |
OsPolulateList();
|
169 |
}else{
|
170 |
+
options = [{value:'Select',label:'Select a survey'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
|
171 |
for (var i = 0; i < dropdownOptions.length; i++) {
|
172 |
options[options.length] = {
|
173 |
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
186 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
187 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
188 |
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
189 |
+
var previewBlockOsWidgetID = dropdownOptions[i].id;
|
190 |
+
|
191 |
}
|
192 |
}
|
193 |
}
|
194 |
+
if(embedUrl == 'refresh'){
|
195 |
OsPolulateList();
|
196 |
}
|
197 |
+
var contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
198 |
+
$(document).ready(function () {
|
199 |
+
$('span#oswpLauncherContentPopupsurvey').live('click', function(e) {
|
200 |
+
e.preventDefault();
|
201 |
+
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
202 |
+
var text = $(this).attr('data-os-block');
|
203 |
+
$("button#dropbtn span").text(text);
|
204 |
+
var inputs = $(".filter__itm");
|
205 |
+
for(var i = 0; i < inputs.length; i++){
|
206 |
+
if($(inputs[i]).text() == text){
|
207 |
+
setTimeout(function(){$(inputs[i]).trigger('click');},2000);
|
208 |
+
$('button.content__links-itm').live('click', function(e) {
|
209 |
+
$('.tingle-modal.opinionstage-content-popup').hide();
|
210 |
+
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
211 |
+
});
|
212 |
+
break;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
});
|
216 |
+
});
|
217 |
+
|
218 |
var contentViewEditStatOs = (
|
219 |
<div className="os-survey-wrapper components-placeholder">
|
220 |
+
<p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
|
221 |
+
<span id="oswpLauncherContentPopupsurvey" className="components-button is-button is-default is-block is-primary" data-opinionstage-content-launch data-os-block="survey">Select a Survey</span>
|
222 |
+
<input type="button" value="Create a New Survey" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
223 |
<div className="components-placeholder__fieldset">
|
224 |
{contentDropdown}
|
225 |
+
<input type="button" value={buttonText} className="components-button is-button is-default is-large" id="clickMe" onClick={onEmbedButtonClick} />
|
|
|
226 |
</div>
|
227 |
</div>
|
228 |
);
|
229 |
+
|
230 |
+
var dataOpinionStageEmbedUrl = 'https://www.opinionstage.com/api/v1/widgets/'+embedUrl+'/code.json?comments=true&sharing=true&recommendations=false&width=';
|
231 |
+
var OpinionStageDataIframe = 'https://www.opinionstage.com/'+embedUrl+'?wid=0&em=1&comments=null&referring_widget='+embedUrl+'&autoswitch=1&of=&os_utm_source=null';
|
232 |
+
(function(d, s, id){
|
233 |
+
var js,
|
234 |
+
fjs = d.getElementsByTagName(s)[0],
|
235 |
+
r = Math.floor(new Date().getTime() / 1000000);
|
236 |
+
if (d.getElementById(id)) {return;}
|
237 |
+
js = d.createElement(s); js.id = id; js.async=1;
|
238 |
+
js.src = "https://www.opinionstage.com/assets/loader.js?" + r;
|
239 |
+
fjs.parentNode.insertBefore(js, fjs);
|
240 |
+
}(document, 'script', 'os-widget-jssdk'));
|
241 |
+
previewBlockOsWidgetID = 'os-widget-'+previewBlockOsWidgetID;
|
242 |
|
243 |
if(embedUrl != '' && embedUrl != 'Select' && embedUrl){
|
244 |
if(buttonText == 'Embed'){
|
252 |
<img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
|
253 |
<div className="overlay">
|
254 |
<div className="text">
|
255 |
+
<a href={previewBlockOsView} target="_blank"> View </a>
|
256 |
+
<a href={previewBlockOsEdit} target="_blank"> Edit </a>
|
257 |
+
<a href={previewBlockOsStatistics} target="_blank"> Statistics </a>
|
258 |
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onEmbedButtonClick} />
|
259 |
</div>
|
260 |
</div>
|
265 |
</div>
|
266 |
</div>
|
267 |
);
|
268 |
+
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
269 |
}
|
270 |
}else if(embedUrl == 'Select' || embedUrl == '' || embedUrl == 'refresh'){
|
271 |
contentViewEditStatOs
|
273 |
props.setAttributes({ buttonText: 'Embed'});
|
274 |
contentViewEditStatOs
|
275 |
}
|
276 |
+
|
277 |
+
|
278 |
return (
|
279 |
+
<div className={ props.className }>
|
280 |
+
{contentViewEditStatOs}
|
281 |
</div>
|
282 |
);
|
283 |
}
|
284 |
},
|
285 |
+
save: function( {attributes: {embedUrl, oswpUrlShortcode, lockEmbed, buttonText}} ) {
|
286 |
return (
|
287 |
+
<div class="os-survey-wrapper" data-type="survey" data-test-url={oswpUrlShortcode} data-lock-embed={lockEmbed} data-button-text={buttonText}>
|
288 |
+
[os-widget path="{oswpUrlShortcode}"]
|
289 |
</div>
|
290 |
);
|
291 |
},
|
gutenberg/survey/src/block/editor.scss
CHANGED
@@ -17,11 +17,12 @@
|
|
17 |
height: 30px;
|
18 |
line-height: 25px;
|
19 |
padding: 0 12px 2px;
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
.os-survey-wrapper .is-block {
|
23 |
-
display: block;
|
24 |
-
width: 100%;
|
25 |
margin-top: 10px;
|
26 |
}
|
27 |
.components-base-control.components-select-control__input {
|
@@ -49,6 +50,10 @@
|
|
49 |
width: 100%;
|
50 |
float: left;
|
51 |
}
|
|
|
|
|
|
|
|
|
52 |
.components-preview__rightBlockContent .components-placeholder__label {
|
53 |
font-size: 18px;
|
54 |
font-weight: bold;
|
@@ -177,3 +182,12 @@ p.components-heading {
|
|
177 |
.os-survey-wrapper.components-placeholder {
|
178 |
transition: 1s;
|
179 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
height: 30px;
|
18 |
line-height: 25px;
|
19 |
padding: 0 12px 2px;
|
20 |
+
width: 100%;
|
21 |
+
max-width: 50%;
|
22 |
+
display: block;
|
23 |
}
|
24 |
|
25 |
.os-survey-wrapper .is-block {
|
|
|
|
|
26 |
margin-top: 10px;
|
27 |
}
|
28 |
.components-base-control.components-select-control__input {
|
50 |
width: 100%;
|
51 |
float: left;
|
52 |
}
|
53 |
+
components-placeholder__fieldset{
|
54 |
+
visibility: hidden;
|
55 |
+
opacity :0;
|
56 |
+
}
|
57 |
.components-preview__rightBlockContent .components-placeholder__label {
|
58 |
font-size: 18px;
|
59 |
font-weight: bold;
|
182 |
.os-survey-wrapper.components-placeholder {
|
183 |
transition: 1s;
|
184 |
}
|
185 |
+
.os-survey-wrapper .wp-block-opinion-stage-block-os-survey .components-placeholder__fieldset {
|
186 |
+
visibility: hidden;
|
187 |
+
opacity: 0;
|
188 |
+
}
|
189 |
+
.os-survey-wrapper .components-placeholder__fieldset {
|
190 |
+
visibility: hidden;
|
191 |
+
opacity: 0;
|
192 |
+
height: 0;
|
193 |
+
}
|
gutenberg/trivia/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(a,o){try{var i=t[a](o),l=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}var a,o,i,l,c,s,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),h=(n.n(f),wp.i18n.__),d=wp.blocks.registerBlockType,v=wp.components,b=v.SelectControl,g=(v.TextControl,wp.editor.RichText,!1);d("opinion-stage/block-os-trivia",{title:h("Trivia Quiz"),icon:"yes",category:"opinion-stage",keywords:[h("Opinion Stage Trivia Quiz"),h("Opinion Stage Trivia Quiz Insert")],attributes:{embedUrl:{source:"attribute",attribute:"data-embed-url",selector:"div[data-embed-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,a=osGutenData.OswpClientToken,o=osGutenData.OswpFetchDataUrl+"?type=trivia&page=1&per_page=99";fetch(o,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":a}}).then(function(){var n=r(p.a.mark(function n(r){var a;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:a=t.sent,a=a.data,g=a,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<g.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(g[n].attributes["landing-page-url"]),s=r.pathname;if(t==s){a=g[n].attributes.title,o=g[n].attributes["image-url"],i=g[n].attributes["landing-page-url"],l=g[n].attributes["edit-url"],c=g[n].attributes["stats-url"];break}}}}),h=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),O=wp.element.createElement(b,{options:s,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})},d=osGutenData.onCreateButtonClickOs+"?w_type=quiz&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",v=function(e){window.open(d,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var w=osGutenData.callbackUrlOs,y=w,E=osGutenData.getActionUrlOS,_=osGutenData.getLogoImageLink;if(""==osGutenData.isOsConnected)return wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-trivia-wrapper components-placeholder"},wp.element.createElement("div",{className:"components-placeholder__label"},"Connect WordPress with Opinion Stage to get started"),wp.element.createElement("form",{method:"get",action:E,className:"components-placeholder__fieldset"},wp.element.createElement("input",{type:"hidden",name:"utm_source",value:"wordpress"}),wp.element.createElement("input",{type:"hidden",name:"utm_campaign",value:"WPMainPI"}),wp.element.createElement("input",{type:"hidden",name:"utm_medium",value:"link"}),wp.element.createElement("input",{type:"hidden",name:"o",value:"wp35e8"}),wp.element.createElement("input",{type:"hidden",name:"callback",id:"myvalue",value:y}),wp.element.createElement("input",{id:"os-email",type:"email",name:"email",placeholder:"Enter Your Email",className:"components-placeholder__input","data-os-email-input":""}),wp.element.createElement("button",{class:"opinionstage-connect-btn opinionstage-blue-btn",type:"submit",className:"components-button is-button is-default is-block is-primary",id:"os-start-login","data-os-login":""},"CONNECT"))));if(0==g)s=[{value:"Select",label:"Select a Trivia Quiz"},{value:"refresh",label:"Refresh"}],t();else{s=[{value:"Select",label:"Select a Trivia Quiz"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var x=0;x<g.length;x++){s[s.length]={value:g[x].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:g[x].attributes.title};var k=function(e){var t=document.createElement("a");return t.href=e,t}(g[x].attributes["landing-page-url"]),N=k.pathname;u==N&&(a=g[x].attributes.title,o=g[x].attributes["image-url"],i=g[x].attributes["landing-page-url"],l=g[x].attributes["edit-url"],c=g[x].attributes["stats-url"])}}"refresh"==u&&t();var O=wp.element.createElement(b,{options:s,value:u,onChange:f,className:"components-select-control__input"}),L=wp.element.createElement("div",{className:"os-trivia-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:_,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-placeholder__label"},"Select an existing trivia quiz or create a new one"),wp.element.createElement("div",{className:"components-placeholder__fieldset"},O,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",onClick:h}),wp.element.createElement("input",{type:"button",value:"Create New Trivia Quiz",className:"components-button is-button is-default is-block is-primary",onClick:v})));return""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(L=wp.element.createElement("div",{className:"os-trivia-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:_,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:o,alt:a,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,classname:"components-button is-button is-default is-large",target:"_blank"}," View "),wp.element.createElement("a",{href:l,classname:"components-button is-button is-default is-large",target:"_blank"}," Edit "),wp.element.createElement("a",{href:c,classname:"components-button is-button is-default is-large",target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:h})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Trivia Quiz: ",a)))),O=wp.element.createElement(b,{options:s,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},L)},save:function(e){var t=e.attributes,n=t.embedUrl,r=t.lockEmbed,a=t.buttonText;return wp.element.createElement("div",{class:"os-trivia-wrapper","data-type":"trivia","data-embed-url":n,"data-lock-embed":r,"data-button-text":a},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),a=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=a&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),a)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var o=t&&t.prototype instanceof a?t:a,i=Object.create(o.prototype),l=new f(r||[]);return i._invoke=s(e,n,l),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function a(){}function o(){}function i(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,a,o,i){var l=r(e[n],e,a);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"===typeof s&&g.call(s,"__await")?Promise.resolve(s.__await).then(function(e){t("next",e,o,i)},function(e){t("throw",e,o,i)}):Promise.resolve(s).then(function(e){c.value=e,o(c)},i)}i(l.arg)}function n(e,n){function r(){return new Promise(function(r,a){t(e,n,r,a)})}return a=a?a.then(r,r):r()}var a;this._invoke=n}function s(e,t,n){var a=N;return function(o,i){if(a===L)throw new Error("Generator is already running");if(a===T){if("throw"===o)throw i;return d()}for(n.method=o,n.arg=i;;){var l=n.delegate;if(l){var c=u(l,n);if(c){if(c===S)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===N)throw a=T,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=L;var s=r(e,t,n);if("normal"===s.type){if(a=n.done?T:O,s.arg===S)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(a=T,n.method="throw",n.arg=s.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===v){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=v,u(e,t),"throw"===t.method))return S;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return S}var a=r(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,S;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=v),t.delegate=null,S):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,S)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function h(e){if(e){var t=e[y];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(g.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=v,t.done=!0,t};return r.next=r}}return{next:d}}function d(){return{value:v,done:!0}}var v,b=Object.prototype,g=b.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",_=w.toStringTag||"@@toStringTag",x="object"===typeof e,k=t.regeneratorRuntime;if(k)return void(x&&(e.exports=k));k=t.regeneratorRuntime=x?e.exports:{},k.wrap=n;var N="suspendedStart",O="suspendedYield",L="executing",T="completed",S={},C={};C[y]=function(){return this};var P=Object.getPrototypeOf,j=P&&P(P(h([])));j&&j!==b&&g.call(j,y)&&(C=j);var G=i.prototype=a.prototype=Object.create(C);o.prototype=G.constructor=i,i.constructor=o,i[_]=o.displayName="GeneratorFunction",k.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===o||"GeneratorFunction"===(t.displayName||t.name))},k.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_ in e||(e[_]="GeneratorFunction")),e.prototype=Object.create(G),e},k.awrap=function(e){return{__await:e}},l(c.prototype),c.prototype[E]=function(){return this},k.AsyncIterator=c,k.async=function(e,t,r,a){var o=new c(n(e,t,r,a));return k.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},l(G),G[_]="Generator",G[y]=function(){return this},G.toString=function(){return"[object Generator]"},k.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},k.values=h,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&g.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=v)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return o.type="throw",o.arg=e,n.next=t,r&&(n.method="next",n.arg=v),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],o=a.completion;if("root"===a.tryLoc)return t("end");if(a.tryLoc<=this.prev){var i=g.call(a,"catchLoc"),l=g.call(a,"finallyLoc");if(i&&l){if(this.prev<a.catchLoc)return t(a.catchLoc,!0);if(this.prev<a.finallyLoc)return t(a.finallyLoc)}else if(i){if(this.prev<a.catchLoc)return t(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return t(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&g.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,S):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),S},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),S}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;m(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:h(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=v),S}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
1 |
+
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),c=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(c).then(function(e){r("next",e)},function(e){r("throw",e)});e(c)}return r("next")})}}var o,a,i,c,l,s,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),d=(n.n(f),wp.i18n.__),h=wp.blocks.registerBlockType,v=wp.components,g=v.SelectControl,b=(v.TextControl,wp.editor.RichText,!1);h("opinion-stage/block-os-trivia",{title:d("Trivia Quiz"),icon:"yes",category:"opinion-stage",keywords:[d("Opinion Stage Trivia Quiz"),d("Opinion Stage Trivia Quiz Insert")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},oswpUrlShortcode:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=trivia&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,b=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.oswpUrlShortcode,n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<b.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(b[n].attributes["landing-page-url"]),s=r.pathname;if(t==s){o=b[n].attributes.title,a=b[n].attributes["image-url"],i=b[n].attributes["landing-page-url"],c=b[n].attributes["edit-url"],l=b[n].attributes["stats-url"];break}}}}),d=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),L=wp.element.createElement(g,{id:"selectID",options:s,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})};window.verifyOSInsert=function(t){e.setAttributes({oswpUrlShortcode:t});for(var n=document.getElementById("selectID").options,r=0;r<n.length;r++)if(n[r].value==t){n[r].defaultSelected=!0,e.setAttributes({lockEmbed:!0,buttonText:"Change",embedUrl:t});break}};var h=osGutenData.onCreateButtonClickOs+"?w_type=quiz&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",v=function(e){window.open(h,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var w=osGutenData.callbackUrlOs,y=w,E=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),x=function(e){window.location.replace(y)};if(""==osGutenData.isOsConnected)return $(document).ready(function(){$("span#oswpLauncherContentPopuptrivia , #owspLaunchInputCreate").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500)})}),wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-trivia-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("p",{className:"components-heading"},"Please connect Opinion Stage to WordPress to start adding trivia quizzes"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:x},"Connect")));if(0==b)s=[{value:"Select",label:"Select a trivia"},{value:"refresh",label:"Refresh"}],t();else{s=[{value:"Select",label:"Select a trivia"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var k=0;k<b.length;k++){s[s.length]={value:b[k].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:b[k].attributes.title};var _=function(e){var t=document.createElement("a");return t.href=e,t}(b[k].attributes["landing-page-url"]),N=_.pathname;if(u==N){o=b[k].attributes.title,a=b[k].attributes["image-url"],i=b[k].attributes["landing-page-url"],c=b[k].attributes["edit-url"],l=b[k].attributes["stats-url"];var O=b[k].id}}}"refresh"==u&&t();var L=wp.element.createElement(g,{id:"selectID",options:s,value:u,onChange:f,className:"components-select-control__input"});$(document).ready(function(){$("span#oswpLauncherContentPopuptrivia").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var t=$(this).attr("data-os-block");$("button#dropbtn span").text(t);for(var n=$(".filter__itm"),r=0;r<n.length;r++)if($(n[r]).text()==t){setTimeout(function(){$(n[r]).trigger("click")},2e3),$("button.content__links-itm").live("click",function(e){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}})});var T=wp.element.createElement("div",{className:"os-trivia-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("span",{id:"oswpLauncherContentPopuptrivia",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"trivia quiz"},"Select a Trivia Quiz"),wp.element.createElement("input",{type:"button",value:"Create a New Trivia Quiz",className:"components-button is-button is-default is-block is-primary",onClick:v}),wp.element.createElement("div",{className:"components-placeholder__fieldset"},L,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",id:"clickMe",onClick:d})));return function(e,t,n){var r,o=e.getElementsByTagName(t)[0],a=Math.floor((new Date).getTime()/1e6);e.getElementById(n)||(r=e.createElement(t),r.id=n,r.async=1,r.src="https://www.opinionstage.com/assets/loader.js?"+a,o.parentNode.insertBefore(r,o))}(document,"script","os-widget-jssdk"),O="os-widget-"+O,""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(T=wp.element.createElement("div",{className:"os-trivia-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("span",null,wp.element.createElement("img",{src:E,alt:""}))," Opinion Stage"),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,target:"_blank"}," View "),wp.element.createElement("a",{href:c,target:"_blank"}," Edit "),wp.element.createElement("a",{href:l,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:d})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Trivia Quiz: ",o)))),L=wp.element.createElement(g,{id:"selectID",options:s,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},T)},save:function(e){var t=e.attributes,n=(t.embedUrl,t.oswpUrlShortcode),r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-trivia-wrapper","data-type":"trivia","data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),c=new f(r||[]);return i._invoke=s(e,n,c),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function c(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function l(e){function t(n,o,a,i){var c=r(e[n],e,o);if("throw"!==c.type){var l=c.arg,s=l.value;return s&&"object"===typeof s&&b.call(s,"__await")?Promise.resolve(s.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(s).then(function(e){l.value=e,a(l)},i)}i(c.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function s(e,t,n){var o=N;return function(a,i){if(o===L)throw new Error("Generator is already running");if(o===T){if("throw"===a)throw i;return h()}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var l=u(c,n);if(l){if(l===S)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=T,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=L;var s=r(e,t,n);if("normal"===s.type){if(o=n.done?T:O,s.arg===S)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=T,n.method="throw",n.arg=s.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===v){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=v,u(e,t),"throw"===t.method))return S;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return S}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,S;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=v),t.delegate=null,S):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,S)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[y];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(b.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=v,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:v,done:!0}}var v,g=Object.prototype,b=g.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",x=w.toStringTag||"@@toStringTag",k="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(k&&(e.exports=_));_=t.regeneratorRuntime=k?e.exports:{},_.wrap=n;var N="suspendedStart",O="suspendedYield",L="executing",T="completed",S={},C={};C[y]=function(){return this};var P=Object.getPrototypeOf,j=P&&P(P(d([])));j&&j!==g&&b.call(j,y)&&(C=j);var A=i.prototype=o.prototype=Object.create(C);a.prototype=A.constructor=i,i.constructor=a,i[x]=a.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,x in e||(e[x]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},c(l.prototype),l.prototype[E]=function(){return this},_.AsyncIterator=l,_.async=function(e,t,r,o){var a=new l(n(e,t,r,o));return _.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},c(A),A[x]="Generator",A[y]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&b.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=v)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=v),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=b.call(o,"catchLoc"),c=b.call(o,"finallyLoc");if(i&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,S):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),S},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),S}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=v),S}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
gutenberg/trivia/dist/blocks.editor.build.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wp-block-cgb-block-sampleblock{background:#bada55;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}.os-trivia-wrapper .is-large,.os-trivia-wrapper .is-block{height:30px;line-height:25px;padding:0 12px 2px}.os-trivia-wrapper .is-block{
|
1 |
+
.wp-block-cgb-block-sampleblock{background:#bada55;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}.os-trivia-wrapper .is-large,.os-trivia-wrapper .is-block{height:30px;line-height:25px;padding:0 12px 2px;width:100%;max-width:50%;display:block}.os-trivia-wrapper .is-block{margin-top:10px}.components-base-control.components-select-control__input{width:100%;float:left;max-width:80%;margin-right:10px}.os-trivia-wrapper .components-preview__block{width:100%;max-width:100%;padding:10px;background:#fdfdfd;-webkit-box-shadow:0px 1px 2px 0px #3fb2c145;box-shadow:0px 1px 2px 0px #3fb2c145;-webkit-transition:0.2s;-o-transition:0.2s;transition:0.2s}.components-preview__leftBlockImage{width:100%;float:left}.block-editor__container .components-preview__leftBlockImage img{width:100%}.components-preview__rightBlockContent{width:100%;float:left}components-placeholder__fieldset{visibility:hidden;opacity:0}.components-preview__rightBlockContent .components-placeholder__label{font-size:18px;font-weight:bold;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;margin:0px;line-height:20px;margin:0px auto;margin-top:20px;margin-bottom:10px}ul.components-edit-view-stats__Block{list-style-type:none !important;text-align:left;color:#3fb2c1;font-weight:bold;margin-top:10px !important}ul.components-edit-view-stats__Block li{width:100%;max-width:30%;display:inline-block;float:left;margin-top:12px;text-align:center;margin:6px;padding:3px;font-weight:normal;letter-spacing:1px;border-radius:2px}.clear-both-OS__Block{clear:both}ul.components-edit-view-stats__Block li a{color:#fff}ul.components-edit-view-stats__Block li a{color:#fff;text-decoration:none}.components-preview__leftBlockImage{position:relative}.components-preview__leftBlockImage .image{display:block;width:100%;height:auto}.components-preview__leftBlockImage .overlay{position:absolute;top:0;bottom:0;left:0;right:0;height:100%;width:100%;opacity:0;-webkit-transition:.5s ease;-o-transition:.5s ease;transition:.5s ease;background-color:#222120}.components-preview__leftBlockImage:hover .overlay{opacity:0.8}.components-preview__leftBlockImage .text{color:white;font-size:20px;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);transform:translate(-50%, -50%);text-align:center}.components-preview__leftBlockImage .text a{border-radius:5px;border:1px solid #fff;color:#fff;background:transparent;cursor:pointer;display:block;line-height:1;margin:10px auto;padding:10px 8px;text-align:center;text-decoration:none;text-transform:uppercase;width:140px}.components-preview__leftBlockImage .text a:hover,.components-preview__block input.left-align:hover{color:#000 !important;background:#fff !important}.components-preview__block .left-align{color:#fff;text-transform:uppercase;border:1px solid #FFF;-webkit-box-shadow:0px 0px;box-shadow:0px 0px;text-align:center;font-size:19px;border-radius:5px;padding:0px 32px;height:40px;width:100%;max-width:-webkit-fit-content;max-width:-moz-fit-content;max-width:fit-content;background:transparent}.components-preview__block .left-align:hover{background:transparent !important;color:#fff !important;border-color:#fff !important;-webkit-box-shadow:0px 0px !important;box-shadow:0px 0px !important}p.components-heading{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-weight:600;text-align:center}.os-trivia-wrapper.components-placeholder{-webkit-transition:1s;-o-transition:1s;transition:1s}.os-trivia-wrapper .wp-block-opinion-stage-block-os-trivia .components-placeholder__fieldset{visibility:hidden;opacity:0}.os-trivia-wrapper .components-placeholder__fieldset{visibility:hidden;opacity:0;height:0}
|
gutenberg/trivia/src/.DS_Store
CHANGED
Binary file
|
gutenberg/trivia/src/block/block.js
CHANGED
@@ -25,8 +25,13 @@ var options;
|
|
25 |
attributes: {
|
26 |
embedUrl: {
|
27 |
source: 'attribute',
|
28 |
-
attribute: 'data-
|
29 |
-
selector: 'div[data-
|
|
|
|
|
|
|
|
|
|
|
30 |
},
|
31 |
lockEmbed: {
|
32 |
source: 'attribute',
|
@@ -37,10 +42,10 @@ var options;
|
|
37 |
source: 'attribute',
|
38 |
attribute: 'data-button-text',
|
39 |
selector: 'div[data-button-text]'
|
40 |
-
},
|
41 |
},
|
42 |
edit: function( props ) {
|
43 |
-
let {attributes: {embedUrl, lockEmbed, buttonText}, setAttributes} = props;
|
44 |
const onDropdownChange = val => {
|
45 |
if(val == ''){
|
46 |
props.setAttributes({ embedUrl: '' });
|
@@ -59,7 +64,7 @@ var options;
|
|
59 |
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
60 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
61 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
62 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
63 |
break;
|
64 |
}
|
65 |
}
|
@@ -72,16 +77,28 @@ var options;
|
|
72 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
73 |
}else{
|
74 |
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
75 |
-
contentDropdown = (<SelectControl options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
76 |
}
|
77 |
}else{
|
78 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
79 |
}
|
80 |
};
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=quiz&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
83 |
const onCreateButtonClick = value => {
|
84 |
-
// Open Create new trivia
|
85 |
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
86 |
};
|
87 |
|
@@ -93,7 +110,10 @@ var options;
|
|
93 |
var callback_url = getCallBackUrlOs;
|
94 |
var formActionUrlOS = osGutenData.getActionUrlOS;
|
95 |
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
96 |
-
|
|
|
|
|
|
|
97 |
// Populate list ajax function
|
98 |
function OsPolulateList() {
|
99 |
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
@@ -117,7 +137,7 @@ var options;
|
|
117 |
props.setAttributes({ buttonText: buttonText});
|
118 |
if(buttonText == 'Change' && embedUrl !='Select'){
|
119 |
props.setAttributes({ embedUrl: embedUrl });
|
120 |
-
}else{
|
121 |
props.setAttributes({ embedUrl: 'Select' });
|
122 |
}
|
123 |
})
|
@@ -126,29 +146,28 @@ var options;
|
|
126 |
});
|
127 |
}
|
128 |
// Checking for Opinion Stage connection
|
129 |
-
if(osGutenData.isOsConnected == ''){
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
return (
|
131 |
<div className={ props.className }>
|
132 |
<div className="os-trivia-wrapper components-placeholder">
|
133 |
-
|
134 |
-
|
135 |
-
<
|
136 |
-
<input type="hidden" name="utm_campaign" value="WPMainPI"/>
|
137 |
-
<input type="hidden" name="utm_medium" value="link"/>
|
138 |
-
<input type="hidden" name="o" value="wp35e8"/>
|
139 |
-
<input type="hidden" name="callback" id="myvalue" value={callback_url} />
|
140 |
-
<input id="os-email" type="email" name="email" placeholder="Enter Your Email" className="components-placeholder__input" data-os-email-input=""/>
|
141 |
-
<button class="opinionstage-connect-btn opinionstage-blue-btn" type="submit" className="components-button is-button is-default is-block is-primary" id="os-start-login" data-os-login="">CONNECT</button>
|
142 |
-
</form>
|
143 |
</div>
|
144 |
</div>
|
145 |
);
|
146 |
}else{
|
147 |
if(dropdownOptions == false){
|
148 |
-
options = [{value:'Select',label:'Select a
|
149 |
OsPolulateList();
|
150 |
}else{
|
151 |
-
options = [{value:'Select',label:'Select a
|
152 |
for (var i = 0; i < dropdownOptions.length; i++) {
|
153 |
options[options.length] = {
|
154 |
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
@@ -167,26 +186,59 @@ var options;
|
|
167 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
168 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
169 |
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
|
|
|
|
170 |
}
|
171 |
}
|
172 |
}
|
173 |
-
if(embedUrl == 'refresh'){
|
174 |
OsPolulateList();
|
175 |
}
|
176 |
-
var contentDropdown = (<SelectControl options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
var contentViewEditStatOs = (
|
179 |
<div className="os-trivia-wrapper components-placeholder">
|
180 |
-
|
181 |
-
|
|
|
182 |
<div className="components-placeholder__fieldset">
|
183 |
{contentDropdown}
|
184 |
-
<input type="button" value={buttonText} className="components-button is-button is-default is-large" onClick={onEmbedButtonClick} />
|
185 |
-
<input type="button" value="Create New Trivia Quiz" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
186 |
</div>
|
187 |
</div>
|
188 |
);
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
if(embedUrl != '' && embedUrl != 'Select' && embedUrl){
|
192 |
if(buttonText == 'Embed'){
|
@@ -200,9 +252,9 @@ var options;
|
|
200 |
<img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
|
201 |
<div className="overlay">
|
202 |
<div className="text">
|
203 |
-
<a href={previewBlockOsView}
|
204 |
-
<a href={previewBlockOsEdit}
|
205 |
-
<a href={previewBlockOsStatistics}
|
206 |
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onEmbedButtonClick} />
|
207 |
</div>
|
208 |
</div>
|
@@ -213,7 +265,7 @@ var options;
|
|
213 |
</div>
|
214 |
</div>
|
215 |
);
|
216 |
-
contentDropdown = (<SelectControl options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
217 |
}
|
218 |
}else if(embedUrl == 'Select' || embedUrl == '' || embedUrl == 'refresh'){
|
219 |
contentViewEditStatOs
|
@@ -221,17 +273,19 @@ var options;
|
|
221 |
props.setAttributes({ buttonText: 'Embed'});
|
222 |
contentViewEditStatOs
|
223 |
}
|
|
|
|
|
224 |
return (
|
225 |
-
|
226 |
-
{contentViewEditStatOs}
|
227 |
</div>
|
228 |
);
|
229 |
}
|
230 |
},
|
231 |
-
save: function( {attributes: {embedUrl, lockEmbed, buttonText}} ) {
|
232 |
return (
|
233 |
-
<div class="os-trivia-wrapper" data-type="trivia" data-
|
234 |
-
[os-widget path="{
|
235 |
</div>
|
236 |
);
|
237 |
},
|
25 |
attributes: {
|
26 |
embedUrl: {
|
27 |
source: 'attribute',
|
28 |
+
attribute: 'data-test-url',
|
29 |
+
selector: 'div[data-test-url]'
|
30 |
+
},
|
31 |
+
oswpUrlShortcode: {
|
32 |
+
source: 'attribute',
|
33 |
+
attribute: 'data-test-url',
|
34 |
+
selector: 'div[data-test-url]'
|
35 |
},
|
36 |
lockEmbed: {
|
37 |
source: 'attribute',
|
42 |
source: 'attribute',
|
43 |
attribute: 'data-button-text',
|
44 |
selector: 'div[data-button-text]'
|
45 |
+
},
|
46 |
},
|
47 |
edit: function( props ) {
|
48 |
+
let {attributes: {embedUrl, oswpUrlShortcode, lockEmbed, buttonText}, setAttributes} = props;
|
49 |
const onDropdownChange = val => {
|
50 |
if(val == ''){
|
51 |
props.setAttributes({ embedUrl: '' });
|
64 |
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
65 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
66 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
67 |
+
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
68 |
break;
|
69 |
}
|
70 |
}
|
77 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
78 |
}else{
|
79 |
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
80 |
+
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
81 |
}
|
82 |
}else{
|
83 |
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
84 |
}
|
85 |
};
|
86 |
|
87 |
+
window.verifyOSInsert = function(widget){
|
88 |
+
props.setAttributes({ oswpUrlShortcode: widget });
|
89 |
+
var myOpts = document.getElementById('selectID').options;
|
90 |
+
for(var i = 0; i < myOpts.length; i++){
|
91 |
+
if(myOpts[i].value == widget){
|
92 |
+
myOpts[i].defaultSelected = true;
|
93 |
+
props.setAttributes({ lockEmbed: true, buttonText: "Change", embedUrl: widget });
|
94 |
+
break;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=quiz&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
100 |
const onCreateButtonClick = value => {
|
101 |
+
// Open Create new trivia link in new page
|
102 |
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
103 |
};
|
104 |
|
110 |
var callback_url = getCallBackUrlOs;
|
111 |
var formActionUrlOS = osGutenData.getActionUrlOS;
|
112 |
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
113 |
+
const onConnectOSWPButtonClick = value => {
|
114 |
+
// Open Connect to opinionstage
|
115 |
+
window.location.replace(callback_url);
|
116 |
+
};
|
117 |
// Populate list ajax function
|
118 |
function OsPolulateList() {
|
119 |
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
137 |
props.setAttributes({ buttonText: buttonText});
|
138 |
if(buttonText == 'Change' && embedUrl !='Select'){
|
139 |
props.setAttributes({ embedUrl: embedUrl });
|
140 |
+
}else{
|
141 |
props.setAttributes({ embedUrl: 'Select' });
|
142 |
}
|
143 |
})
|
146 |
});
|
147 |
}
|
148 |
// Checking for Opinion Stage connection
|
149 |
+
if(osGutenData.isOsConnected == ''){
|
150 |
+
$(document).ready(function () {
|
151 |
+
$('span#oswpLauncherContentPopuptrivia , #owspLaunchInputCreate').live('click', function(e) {
|
152 |
+
e.preventDefault();
|
153 |
+
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
154 |
+
});
|
155 |
+
});
|
156 |
return (
|
157 |
<div className={ props.className }>
|
158 |
<div className="os-trivia-wrapper components-placeholder">
|
159 |
+
<p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
|
160 |
+
<p className="components-heading">Please connect Opinion Stage to WordPress to start adding trivia quizzes</p>
|
161 |
+
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
</div>
|
163 |
</div>
|
164 |
);
|
165 |
}else{
|
166 |
if(dropdownOptions == false){
|
167 |
+
options = [{value:'Select',label:'Select a trivia'},{value:'refresh',label:'Refresh'}];
|
168 |
OsPolulateList();
|
169 |
}else{
|
170 |
+
options = [{value:'Select',label:'Select a trivia'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
|
171 |
for (var i = 0; i < dropdownOptions.length; i++) {
|
172 |
options[options.length] = {
|
173 |
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
186 |
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
187 |
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
188 |
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
189 |
+
var previewBlockOsWidgetID = dropdownOptions[i].id;
|
190 |
+
|
191 |
}
|
192 |
}
|
193 |
}
|
194 |
+
if(embedUrl == 'refresh'){
|
195 |
OsPolulateList();
|
196 |
}
|
197 |
+
var contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
198 |
+
$(document).ready(function () {
|
199 |
+
$('span#oswpLauncherContentPopuptrivia').live('click', function(e) {
|
200 |
+
e.preventDefault();
|
201 |
+
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
202 |
+
var text = $(this).attr('data-os-block');
|
203 |
+
$("button#dropbtn span").text(text);
|
204 |
+
var inputs = $(".filter__itm");
|
205 |
+
for(var i = 0; i < inputs.length; i++){
|
206 |
+
if($(inputs[i]).text() == text){
|
207 |
+
setTimeout(function(){$(inputs[i]).trigger('click');},2000);
|
208 |
+
$('button.content__links-itm').live('click', function(e) {
|
209 |
+
$('.tingle-modal.opinionstage-content-popup').hide();
|
210 |
+
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
211 |
+
});
|
212 |
+
break;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
});
|
216 |
+
});
|
217 |
+
|
218 |
var contentViewEditStatOs = (
|
219 |
<div className="os-trivia-wrapper components-placeholder">
|
220 |
+
<p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
|
221 |
+
<span id="oswpLauncherContentPopuptrivia" className="components-button is-button is-default is-block is-primary" data-opinionstage-content-launch data-os-block="trivia quiz">Select a Trivia Quiz</span>
|
222 |
+
<input type="button" value="Create a New Trivia Quiz" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
223 |
<div className="components-placeholder__fieldset">
|
224 |
{contentDropdown}
|
225 |
+
<input type="button" value={buttonText} className="components-button is-button is-default is-large" id="clickMe" onClick={onEmbedButtonClick} />
|
|
|
226 |
</div>
|
227 |
</div>
|
228 |
);
|
229 |
+
|
230 |
+
var dataOpinionStageEmbedUrl = 'https://www.opinionstage.com/api/v1/widgets/'+embedUrl+'/code.json?comments=true&sharing=true&recommendations=false&width=';
|
231 |
+
var OpinionStageDataIframe = 'https://www.opinionstage.com/'+embedUrl+'?wid=0&em=1&comments=null&referring_widget='+embedUrl+'&autoswitch=1&of=&os_utm_source=null';
|
232 |
+
(function(d, s, id){
|
233 |
+
var js,
|
234 |
+
fjs = d.getElementsByTagName(s)[0],
|
235 |
+
r = Math.floor(new Date().getTime() / 1000000);
|
236 |
+
if (d.getElementById(id)) {return;}
|
237 |
+
js = d.createElement(s); js.id = id; js.async=1;
|
238 |
+
js.src = "https://www.opinionstage.com/assets/loader.js?" + r;
|
239 |
+
fjs.parentNode.insertBefore(js, fjs);
|
240 |
+
}(document, 'script', 'os-widget-jssdk'));
|
241 |
+
previewBlockOsWidgetID = 'os-widget-'+previewBlockOsWidgetID;
|
242 |
|
243 |
if(embedUrl != '' && embedUrl != 'Select' && embedUrl){
|
244 |
if(buttonText == 'Embed'){
|
252 |
<img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
|
253 |
<div className="overlay">
|
254 |
<div className="text">
|
255 |
+
<a href={previewBlockOsView} target="_blank"> View </a>
|
256 |
+
<a href={previewBlockOsEdit} target="_blank"> Edit </a>
|
257 |
+
<a href={previewBlockOsStatistics} target="_blank"> Statistics </a>
|
258 |
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onEmbedButtonClick} />
|
259 |
</div>
|
260 |
</div>
|
265 |
</div>
|
266 |
</div>
|
267 |
);
|
268 |
+
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
269 |
}
|
270 |
}else if(embedUrl == 'Select' || embedUrl == '' || embedUrl == 'refresh'){
|
271 |
contentViewEditStatOs
|
273 |
props.setAttributes({ buttonText: 'Embed'});
|
274 |
contentViewEditStatOs
|
275 |
}
|
276 |
+
|
277 |
+
|
278 |
return (
|
279 |
+
<div className={ props.className }>
|
280 |
+
{contentViewEditStatOs}
|
281 |
</div>
|
282 |
);
|
283 |
}
|
284 |
},
|
285 |
+
save: function( {attributes: {embedUrl, oswpUrlShortcode, lockEmbed, buttonText}} ) {
|
286 |
return (
|
287 |
+
<div class="os-trivia-wrapper" data-type="trivia" data-test-url={oswpUrlShortcode} data-lock-embed={lockEmbed} data-button-text={buttonText}>
|
288 |
+
[os-widget path="{oswpUrlShortcode}"]
|
289 |
</div>
|
290 |
);
|
291 |
},
|
gutenberg/trivia/src/block/editor.scss
CHANGED
@@ -17,11 +17,12 @@
|
|
17 |
height: 30px;
|
18 |
line-height: 25px;
|
19 |
padding: 0 12px 2px;
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
.os-trivia-wrapper .is-block {
|
23 |
-
display: block;
|
24 |
-
width: 100%;
|
25 |
margin-top: 10px;
|
26 |
}
|
27 |
.components-base-control.components-select-control__input {
|
@@ -49,6 +50,10 @@
|
|
49 |
width: 100%;
|
50 |
float: left;
|
51 |
}
|
|
|
|
|
|
|
|
|
52 |
.components-preview__rightBlockContent .components-placeholder__label {
|
53 |
font-size: 18px;
|
54 |
font-weight: bold;
|
@@ -177,3 +182,12 @@ p.components-heading {
|
|
177 |
.os-trivia-wrapper.components-placeholder {
|
178 |
transition: 1s;
|
179 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
height: 30px;
|
18 |
line-height: 25px;
|
19 |
padding: 0 12px 2px;
|
20 |
+
width: 100%;
|
21 |
+
max-width: 50%;
|
22 |
+
display: block;
|
23 |
}
|
24 |
|
25 |
.os-trivia-wrapper .is-block {
|
|
|
|
|
26 |
margin-top: 10px;
|
27 |
}
|
28 |
.components-base-control.components-select-control__input {
|
50 |
width: 100%;
|
51 |
float: left;
|
52 |
}
|
53 |
+
components-placeholder__fieldset{
|
54 |
+
visibility: hidden;
|
55 |
+
opacity :0;
|
56 |
+
}
|
57 |
.components-preview__rightBlockContent .components-placeholder__label {
|
58 |
font-size: 18px;
|
59 |
font-weight: bold;
|
182 |
.os-trivia-wrapper.components-placeholder {
|
183 |
transition: 1s;
|
184 |
}
|
185 |
+
.os-trivia-wrapper .wp-block-opinion-stage-block-os-trivia .components-placeholder__fieldset {
|
186 |
+
visibility: hidden;
|
187 |
+
opacity: 0;
|
188 |
+
}
|
189 |
+
.os-trivia-wrapper .components-placeholder__fieldset {
|
190 |
+
visibility: hidden;
|
191 |
+
opacity: 0;
|
192 |
+
height: 0;
|
193 |
+
}
|
includes/opinionstage-functions.php
CHANGED
@@ -72,5 +72,22 @@ function opinionstage_add_flyout() {
|
|
72 |
<?php
|
73 |
}
|
74 |
}
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
?>
|
72 |
<?php
|
73 |
}
|
74 |
}
|
75 |
+
function opinionstage_is_guten_enabled(){
|
76 |
+
$block_editor_oswp = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
|
77 |
+
if($block_editor_oswp == false){
|
78 |
+
if( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ){
|
79 |
+
return true;
|
80 |
+
}else{
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
}else{
|
84 |
+
global $current_screen;
|
85 |
+
$current_screen = get_current_screen();
|
86 |
+
if( method_exists($current_screen, 'is_block_editor') && $current_screen->is_block_editor() ){
|
87 |
+
return true;
|
88 |
+
}else{
|
89 |
+
return false;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
?>
|
includes/opinionstage-utility-functions.php
CHANGED
@@ -148,6 +148,12 @@ function opinionstage_create_slideshow_link( $css_class, $title='CREATE NEW' ) {
|
|
148 |
function opinionstage_callback_url() {
|
149 |
return get_admin_url('', '', 'admin') . 'admin.php?page='.OPINIONSTAGE_LOGIN_CALLBACK_SLUG;
|
150 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
/**
|
152 |
* Generates a to the callback page used to connect the plugin to the Opinion Stage account on content page
|
153 |
*/
|
@@ -192,4 +198,10 @@ function opinionstage_parse_client_data($raw_data) {
|
|
192 |
update_option(OPINIONSTAGE_OPTIONS_KEY, $os_options);
|
193 |
}
|
194 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
?>
|
148 |
function opinionstage_callback_url() {
|
149 |
return get_admin_url('', '', 'admin') . 'admin.php?page='.OPINIONSTAGE_LOGIN_CALLBACK_SLUG;
|
150 |
}
|
151 |
+
/**
|
152 |
+
* Generates a to the callback page used to connect the plugin to the Opinion Stage account via gutenberg editor
|
153 |
+
*/
|
154 |
+
function opinionstage_callback_url_gutenberg_connect() {
|
155 |
+
return get_admin_url('', '', 'admin') . 'admin.php?page='.OPINIONSTAGE_GETTING_STARTED_SLUG;
|
156 |
+
}
|
157 |
/**
|
158 |
* Generates a to the callback page used to connect the plugin to the Opinion Stage account on content page
|
159 |
*/
|
198 |
update_option(OPINIONSTAGE_OPTIONS_KEY, $os_options);
|
199 |
}
|
200 |
}
|
201 |
+
function opinionstage_custom_content_popup_callback_url(){
|
202 |
+
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
|
203 |
+
$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
204 |
+
$adminUrlForOs = admin_url( 'admin.php?page=opinionstage-content-login-callback-page&return_path=', $protocol );
|
205 |
+
return $adminUrlForOs.urlencode($url);
|
206 |
+
}
|
207 |
?>
|
opinionstage-polls.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Poll, Survey, Form & Quiz Maker by OpinionStage (Deprecated)
|
4 |
Plugin URI: https://www.opinionstage.com
|
5 |
Description: Add a highly engaging poll, survey, quiz or contact form builder to your site. You can add the poll, survey, quiz or form to any post/page or to the sidebar.
|
6 |
-
Version: 19.6.
|
7 |
Author: OpinionStage.com
|
8 |
Author URI: https://www.opinionstage.com
|
9 |
Text Domain: social-polls-by-opinionstage
|
3 |
Plugin Name: Poll, Survey, Form & Quiz Maker by OpinionStage (Deprecated)
|
4 |
Plugin URI: https://www.opinionstage.com
|
5 |
Description: Add a highly engaging poll, survey, quiz or contact form builder to your site. You can add the poll, survey, quiz or form to any post/page or to the sidebar.
|
6 |
+
Version: 19.6.15
|
7 |
Author: OpinionStage.com
|
8 |
Author URI: https://www.opinionstage.com
|
9 |
Text Domain: social-polls-by-opinionstage
|
plugin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Poll, Survey, Form & Quiz Maker by OpinionStage
|
4 |
Plugin URI: https://www.opinionstage.com
|
5 |
Description: Add a highly engaging poll, survey, quiz or contact form builder to your site. You can add the poll, survey, quiz or form to any post/page or to the sidebar.
|
6 |
-
Version: 19.6.
|
7 |
Author: OpinionStage.com
|
8 |
Author URI: https://www.opinionstage.com
|
9 |
Text Domain: social-polls-by-opinionstage
|
@@ -24,7 +24,7 @@ if ( defined('WP_DEBUG') && true === WP_DEBUG ) {
|
|
24 |
}
|
25 |
}
|
26 |
|
27 |
-
define('OPINIONSTAGE_WIDGET_VERSION', '19.6.
|
28 |
|
29 |
define('OPINIONSTAGE_TEXT_DOMAIN', 'social-polls-by-opinionstage');
|
30 |
|
3 |
Plugin Name: Poll, Survey, Form & Quiz Maker by OpinionStage
|
4 |
Plugin URI: https://www.opinionstage.com
|
5 |
Description: Add a highly engaging poll, survey, quiz or contact form builder to your site. You can add the poll, survey, quiz or form to any post/page or to the sidebar.
|
6 |
+
Version: 19.6.15
|
7 |
Author: OpinionStage.com
|
8 |
Author URI: https://www.opinionstage.com
|
9 |
Text Domain: social-polls-by-opinionstage
|
24 |
}
|
25 |
}
|
26 |
|
27 |
+
define('OPINIONSTAGE_WIDGET_VERSION', '19.6.15');
|
28 |
|
29 |
define('OPINIONSTAGE_TEXT_DOMAIN', 'social-polls-by-opinionstage');
|
30 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.opinionstage.com
|
|
4 |
Tags: poll, quiz, survey, form, interactive content
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 5.0
|
7 |
-
Stable tag: 19.6.
|
8 |
|
9 |
Add a beautiful & top performing Poll, Survey, Quiz or Form to your site. Create from scratch or use templates. Set it up in Minutes.
|
10 |
|
@@ -162,6 +162,8 @@ Polls include one question and are used for getting a quick answer on a question
|
|
162 |
N/A
|
163 |
|
164 |
== Changelog ==
|
|
|
|
|
165 |
= 19.6.14 =
|
166 |
* Gutenberg fix
|
167 |
= 19.6.13 =
|
4 |
Tags: poll, quiz, survey, form, interactive content
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 5.0
|
7 |
+
Stable tag: 19.6.15
|
8 |
|
9 |
Add a beautiful & top performing Poll, Survey, Quiz or Form to your site. Create from scratch or use templates. Set it up in Minutes.
|
10 |
|
162 |
N/A
|
163 |
|
164 |
== Changelog ==
|
165 |
+
= 19.6.15 =
|
166 |
+
* Gutenberg fixes and improvements
|
167 |
= 19.6.14 =
|
168 |
* Gutenberg fix
|
169 |
= 19.6.13 =
|