Poll, Survey, Quiz, Slideshow, Form, Story & Landing Page - Version 19.6.9

Version Description

  • add support for new editor Gutenberg
Download this release

Release Info

Developer kucaahbe
Plugin Icon 128x128 Poll, Survey, Quiz, Slideshow, Form, Story & Landing Page
Version 19.6.9
Comparing to
See all releases

Code changes from version 19.6.8 to 19.6.9

Files changed (69) hide show
  1. gutenberg/.editorconfig +21 -0
  2. gutenberg/.eslintignore +9 -0
  3. gutenberg/.eslintrc.json +192 -0
  4. gutenberg/.gitignore +85 -0
  5. gutenberg/form/dist/blocks.build.js +1 -0
  6. gutenberg/form/dist/blocks.editor.build.css +1 -0
  7. gutenberg/form/dist/blocks.style.build.css +1 -0
  8. gutenberg/form/src/.DS_Store +0 -0
  9. gutenberg/form/src/block/block.js +238 -0
  10. gutenberg/form/src/block/editor.scss +179 -0
  11. gutenberg/form/src/block/style.scss +14 -0
  12. gutenberg/form/src/blocks.js +12 -0
  13. gutenberg/form/src/common.scss +13 -0
  14. gutenberg/form/src/init.php +44 -0
  15. gutenberg/image/gutenberg-os.png +0 -0
  16. gutenberg/init.php +81 -0
  17. gutenberg/personality/dist/blocks.build.js +1 -0
  18. gutenberg/personality/dist/blocks.editor.build.css +1 -0
  19. gutenberg/personality/dist/blocks.style.build.css +1 -0
  20. gutenberg/personality/src/.DS_Store +0 -0
  21. gutenberg/personality/src/block/block.js +238 -0
  22. gutenberg/personality/src/block/editor.scss +179 -0
  23. gutenberg/personality/src/block/style.scss +14 -0
  24. gutenberg/personality/src/blocks.js +12 -0
  25. gutenberg/personality/src/common.scss +13 -0
  26. gutenberg/personality/src/init.php +43 -0
  27. gutenberg/poll/dist/blocks.build.js +1 -0
  28. gutenberg/poll/dist/blocks.editor.build.css +1 -0
  29. gutenberg/poll/dist/blocks.style.build.css +1 -0
  30. gutenberg/poll/src/.DS_Store +0 -0
  31. gutenberg/poll/src/block/block.js +238 -0
  32. gutenberg/poll/src/block/editor.scss +179 -0
  33. gutenberg/poll/src/block/style.scss +14 -0
  34. gutenberg/poll/src/blocks.js +1 -0
  35. gutenberg/poll/src/common.scss +13 -0
  36. gutenberg/poll/src/init.php +62 -0
  37. gutenberg/slideshow/dist/blocks.build.js +1 -0
  38. gutenberg/slideshow/dist/blocks.editor.build.css +1 -0
  39. gutenberg/slideshow/dist/blocks.style.build.css +1 -0
  40. gutenberg/slideshow/src/.DS_Store +0 -0
  41. gutenberg/slideshow/src/block/block.js +238 -0
  42. gutenberg/slideshow/src/block/editor.scss +179 -0
  43. gutenberg/slideshow/src/block/style.scss +14 -0
  44. gutenberg/slideshow/src/blocks.js +12 -0
  45. gutenberg/slideshow/src/common.scss +13 -0
  46. gutenberg/slideshow/src/init.php +43 -0
  47. gutenberg/survey/dist/blocks.build.js +1 -0
  48. gutenberg/survey/dist/blocks.editor.build.css +1 -0
  49. gutenberg/survey/dist/blocks.style.build.css +1 -0
  50. gutenberg/survey/src/.DS_Store +0 -0
  51. gutenberg/survey/src/block/block.js +238 -0
  52. gutenberg/survey/src/block/editor.scss +179 -0
  53. gutenberg/survey/src/block/style.scss +14 -0
  54. gutenberg/survey/src/blocks.js +12 -0
  55. gutenberg/survey/src/common.scss +13 -0
  56. gutenberg/survey/src/init.php +44 -0
  57. gutenberg/trivia/dist/blocks.build.js +1 -0
  58. gutenberg/trivia/dist/blocks.editor.build.css +1 -0
  59. gutenberg/trivia/dist/blocks.style.build.css +1 -0
  60. gutenberg/trivia/src/.DS_Store +0 -0
  61. gutenberg/trivia/src/block/block.js +238 -0
  62. gutenberg/trivia/src/block/editor.scss +179 -0
  63. gutenberg/trivia/src/block/style.scss +14 -0
  64. gutenberg/trivia/src/blocks.js +12 -0
  65. gutenberg/trivia/src/common.scss +13 -0
  66. gutenberg/trivia/src/init.php +43 -0
  67. opinionstage-polls.php +1 -1
  68. plugin.php +6 -3
  69. readme.txt +3 -1
gutenberg/.editorconfig ADDED
@@ -0,0 +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
gutenberg/.eslintignore ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +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
+ }
gutenberg/.gitignore ADDED
@@ -0,0 +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
gutenberg/form/dist/blocks.build.js ADDED
@@ -0,0 +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&amp;utm_source=wordpress&amp;utm_campaign=WPMainPI&amp;utm_medium=link&amp;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){}]);
gutenberg/form/dist/blocks.editor.build.css ADDED
@@ -0,0 +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{display:block;width:100%;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-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}
gutenberg/form/dist/blocks.style.build.css ADDED
@@ -0,0 +1 @@
 
1
+ .wp-block-cgb-block-bootstrap-alert{background:#ff4500;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}
gutenberg/form/src/.DS_Store ADDED
Binary file
gutenberg/form/src/block/block.js ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import './style.scss';
2
+ import './editor.scss';
3
+
4
+ const { __ } = wp.i18n;
5
+ const { registerBlockType } = wp.blocks;
6
+ const { SelectControl, TextControl } = wp.components;
7
+ const { RichText } = wp.editor ;
8
+
9
+ var dropdownOptions = false;
10
+ var previewBlockOsTitle;
11
+ var previewBlockOsImageUrl;
12
+ var previewBlockOsView;
13
+ var previewBlockOsEdit;
14
+ var previewBlockOsStatistics;
15
+ var options;
16
+
17
+ registerBlockType( 'opinion-stage/block-os-form', {
18
+ title: __( 'Form' ),
19
+ icon: 'editor-justify',
20
+ category: 'opinion-stage',
21
+ keywords: [
22
+ __( 'Opinion Stage Form' ),
23
+ __( 'Opinion Stage Form Insert' ),
24
+ ],
25
+ attributes: {
26
+ embedUrl: {
27
+ source: 'attribute',
28
+ attribute: 'data-embed-url',
29
+ selector: 'div[data-embed-url]'
30
+ },
31
+ lockEmbed: {
32
+ source: 'attribute',
33
+ attribute: 'data-lock-embed',
34
+ selector: 'div[data-lock-embed]'
35
+ },
36
+ buttonText: {
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: '' });
47
+ }else if(val != ''){
48
+ props.setAttributes({ embedUrl: val });
49
+ for (var i = 0; i < dropdownOptions.length; i++) {
50
+ var getLandingPageUrlOs = function(href) {
51
+ var locationUrlOS = document.createElement("a");
52
+ locationUrlOS.href = href;
53
+ return locationUrlOS;
54
+ };
55
+ var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
56
+ var matchValue = locationUrlOS.pathname;
57
+ if(val == matchValue){
58
+ previewBlockOsTitle = dropdownOptions[i].attributes['title'];
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
+ }
66
+ }else{
67
+ }
68
+ };
69
+ const onEmbedButtonClick = event => {
70
+ if( event.target.value == "Embed" ){
71
+ if(embedUrl == '' || embedUrl == 'Select' || embedUrl == 'createNew' || embedUrl == 'refresh'){
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=contact_form&amp;utm_source=wordpress&amp;utm_campaign=WPMainPI&amp;utm_medium=link&amp;o=wp35e8';
83
+ const onCreateButtonClick = value => {
84
+ // Open Create new form link in new page
85
+ window.open(getOsCreateButtonClickUrl, '_blank').focus();
86
+ };
87
+
88
+ if(!buttonText){
89
+ props.setAttributes({ buttonText: 'Embed' });
90
+ }
91
+
92
+ var getCallBackUrlOs = osGutenData.callbackUrlOs;
93
+ var callback_url = getCallBackUrlOs;
94
+ var formActionUrlOS = osGutenData.getActionUrlOS;
95
+ var getlogoImageLinkOs = osGutenData.getLogoImageLink;
96
+
97
+ // Populate form ajax function
98
+ function OsPolulateform() {
99
+ var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
100
+ var opinionStageClientToken = osGutenData.OswpClientToken;
101
+ var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=form&page=1&per_page=99';
102
+ fetch(opinionstageFetchDataUrl, {
103
+ method: "GET",
104
+ headers: {
105
+ 'Accept':'application/vnd.api+json',
106
+ 'Content-Type':'application/vnd.api+json',
107
+ 'OSWP-Plugin-Version':opinionStageWidgetVersion,
108
+ 'OSWP-Client-Token': opinionStageClientToken
109
+ },
110
+ })
111
+ .then(async res => {
112
+ var data = await res.json();
113
+ data = data.data;
114
+ dropdownOptions = data;
115
+ // force reprinting instead!!
116
+ props.setAttributes({ buttonText: 'Embed'});
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
+ })
124
+ .catch(function(err) {
125
+ console.log('ERROR: ' + err.message);
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
+ <div className="components-placeholder__label">Connect WordPress with Opinion Stage to get started</div>
134
+ <form method="get" action={formActionUrlOS} className="components-placeholder__fieldset">
135
+ <input type="hidden" name="utm_source" value="wordpress"/>
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 Form'},{value:'refresh',label:'Refresh'}];
149
+ OsPolulateform();
150
+ }else{
151
+ options = [{value:'Select',label:'Select a Form'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
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',''),
155
+ label: dropdownOptions[i].attributes['title'],
156
+ };
157
+ var getLandingPageUrlOs = function(href) {
158
+ var locationUrlOS = document.createElement("a");
159
+ locationUrlOS.href = href;
160
+ return locationUrlOS;
161
+ };
162
+ var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
163
+ var matchValue = locationUrlOS.pathname;
164
+ if(embedUrl == matchValue){
165
+ previewBlockOsTitle = dropdownOptions[i].attributes['title'];
166
+ previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
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
+ OsPolulateform();
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
+ <p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
181
+ <div className="components-placeholder__label">Select an existing form or create a new one</div>
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'){
193
+ contentViewEditStatOs
194
+ }else if(buttonText == 'Change'){
195
+ contentViewEditStatOs = (
196
+ <div className="os-form-wrapper components-placeholder">
197
+ <p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
198
+ <div className="components-preview__block" >
199
+ <div className="components-preview__leftBlockImage">
200
+ <img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
201
+ <div className="overlay">
202
+ <div className="text">
203
+ <a href={previewBlockOsView} classname="components-button is-button is-default is-large" target="_blank"> View </a>
204
+ <a href={previewBlockOsEdit} classname="components-button is-button is-default is-large" target="_blank"> Edit </a>
205
+ <a href={previewBlockOsStatistics} classname="components-button is-button is-default is-large" target="_blank"> Statistics </a>
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">Form: {previewBlockOsTitle}</div>
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
220
+ }else{
221
+ props.setAttributes({ buttonText: 'Embed'});
222
+ contentViewEditStatOs
223
+ }
224
+ return (
225
+ <div className={ props.className }>
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-embed-url={embedUrl} data-lock-embed={lockEmbed} data-button-text={buttonText}>
234
+ [os-widget path="{embedUrl}"]
235
+ </div>
236
+ );
237
+ },
238
+ } );
gutenberg/form/src/block/editor.scss ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Editor Styles
3
+ *
4
+ * CSS for just Backend enqueued after style.scss
5
+ * which makes it higher in priority.
6
+ */
7
+
8
+ .wp-block-cgb-block-sampleblock {
9
+ background: $green;
10
+ border: 0.2rem solid $black;
11
+ color: $black;
12
+ margin: 0 auto;
13
+ max-width: 740px;
14
+ padding: 2rem;
15
+ }
16
+ .os-form-wrapper .is-large, .os-form-wrapper .is-block {
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 {
28
+ width: 100%;
29
+ float: left;
30
+ max-width: 80%;
31
+ margin-right: 10px;
32
+ }
33
+ .os-form-wrapper .components-preview__block {
34
+ width: 100%;
35
+ max-width: 100%;
36
+ padding: 10px;
37
+ background: #fdfdfd;
38
+ box-shadow: 0px 1px 2px 0px #3fb2c145;
39
+ transition: 0.2s;
40
+ }
41
+ .components-preview__leftBlockImage {
42
+ width: 100%;
43
+ float: left;
44
+ }
45
+ .block-editor__container .components-preview__leftBlockImage img {
46
+ width: 100%;
47
+ }
48
+ .components-preview__rightBlockContent {
49
+ width: 100%;
50
+ float: left;
51
+ }
52
+ .components-preview__rightBlockContent .components-placeholder__label {
53
+ font-size: 18px;
54
+ font-weight: bold;
55
+ width: -webkit-fit-content;
56
+ width: -moz-fit-content;
57
+ width: fit-content;
58
+ margin: 0px;
59
+ line-height: 20px;
60
+ margin: 0px auto;
61
+ margin-top: 20px;
62
+ margin-bottom: 10px;
63
+ }
64
+ ul.components-edit-view-stats__Block {
65
+ list-style-type: none !important;
66
+ text-align: left;
67
+ color: #3fb2c1;
68
+ font-weight: bold;
69
+ margin-top: 10px !important;
70
+ }
71
+ ul.components-edit-view-stats__Block li{
72
+ width: 100%;
73
+ max-width: 30%;
74
+ display: inline-block;
75
+ float: left;
76
+ margin-top: 12px;
77
+ text-align: center;
78
+ margin: 6px;
79
+ padding: 3px;
80
+ font-weight: normal;
81
+ letter-spacing: 1px;
82
+ border-radius: 2px;
83
+ }
84
+ .clear-both-OS__Block{
85
+ clear:both;
86
+ }
87
+ ul.components-edit-view-stats__Block li a {
88
+ color: #fff;
89
+ }
90
+ ul.components-edit-view-stats__Block li a {
91
+ color: #fff;
92
+ text-decoration:none;
93
+ }
94
+
95
+ .components-preview__leftBlockImage {
96
+ position: relative;
97
+ }
98
+
99
+ .components-preview__leftBlockImage .image {
100
+ display: block;
101
+ width: 100%;
102
+ height: auto;
103
+ }
104
+
105
+ .components-preview__leftBlockImage .overlay {
106
+ position: absolute;
107
+ top: 0;
108
+ bottom: 0;
109
+ left: 0;
110
+ right: 0;
111
+ height: 100%;
112
+ width: 100%;
113
+ opacity: 0;
114
+ transition: .5s ease;
115
+ background-color: #222120;
116
+ }
117
+
118
+ .components-preview__leftBlockImage:hover .overlay {
119
+ opacity: 0.8;
120
+ }
121
+
122
+ .components-preview__leftBlockImage .text {
123
+ color: white;
124
+ font-size: 20px;
125
+ position: absolute;
126
+ top: 50%;
127
+ left: 50%;
128
+ -webkit-transform: translate(-50%, -50%);
129
+ -ms-transform: translate(-50%, -50%);
130
+ transform: translate(-50%, -50%);
131
+ text-align: center;
132
+ }
133
+ .components-preview__leftBlockImage .text a{
134
+ border-radius: 5px;
135
+ border: 1px solid #fff;
136
+ color: #fff;
137
+ background: transparent;
138
+ cursor: pointer;
139
+ display: block;
140
+ line-height: 1;
141
+ margin: 10px auto;
142
+ padding: 10px 8px;
143
+ text-align: center;
144
+ text-decoration: none;
145
+ text-transform: uppercase;
146
+ width: 140px;
147
+ }
148
+ .components-preview__leftBlockImage .text a:hover, .components-preview__block input.left-align:hover {
149
+ color: #000 !important;
150
+ background: #fff !important;
151
+ }
152
+ .components-preview__block .left-align {
153
+ color: #fff;
154
+ text-transform: uppercase;
155
+ border: 1px solid #FFF;
156
+ box-shadow: 0px 0px;
157
+ text-align: center;
158
+ font-size: 19px;
159
+ border-radius: 5px;
160
+ padding: 0px 32px;
161
+ height: 40px;
162
+ width: 100%;
163
+ max-width: fit-content;
164
+ background: transparent;
165
+ }
166
+ .components-preview__block .left-align:hover{
167
+ background: transparent !important;
168
+ color: #fff !important;
169
+ border-color: #fff !important;
170
+ box-shadow: 0px 0px !important;
171
+ }
172
+ p.components-heading {
173
+ font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
174
+ font-weight: 600;
175
+ text-align: center;
176
+ }
177
+ .os-form-wrapper.components-placeholder {
178
+ transition: 1s;
179
+ }
gutenberg/form/src/block/style.scss ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Styles
3
+ *
4
+ * CSS for both Frontend+Backend.
5
+ */
6
+
7
+ .wp-block-cgb-block-bootstrap-alert {
8
+ background: $red;
9
+ border: 0.2rem solid $black;
10
+ color: $black;
11
+ margin: 0 auto;
12
+ max-width: 740px;
13
+ padding: 2rem;
14
+ }
gutenberg/form/src/blocks.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Gutenberg Blocks
3
+ *
4
+ * All blocks related JavaScript files should be imported here.
5
+ * You can create a new block folder in this dir and include code
6
+ * for that block here as well.
7
+ *
8
+ * All blocks should be included here since this is the file that
9
+ * Webpack is compiling as the input file.
10
+ */
11
+
12
+ import './block/block.js';
gutenberg/form/src/common.scss ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Common SCSS
3
+ *
4
+ * Can include things like variables and mixins
5
+ * that are used across the project.
6
+ */
7
+
8
+ // Colors.
9
+ $black: rgb(41, 41, 41);
10
+ $white: #f4f4f4;
11
+ $gray: #dedede;
12
+ $green: #bada55;
13
+ $red: orangered;
gutenberg/form/src/init.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Blocks Initializer
4
+ *
5
+ * Enqueue CSS/JS of all the blocks.
6
+ *
7
+ * @since 1.0.0
8
+ * @package OSWP
9
+ */
10
+
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ function opinionStage_form_oswp_block_assets_set() {
16
+ wp_enqueue_style('Bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css');
17
+ wp_enqueue_style(
18
+ 'opinionStage_form_oswp_style_css_set',
19
+ plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ),
20
+ array( 'wp-blocks' )
21
+ );
22
+ }
23
+ add_action( 'enqueue_block_assets', 'opinionStage_form_oswp_block_assets_set' );
24
+
25
+ function opinionStage_form_oswp_editor_assets_set() {
26
+ // Scripts.
27
+ wp_enqueue_script(
28
+ 'opinionStage_form_oswp_block_js_set', // Handle.
29
+ plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ),
30
+ array( 'wp-blocks', 'wp-i18n', 'wp-element','wp-components','wp-editor' ),
31
+ true
32
+ );
33
+
34
+
35
+ // Styles.
36
+ wp_enqueue_style('Bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css');
37
+ wp_enqueue_style(
38
+ 'opinionStage_form_oswp_block_editor_css_set', // Handle.
39
+ plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
40
+ array( 'wp-edit-blocks' )
41
+ );
42
+ }
43
+ add_action( 'enqueue_block_editor_assets', 'opinionStage_form_oswp_editor_assets_set' );
44
+ ?>
gutenberg/image/gutenberg-os.png ADDED
Binary file
gutenberg/init.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly.
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+ // Adding a block opinion-stage for below elements
7
+ add_filter( 'block_categories', function( $categories, $post ) {
8
+ return array_merge(
9
+ $categories,
10
+ array(
11
+ array(
12
+ 'slug' => 'opinion-stage',
13
+ 'title' => __( 'Interactive Content by OpinionStage', 'opinion-stage' ),
14
+ ),
15
+ )
16
+ );
17
+ }, 10, 2 );
18
+
19
+
20
+ /**
21
+ * BLOCK: Poll.
22
+ */
23
+ require( plugin_dir_path( __FILE__ ).'poll/src/init.php' );
24
+ /**
25
+ * BLOCK: Trivia.
26
+ */
27
+ require( plugin_dir_path( __FILE__ ).'trivia/src/init.php' );
28
+ /**
29
+ * BLOCK: Personality.
30
+ */
31
+ require( plugin_dir_path( __FILE__ ).'personality/src/init.php' );
32
+ /**
33
+ * BLOCK: Survey.
34
+ */
35
+ require( plugin_dir_path( __FILE__ ).'survey/src/init.php' );
36
+ /**
37
+ * BLOCK: Slideshow.
38
+ */
39
+ require( plugin_dir_path( __FILE__ ).'slideshow/src/init.php' );
40
+ /**
41
+ * BLOCK: Form.
42
+ */
43
+ require( plugin_dir_path( __FILE__ ).'form/src/init.php' );
44
+
45
+
46
+ function oswp_gutenberg_enqueue_scripts() {
47
+ // Fetching options for opinionstage connection
48
+ $os_options =(array) get_option(OPINIONSTAGE_OPTIONS_KEY);
49
+ $protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
50
+ $url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
51
+
52
+ // get admin url for opinionstage plugin
53
+ $adminUrlForOs = admin_url( 'admin.php?page=opinionstage-content-login-callback-page&return_path=', $protocol );
54
+
55
+ // opinionstage plugin version
56
+ $OswpPluginVersion = OPINIONSTAGE_WIDGET_VERSION;
57
+
58
+ // Fetch Url For Ajax Call Opinion Stage
59
+ $FetchUrlOS = 'https://www.opinionstage.com/api/wp/v1/my/widgets';
60
+
61
+ // Url For Creating New Content OR Template On Opinion Stage
62
+ $getUrlFormAction = 'https://www.opinionstage.com/integrations/wordpress/new';
63
+
64
+ // Opninionstge logo image link
65
+ $logoImagelinkOs = plugin_dir_url( __FILE__ ) . 'image/gutenberg-os.png';
66
+
67
+ // Data to pass to gutenberg editor
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.urlencode($url),
72
+ 'OswpPluginVersion' => $OswpPluginVersion,
73
+ 'OswpClientToken' => opinionstage_user_access_token(),
74
+ 'OswpFetchDataUrl' => $FetchUrlOS,
75
+ 'getActionUrlOS' => $getUrlFormAction,
76
+ 'getLogoImageLink' => $logoImagelinkOs,
77
+ );
78
+ wp_localize_script( 'opinionStage_poll_oswp_block_js_set', 'osGutenData', $dataToPass );
79
+ }
80
+ add_action( 'enqueue_block_editor_assets', 'oswp_gutenberg_enqueue_scripts' );
81
+ ?>
gutenberg/personality/dist/blocks.build.js ADDED
@@ -0,0 +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&amp;utm_source=wordpress&amp;utm_campaign=WPMainPI&amp;utm_medium=link&amp;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){}]);
gutenberg/personality/dist/blocks.editor.build.css ADDED
@@ -0,0 +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{display:block;width:100%;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-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}
gutenberg/personality/dist/blocks.style.build.css ADDED
@@ -0,0 +1 @@
 
1
+ .wp-block-cgb-block-bootstrap-alert{background:#ff4500;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}
gutenberg/personality/src/.DS_Store ADDED
Binary file
gutenberg/personality/src/block/block.js ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import './style.scss';
2
+ import './editor.scss';
3
+
4
+ const { __ } = wp.i18n;
5
+ const { registerBlockType } = wp.blocks;
6
+ const { SelectControl, TextControl } = wp.components;
7
+ const { RichText } = wp.editor ;
8
+
9
+ var dropdownOptions = false;
10
+ var previewBlockOsTitle;
11
+ var previewBlockOsImageUrl;
12
+ var previewBlockOsView;
13
+ var previewBlockOsEdit;
14
+ var previewBlockOsStatistics;
15
+ var options;
16
+
17
+ registerBlockType( 'opinion-stage/block-os-personality', {
18
+ title: __( 'Personality Quiz' ),
19
+ icon: 'smiley',
20
+ category: 'opinion-stage',
21
+ keywords: [
22
+ __( 'Opinion Stage Personality Quiz' ),
23
+ __( 'Opinion Stage Personality Quiz Insert' ),
24
+ ],
25
+ attributes: {
26
+ embedUrl: {
27
+ source: 'attribute',
28
+ attribute: 'data-embed-url',
29
+ selector: 'div[data-embed-url]'
30
+ },
31
+ lockEmbed: {
32
+ source: 'attribute',
33
+ attribute: 'data-lock-embed',
34
+ selector: 'div[data-lock-embed]'
35
+ },
36
+ buttonText: {
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: '' });
47
+ }else if(val != ''){
48
+ props.setAttributes({ embedUrl: val });
49
+ for (var i = 0; i < dropdownOptions.length; i++) {
50
+ var getLandingPageUrlOs = function(href) {
51
+ var locationUrlOS = document.createElement("a");
52
+ locationUrlOS.href = href;
53
+ return locationUrlOS;
54
+ };
55
+ var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
56
+ var matchValue = locationUrlOS.pathname;
57
+ if(val == matchValue){
58
+ previewBlockOsTitle = dropdownOptions[i].attributes['title'];
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
+ }
66
+ }else{
67
+ }
68
+ };
69
+ const onEmbedButtonClick = event => {
70
+ if( event.target.value == "Embed" ){
71
+ if(embedUrl == '' || embedUrl == 'Select' || embedUrl == 'createNew' || embedUrl == 'refresh'){
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&amp;utm_source=wordpress&amp;utm_campaign=WPMainPI&amp;utm_medium=link&amp;o=wp35e8';
83
+ const onCreateButtonClick = value => {
84
+ // Open Create new personality quiz link in new page
85
+ window.open(getOsCreateButtonClickUrl, '_blank').focus();
86
+ };
87
+
88
+ if(!buttonText){
89
+ props.setAttributes({ buttonText: 'Embed' });
90
+ }
91
+
92
+ var getCallBackUrlOs = osGutenData.callbackUrlOs;
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;
100
+ var opinionStageClientToken = osGutenData.OswpClientToken;
101
+ var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=outcome&page=1&per_page=99';
102
+ fetch(opinionstageFetchDataUrl, {
103
+ method: "GET",
104
+ headers: {
105
+ 'Accept':'application/vnd.api+json',
106
+ 'Content-Type':'application/vnd.api+json',
107
+ 'OSWP-Plugin-Version':opinionStageWidgetVersion,
108
+ 'OSWP-Client-Token': opinionStageClientToken
109
+ },
110
+ })
111
+ .then(async res => {
112
+ var data = await res.json();
113
+ data = data.data;
114
+ dropdownOptions = data;
115
+ // force reprinting instead!!
116
+ props.setAttributes({ buttonText: 'Embed'});
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
+ })
124
+ .catch(function(err) {
125
+ console.log('ERROR: ' + err.message);
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
+ <div className="components-placeholder__label">Connect WordPress with Opinion Stage to get started</div>
134
+ <form method="get" action={formActionUrlOS} className="components-placeholder__fieldset">
135
+ <input type="hidden" name="utm_source" value="wordpress"/>
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 Personality Quiz'},{value:'refresh',label:'Refresh'}];
149
+ OsPolulateList();
150
+ }else{
151
+ options = [{value:'Select',label:'Select a Personality Quiz'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
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',''),
155
+ label: dropdownOptions[i].attributes['title'],
156
+ };
157
+ var getLandingPageUrlOs = function(href) {
158
+ var locationUrlOS = document.createElement("a");
159
+ locationUrlOS.href = href;
160
+ return locationUrlOS;
161
+ };
162
+ var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
163
+ var matchValue = locationUrlOS.pathname;
164
+ if(embedUrl == matchValue){
165
+ previewBlockOsTitle = dropdownOptions[i].attributes['title'];
166
+ previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
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
+ <p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
181
+ <div className="components-placeholder__label">Select an existing personality quiz or create a new one</div>
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'){
193
+ contentViewEditStatOs
194
+ }else if(buttonText == 'Change'){
195
+ contentViewEditStatOs = (
196
+ <div className="os-personality-wrapper components-placeholder">
197
+ <p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
198
+ <div className="components-preview__block" >
199
+ <div className="components-preview__leftBlockImage">
200
+ <img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
201
+ <div className="overlay">
202
+ <div className="text">
203
+ <a href={previewBlockOsView} classname="components-button is-button is-default is-large" target="_blank"> View </a>
204
+ <a href={previewBlockOsEdit} classname="components-button is-button is-default is-large" target="_blank"> Edit </a>
205
+ <a href={previewBlockOsStatistics} classname="components-button is-button is-default is-large" target="_blank"> Statistics </a>
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 Quiz: {previewBlockOsTitle}</div>
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
220
+ }else{
221
+ props.setAttributes({ buttonText: 'Embed'});
222
+ contentViewEditStatOs
223
+ }
224
+ return (
225
+ <div className={ props.className }>
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-embed-url={embedUrl} data-lock-embed={lockEmbed} data-button-text={buttonText}>
234
+ [os-widget path="{embedUrl}"]
235
+ </div>
236
+ );
237
+ },
238
+ } );
gutenberg/personality/src/block/editor.scss ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Editor Styles
3
+ *
4
+ * CSS for just Backend enqueued after style.scss
5
+ * which makes it higher in priority.
6
+ */
7
+
8
+ .wp-block-cgb-block-sampleblock {
9
+ background: $green;
10
+ border: 0.2rem solid $black;
11
+ color: $black;
12
+ margin: 0 auto;
13
+ max-width: 740px;
14
+ padding: 2rem;
15
+ }
16
+ .os-personality-wrapper .is-large, .os-personality-wrapper .is-block {
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 {
28
+ width: 100%;
29
+ float: left;
30
+ max-width: 80%;
31
+ margin-right: 10px;
32
+ }
33
+ .os-personality-wrapper .components-preview__block {
34
+ width: 100%;
35
+ max-width: 100%;
36
+ padding: 10px;
37
+ background: #fdfdfd;
38
+ box-shadow: 0px 1px 2px 0px #3fb2c145;
39
+ transition: 0.2s;
40
+ }
41
+ .components-preview__leftBlockImage {
42
+ width: 100%;
43
+ float: left;
44
+ }
45
+ .block-editor__container .components-preview__leftBlockImage img {
46
+ width: 100%;
47
+ }
48
+ .components-preview__rightBlockContent {
49
+ width: 100%;
50
+ float: left;
51
+ }
52
+ .components-preview__rightBlockContent .components-placeholder__label {
53
+ font-size: 18px;
54
+ font-weight: bold;
55
+ width: -webkit-fit-content;
56
+ width: -moz-fit-content;
57
+ width: fit-content;
58
+ margin: 0px;
59
+ line-height: 20px;
60
+ margin: 0px auto;
61
+ margin-top: 20px;
62
+ margin-bottom: 10px;
63
+ }
64
+ ul.components-edit-view-stats__Block {
65
+ list-style-type: none !important;
66
+ text-align: left;
67
+ color: #3fb2c1;
68
+ font-weight: bold;
69
+ margin-top: 10px !important;
70
+ }
71
+ ul.components-edit-view-stats__Block li{
72
+ width: 100%;
73
+ max-width: 30%;
74
+ display: inline-block;
75
+ float: left;
76
+ margin-top: 12px;
77
+ text-align: center;
78
+ margin: 6px;
79
+ padding: 3px;
80
+ font-weight: normal;
81
+ letter-spacing: 1px;
82
+ border-radius: 2px;
83
+ }
84
+ .clear-both-OS__Block{
85
+ clear:both;
86
+ }
87
+ ul.components-edit-view-stats__Block li a {
88
+ color: #fff;
89
+ }
90
+ ul.components-edit-view-stats__Block li a {
91
+ color: #fff;
92
+ text-decoration:none;
93
+ }
94
+
95
+ .components-preview__leftBlockImage {
96
+ position: relative;
97
+ }
98
+
99
+ .components-preview__leftBlockImage .image {
100
+ display: block;
101
+ width: 100%;
102
+ height: auto;
103
+ }
104
+
105
+ .components-preview__leftBlockImage .overlay {
106
+ position: absolute;
107
+ top: 0;
108
+ bottom: 0;
109
+ left: 0;
110
+ right: 0;
111
+ height: 100%;
112
+ width: 100%;
113
+ opacity: 0;
114
+ transition: .5s ease;
115
+ background-color: #222120;
116
+ }
117
+
118
+ .components-preview__leftBlockImage:hover .overlay {
119
+ opacity: 0.8;
120
+ }
121
+
122
+ .components-preview__leftBlockImage .text {
123
+ color: white;
124
+ font-size: 20px;
125
+ position: absolute;
126
+ top: 50%;
127
+ left: 50%;
128
+ -webkit-transform: translate(-50%, -50%);
129
+ -ms-transform: translate(-50%, -50%);
130
+ transform: translate(-50%, -50%);
131
+ text-align: center;
132
+ }
133
+ .components-preview__leftBlockImage .text a{
134
+ border-radius: 5px;
135
+ border: 1px solid #fff;
136
+ color: #fff;
137
+ background: transparent;
138
+ cursor: pointer;
139
+ display: block;
140
+ line-height: 1;
141
+ margin: 10px auto;
142
+ padding: 10px 8px;
143
+ text-align: center;
144
+ text-decoration: none;
145
+ text-transform: uppercase;
146
+ width: 140px;
147
+ }
148
+ .components-preview__leftBlockImage .text a:hover, .components-preview__block input.left-align:hover {
149
+ color: #000 !important;
150
+ background: #fff !important;
151
+ }
152
+ .components-preview__block .left-align {
153
+ color: #fff;
154
+ text-transform: uppercase;
155
+ border: 1px solid #FFF;
156
+ box-shadow: 0px 0px;
157
+ text-align: center;
158
+ font-size: 19px;
159
+ border-radius: 5px;
160
+ padding: 0px 32px;
161
+ height: 40px;
162
+ width: 100%;
163
+ max-width: fit-content;
164
+ background: transparent;
165
+ }
166
+ .components-preview__block .left-align:hover{
167
+ background: transparent !important;
168
+ color: #fff !important;
169
+ border-color: #fff !important;
170
+ box-shadow: 0px 0px !important;
171
+ }
172
+ p.components-heading {
173
+ font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
174
+ font-weight: 600;
175
+ text-align: center;
176
+ }
177
+ .os-personality-wrapper.components-placeholder {
178
+ transition: 1s;
179
+ }
gutenberg/personality/src/block/style.scss ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Styles
3
+ *
4
+ * CSS for both Frontend+Backend.
5
+ */
6
+
7
+ .wp-block-cgb-block-bootstrap-alert {
8
+ background: $red;
9
+ border: 0.2rem solid $black;
10
+ color: $black;
11
+ margin: 0 auto;
12
+ max-width: 740px;
13
+ padding: 2rem;
14
+ }
gutenberg/personality/src/blocks.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Gutenberg Blocks
3
+ *
4
+ * All blocks related JavaScript files should be imported here.
5
+ * You can create a new block folder in this dir and include code
6
+ * for that block here as well.
7
+ *
8
+ * All blocks should be included here since this is the file that
9
+ * Webpack is compiling as the input file.
10
+ */
11
+
12
+ import './block/block.js';
gutenberg/personality/src/common.scss ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Common SCSS
3
+ *
4
+ * Can include things like variables and mixins
5
+ * that are used across the project.
6
+ */
7
+
8
+ // Colors.
9
+ $black: rgb(41, 41, 41);
10
+ $white: #f4f4f4;
11
+ $gray: #dedede;
12
+ $green: #bada55;
13
+ $red: orangered;
gutenberg/personality/src/init.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Blocks Initializer
4
+ *
5
+ * Enqueue CSS/JS of all the blocks.
6
+ *
7
+ * @since 1.0.0
8
+ * @package OSWP
9
+ */
10
+
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ function opinionStage_personality_oswp_block_assets_set() {
16
+ wp_enqueue_style('Bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css');
17
+ wp_enqueue_style(
18
+ 'opinionStage_personality_oswp_style_css_set',
19
+ plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ),
20
+ array( 'wp-blocks' )
21
+ );
22
+ }
23
+ add_action( 'enqueue_block_assets', 'opinionStage_personality_oswp_block_assets_set' );
24
+
25
+ function opinionStage_personality_oswp_editor_assets_set() {
26
+ // Scripts.
27
+ wp_enqueue_script(
28
+ 'opinionStage_personality_oswp_block_js_set', // Handle.
29
+ plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ),
30
+ array( 'wp-blocks', 'wp-i18n', 'wp-element','wp-components','wp-editor' ),
31
+ true
32
+ );
33
+
34
+ // Styles.
35
+ wp_enqueue_style('Bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css');
36
+ wp_enqueue_style(
37
+ 'opinionStage_personality_oswp_block_editor_css_set', // Handle.
38
+ plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
39
+ array( 'wp-edit-blocks' )
40
+ );
41
+ }
42
+ add_action( 'enqueue_block_editor_assets', 'opinionStage_personality_oswp_editor_assets_set' );
43
+ ?>
gutenberg/poll/dist/blocks.build.js ADDED
@@ -0,0 +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&amp;utm_source=wordpress&amp;utm_campaign=WPMainPI&amp;utm_medium=link&amp;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){}]);
gutenberg/poll/dist/blocks.editor.build.css ADDED
@@ -0,0 +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{display:block;width:100%;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-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-poll-wrapper.components-placeholder{-webkit-transition:1s;-o-transition:1s;transition:1s}
gutenberg/poll/dist/blocks.style.build.css ADDED
@@ -0,0 +1 @@
 
1
+ .wp-block-cgb-block-bootstrap-alert{background:#ff4500;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}
gutenberg/poll/src/.DS_Store ADDED
Binary file
gutenberg/poll/src/block/block.js ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import './style.scss';
2
+ import './editor.scss';
3
+
4
+ const { __ } = wp.i18n;
5
+ const { registerBlockType } = wp.blocks;
6
+ const { SelectControl, TextControl } = wp.components;
7
+ const { RichText } = wp.editor ;
8
+
9
+ var dropdownOptions = false;
10
+ var previewBlockOsTitle;
11
+ var previewBlockOsImageUrl;
12
+ var previewBlockOsView;
13
+ var previewBlockOsEdit;
14
+ var previewBlockOsStatistics;
15
+ var options;
16
+
17
+ registerBlockType( 'opinion-stage/block-os-poll', {
18
+ title: __( 'Poll' ),
19
+ icon: 'chart-bar',
20
+ category: 'opinion-stage',
21
+ keywords: [
22
+ __( 'Opinion Stage Poll' ),
23
+ __( 'Opinion Stage Poll Insert' ),
24
+ ],
25
+ attributes: {
26
+ embedUrl: {
27
+ source: 'attribute',
28
+ attribute: 'data-embed-url',
29
+ selector: 'div[data-embed-url]'
30
+ },
31
+ lockEmbed: {
32
+ source: 'attribute',
33
+ attribute: 'data-lock-embed',
34
+ selector: 'div[data-lock-embed]'
35
+ },
36
+ buttonText: {
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: '' });
47
+ }else if(val != ''){
48
+ props.setAttributes({ embedUrl: val });
49
+ for (var i = 0; i < dropdownOptions.length; i++) {
50
+ var getLandingPageUrlOs = function(href) {
51
+ var locationUrlOS = document.createElement("a");
52
+ locationUrlOS.href = href;
53
+ return locationUrlOS;
54
+ };
55
+ var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
56
+ var matchValue = locationUrlOS.pathname;
57
+ if(val == matchValue){
58
+ previewBlockOsTitle = dropdownOptions[i].attributes['title'];
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
+ }
66
+ }else{
67
+ }
68
+ };
69
+ const onEmbedButtonClick = event => {
70
+ if( event.target.value == "Embed" ){
71
+ if(embedUrl == '' || embedUrl == 'Select' || embedUrl == 'createNew' || embedUrl == 'refresh'){
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&amp;utm_source=wordpress&amp;utm_campaign=WPMainPI&amp;utm_medium=link&amp;o=wp35e8';
83
+ const onCreateButtonClick = value => {
84
+ // Open Create new poll link in new page
85
+ window.open(getOsCreateButtonClickUrl, '_blank').focus();
86
+ };
87
+
88
+ if(!buttonText){
89
+ props.setAttributes({ buttonText: 'Embed' });
90
+ }
91
+
92
+ var getCallBackUrlOs = osGutenData.callbackUrlOs;
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;
100
+ var opinionStageClientToken = osGutenData.OswpClientToken;
101
+ var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=poll&page=1&per_page=99';
102
+ fetch(opinionstageFetchDataUrl, {
103
+ method: "GET",
104
+ headers: {
105
+ 'Accept':'application/vnd.api+json',
106
+ 'Content-Type':'application/vnd.api+json',
107
+ 'OSWP-Plugin-Version':opinionStageWidgetVersion,
108
+ 'OSWP-Client-Token': opinionStageClientToken
109
+ },
110
+ })
111
+ .then(async res => {
112
+ var data = await res.json();
113
+ data = data.data;
114
+ dropdownOptions = data;
115
+ // force reprinting instead!!
116
+ props.setAttributes({ buttonText: 'Embed'});
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
+ })
124
+ .catch(function(err) {
125
+ console.log('ERROR: ' + err.message);
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
+ <div className="components-placeholder__label">Connect WordPress with Opinion Stage to get started</div>
134
+ <form method="get" action={formActionUrlOS} className="components-placeholder__fieldset">
135
+ <input type="hidden" name="utm_source" value="wordpress"/>
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 Poll'},{value:'refresh',label:'Refresh'}];
149
+ OsPolulateList();
150
+ }else{
151
+ options = [{value:'Select',label:'Select a Poll'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
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',''),
155
+ label: dropdownOptions[i].attributes['title'],
156
+ };
157
+ var getLandingPageUrlOs = function(href) {
158
+ var locationUrlOS = document.createElement("a");
159
+ locationUrlOS.href = href;
160
+ return locationUrlOS;
161
+ };
162
+ var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
163
+ var matchValue = locationUrlOS.pathname;
164
+ if(embedUrl == matchValue){
165
+ previewBlockOsTitle = dropdownOptions[i].attributes['title'];
166
+ previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
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
+ <p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
181
+ <div className="components-placeholder__label">Select an existing poll or create a new one</div>
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'){
193
+ contentViewEditStatOs
194
+ }else if(buttonText == 'Change'){
195
+ contentViewEditStatOs = (
196
+ <div className="os-poll-wrapper components-placeholder">
197
+ <p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
198
+ <div className="components-preview__block" >
199
+ <div className="components-preview__leftBlockImage">
200
+ <img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
201
+ <div className="overlay">
202
+ <div className="text">
203
+ <a href={previewBlockOsView} classname="components-button is-button is-default is-large" target="_blank"> View </a>
204
+ <a href={previewBlockOsEdit} classname="components-button is-button is-default is-large" target="_blank"> Edit </a>
205
+ <a href={previewBlockOsStatistics} classname="components-button is-button is-default is-large" target="_blank"> Statistics </a>
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">Poll: {previewBlockOsTitle}</div>
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
220
+ }else{
221
+ props.setAttributes({ buttonText: 'Embed'});
222
+ contentViewEditStatOs
223
+ }
224
+ return (
225
+ <div className={ props.className }>
226
+ {contentViewEditStatOs}
227
+ </div>
228
+ );
229
+ }
230
+ },
231
+ save: function( {attributes: {embedUrl, lockEmbed, buttonText}} ) {
232
+ return (
233
+ <div class="os-poll-wrapper" data-type="Poll" data-embed-url={embedUrl} data-lock-embed={lockEmbed} data-button-text={buttonText}>
234
+ [os-widget path="{embedUrl}"]
235
+ </div>
236
+ );
237
+ },
238
+ } );
gutenberg/poll/src/block/editor.scss ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Editor Styles
3
+ *
4
+ * CSS for just Backend enqueued after style.scss
5
+ * which makes it higher in priority.
6
+ */
7
+
8
+ .wp-block-cgb-block-sampleblock {
9
+ background: $green;
10
+ border: 0.2rem solid $black;
11
+ color: $black;
12
+ margin: 0 auto;
13
+ max-width: 740px;
14
+ padding: 2rem;
15
+ }
16
+ .os-poll-wrapper .is-large, .os-poll-wrapper .is-block {
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 {
28
+ width: 100%;
29
+ float: left;
30
+ max-width: 80%;
31
+ margin-right: 10px;
32
+ }
33
+ .os-poll-wrapper .components-preview__block {
34
+ width: 100%;
35
+ max-width: 100%;
36
+ padding: 10px;
37
+ background: #fdfdfd;
38
+ box-shadow: 0px 1px 2px 0px #3fb2c145;
39
+ transition: 0.2s;
40
+ }
41
+ .components-preview__leftBlockImage {
42
+ width: 100%;
43
+ float: left;
44
+ }
45
+ .block-editor__container .components-preview__leftBlockImage img {
46
+ width: 100%;
47
+ }
48
+ .components-preview__rightBlockContent {
49
+ width: 100%;
50
+ float: left;
51
+ }
52
+ .components-preview__rightBlockContent .components-placeholder__label {
53
+ font-size: 18px;
54
+ font-weight: bold;
55
+ width: -webkit-fit-content;
56
+ width: -moz-fit-content;
57
+ width: fit-content;
58
+ margin: 0px;
59
+ line-height: 20px;
60
+ margin: 0px auto;
61
+ margin-top: 20px;
62
+ margin-bottom: 10px;
63
+ }
64
+ ul.components-edit-view-stats__Block {
65
+ list-style-type: none !important;
66
+ text-align: left;
67
+ color: #3fb2c1;
68
+ font-weight: bold;
69
+ margin-top: 10px !important;
70
+ }
71
+ ul.components-edit-view-stats__Block li{
72
+ width: 100%;
73
+ max-width: 30%;
74
+ display: inline-block;
75
+ float: left;
76
+ margin-top: 12px;
77
+ text-align: center;
78
+ margin: 6px;
79
+ padding: 3px;
80
+ font-weight: normal;
81
+ letter-spacing: 1px;
82
+ border-radius: 2px;
83
+ }
84
+ .clear-both-OS__Block{
85
+ clear:both;
86
+ }
87
+ ul.components-edit-view-stats__Block li a {
88
+ color: #fff;
89
+ }
90
+ ul.components-edit-view-stats__Block li a {
91
+ color: #fff;
92
+ text-decoration:none;
93
+ }
94
+
95
+ .components-preview__leftBlockImage {
96
+ position: relative;
97
+ }
98
+
99
+ .components-preview__leftBlockImage .image {
100
+ display: block;
101
+ width: 100%;
102
+ height: auto;
103
+ }
104
+
105
+ .components-preview__leftBlockImage .overlay {
106
+ position: absolute;
107
+ top: 0;
108
+ bottom: 0;
109
+ left: 0;
110
+ right: 0;
111
+ height: 100%;
112
+ width: 100%;
113
+ opacity: 0;
114
+ transition: .5s ease;
115
+ background-color: #222120;
116
+ }
117
+
118
+ .components-preview__leftBlockImage:hover .overlay {
119
+ opacity: 0.8;
120
+ }
121
+
122
+ .components-preview__leftBlockImage .text {
123
+ color: white;
124
+ font-size: 20px;
125
+ position: absolute;
126
+ top: 50%;
127
+ left: 50%;
128
+ -webkit-transform: translate(-50%, -50%);
129
+ -ms-transform: translate(-50%, -50%);
130
+ transform: translate(-50%, -50%);
131
+ text-align: center;
132
+ }
133
+ .components-preview__leftBlockImage .text a{
134
+ border-radius: 5px;
135
+ border: 1px solid #fff;
136
+ color: #fff;
137
+ background: transparent;
138
+ cursor: pointer;
139
+ display: block;
140
+ line-height: 1;
141
+ margin: 10px auto;
142
+ padding: 10px 8px;
143
+ text-align: center;
144
+ text-decoration: none;
145
+ text-transform: uppercase;
146
+ width: 140px;
147
+ }
148
+ .components-preview__leftBlockImage .text a:hover, .components-preview__block input.left-align:hover {
149
+ color: #000 !important;
150
+ background: #fff !important;
151
+ }
152
+ .components-preview__block .left-align {
153
+ color: #fff;
154
+ text-transform: uppercase;
155
+ border: 1px solid #FFF;
156
+ box-shadow: 0px 0px;
157
+ text-align: center;
158
+ font-size: 19px;
159
+ border-radius: 5px;
160
+ padding: 0px 32px;
161
+ height: 40px;
162
+ width: 100%;
163
+ max-width: fit-content;
164
+ background: transparent;
165
+ }
166
+ .components-preview__block .left-align:hover{
167
+ background: transparent !important;
168
+ color: #fff !important;
169
+ border-color: #fff !important;
170
+ box-shadow: 0px 0px !important;
171
+ }
172
+ p.components-heading {
173
+ font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
174
+ font-weight: 600;
175
+ text-align: center;
176
+ }
177
+ .os-poll-wrapper.components-placeholder {
178
+ transition: 1s;
179
+ }
gutenberg/poll/src/block/style.scss ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Styles
3
+ *
4
+ * CSS for both Frontend+Backend.
5
+ */
6
+
7
+ .wp-block-cgb-block-bootstrap-alert {
8
+ background: $red;
9
+ border: 0.2rem solid $black;
10
+ color: $black;
11
+ margin: 0 auto;
12
+ max-width: 740px;
13
+ padding: 2rem;
14
+ }
gutenberg/poll/src/blocks.js ADDED
@@ -0,0 +1 @@
 
0
  * Gutenberg Blocks
1
  *
2
  * All blocks related JavaScript files should be imported here.
3
  * You can create a new block folder in this dir and include code
4
  * for that block here as well.
5
  *
6
  * All blocks should be included here since this is the file that
7
  * Webpack is compiling as the input file.
8
  */
1
+ /**
2
  * Gutenberg Blocks
3
  *
4
  * All blocks related JavaScript files should be imported here.
5
  * You can create a new block folder in this dir and include code
6
  * for that block here as well.
7
  *
8
  * All blocks should be included here since this is the file that
9
  * Webpack is compiling as the input file.
10
  */
gutenberg/poll/src/common.scss ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Common SCSS
3
+ *
4
+ * Can include things like variables and mixins
5
+ * that are used across the project.
6
+ */
7
+
8
+ // Colors.
9
+ $black: rgb(41, 41, 41);
10
+ $white: #f4f4f4;
11
+ $gray: #dedede;
12
+ $green: #bada55;
13
+ $red: orangered;
gutenberg/poll/src/init.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Blocks Initializer
4
+ *
5
+ * Enqueue CSS/JS of all the blocks.
6
+ *
7
+ * @since 1.0.0
8
+ * @package OSWP
9
+ */
10
+
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+
16
+ function opinionStage_poll_oswp_block_assets_set() {
17
+ wp_enqueue_style('Bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css');
18
+ wp_enqueue_style(
19
+ 'opinionStage_poll_oswp_style_css_set',
20
+ plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ),
21
+ array( 'wp-blocks' )
22
+ );
23
+ }
24
+
25
+ add_action( 'enqueue_block_assets', 'opinionStage_poll_oswp_block_assets_set' );
26
+
27
+
28
+ function opinionStage_poll_oswp_editor_assets_set() {
29
+ // Scripts.
30
+ wp_enqueue_script(
31
+ 'opinionStage_poll_oswp_block_js_set', // Handle.
32
+ plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ),
33
+ array( 'wp-blocks', 'wp-i18n', 'wp-element','wp-components','wp-editor' ),
34
+ true
35
+ );
36
+
37
+ // Styles.
38
+ wp_enqueue_style('Bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css');
39
+
40
+ wp_enqueue_style(
41
+ 'opinionStage_poll_oswp_block_editor_css_set', // Handle.
42
+ plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
43
+ array( 'wp-edit-blocks' )
44
+ );
45
+ }
46
+
47
+ add_action( 'enqueue_block_editor_assets', 'opinionStage_poll_oswp_editor_assets_set' );
48
+
49
+ // Adding in tool bar
50
+ add_action( 'admin_footer', 'print_admin_js_template' );
51
+ function print_admin_js_template() {
52
+ ?>
53
+ <script id="opinion-stage-gutenberg-button-switch-mode-check" type="text/html">
54
+ <div id="opinion-stage-switch-mode-check">
55
+ <button id="opinion-stage-mode-button" type="button" class="button button-primary button-large">
56
+ <span class="opinion-stage-switch-mode-connected">Connect To Opinion Stage</span>
57
+ </button>
58
+ </div>
59
+ </script>
60
+ <?php
61
+ }
62
+ ?>
gutenberg/slideshow/dist/blocks.build.js ADDED
@@ -0,0 +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&amp;utm_source=wordpress&amp;utm_campaign=WPMainPI&amp;utm_medium=link&amp;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){}]);
gutenberg/slideshow/dist/blocks.editor.build.css ADDED
@@ -0,0 +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{display:block;width:100%;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-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-slideshow-wrapper.components-placeholder{-webkit-transition:1s;-o-transition:1s;transition:1s}
gutenberg/slideshow/dist/blocks.style.build.css ADDED
@@ -0,0 +1 @@
 
1
+ .wp-block-cgb-block-bootstrap-alert{background:#ff4500;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}
gutenberg/slideshow/src/.DS_Store ADDED
Binary file
gutenberg/slideshow/src/block/block.js ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import './style.scss';
2
+ import './editor.scss';
3
+
4
+ const { __ } = wp.i18n;
5
+ const { registerBlockType } = wp.blocks;
6
+ const { SelectControl, TextControl } = wp.components;
7
+ const { RichText } = wp.editor ;
8
+
9
+ var dropdownOptions = false;
10
+ var previewBlockOsTitle;
11
+ var previewBlockOsImageUrl;
12
+ var previewBlockOsView;
13
+ var previewBlockOsEdit;
14
+ var previewBlockOsStatistics;
15
+ var options;
16
+
17
+ registerBlockType( 'opinion-stage/block-os-slideshow', {
18
+ title: __( 'Slideshow' ),
19
+ icon: 'playlist-video',
20
+ category: 'opinion-stage',
21
+ keywords: [
22
+ __( 'Opinion Stage Slideshow' ),
23
+ __( 'Opinion Stage Slideshow Insert' ),
24
+ ],
25
+ attributes: {
26
+ embedUrl: {
27
+ source: 'attribute',
28
+ attribute: 'data-embed-url',
29
+ selector: 'div[data-embed-url]'
30
+ },
31
+ lockEmbed: {
32
+ source: 'attribute',
33
+ attribute: 'data-lock-embed',
34
+ selector: 'div[data-lock-embed]'
35
+ },
36
+ buttonText: {
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: '' });
47
+ }else if(val != ''){
48
+ props.setAttributes({ embedUrl: val });
49
+ for (var i = 0; i < dropdownOptions.length; i++) {
50
+ var getLandingPageUrlOs = function(href) {
51
+ var locationUrlOS = document.createElement("a");
52
+ locationUrlOS.href = href;
53
+ return locationUrlOS;
54
+ };
55
+ var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
56
+ var matchValue = locationUrlOS.pathname;
57
+ if(val == matchValue){
58
+ previewBlockOsTitle = dropdownOptions[i].attributes['title'];
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
+ }
66
+ }else{
67
+ }
68
+ };
69
+ const onEmbedButtonClick = event => {
70
+ if( event.target.value == "Embed" ){
71
+ if(embedUrl == '' || embedUrl == 'Select' || embedUrl == 'createNew' || embedUrl == 'refresh'){
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&amp;utm_source=wordpress&amp;utm_campaign=WPMainPI&amp;utm_medium=link&amp;o=wp35e8';
83
+ const onCreateButtonClick = value => {
84
+ // Open Create new slideshow link in new page
85
+ window.open(getOsCreateButtonClickUrl, '_blank').focus();
86
+ };
87
+
88
+ if(!buttonText){
89
+ props.setAttributes({ buttonText: 'Embed' });
90
+ }
91
+
92
+ var getCallBackUrlOs = osGutenData.callbackUrlOs;
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;
100
+ var opinionStageClientToken = osGutenData.OswpClientToken;
101
+ var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=slideshow&page=1&per_page=99';
102
+ fetch(opinionstageFetchDataUrl, {
103
+ method: "GET",
104
+ headers: {
105
+ 'Accept':'application/vnd.api+json',
106
+ 'Content-Type':'application/vnd.api+json',
107
+ 'OSWP-Plugin-Version':opinionStageWidgetVersion,
108
+ 'OSWP-Client-Token': opinionStageClientToken
109
+ },
110
+ })
111
+ .then(async res => {
112
+ var data = await res.json();
113
+ data = data.data;
114
+ dropdownOptions = data;
115
+ // force reprinting instead!!
116
+ props.setAttributes({ buttonText: 'Embed'});
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
+ })
124
+ .catch(function(err) {
125
+ console.log('ERROR: ' + err.message);
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
+ <div className="components-placeholder__label">Connect WordPress with Opinion Stage to get started</div>
134
+ <form method="get" action={formActionUrlOS} className="components-placeholder__fieldset">
135
+ <input type="hidden" name="utm_source" value="wordpress"/>
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 Slideshow'},{value:'refresh',label:'Refresh'}];
149
+ OsPolulateList();
150
+ }else{
151
+ options = [{value:'Select',label:'Select a Slideshow'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
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',''),
155
+ label: dropdownOptions[i].attributes['title'],
156
+ };
157
+ var getLandingPageUrlOs = function(href) {
158
+ var locationUrlOS = document.createElement("a");
159
+ locationUrlOS.href = href;
160
+ return locationUrlOS;
161
+ };
162
+ var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
163
+ var matchValue = locationUrlOS.pathname;
164
+ if(embedUrl == matchValue){
165
+ previewBlockOsTitle = dropdownOptions[i].attributes['title'];
166
+ previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
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
+ <p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
181
+ <div className="components-placeholder__label">Select an existing slideshow or create a new one</div>
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'){
193
+ contentViewEditStatOs
194
+ }else if(buttonText == 'Change'){
195
+ contentViewEditStatOs = (
196
+ <div className="os-slideshow-wrapper components-placeholder">
197
+ <p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
198
+ <div className="components-preview__block" >
199
+ <div className="components-preview__leftBlockImage">
200
+ <img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
201
+ <div className="overlay">
202
+ <div className="text">
203
+ <a href={previewBlockOsView} classname="components-button is-button is-default is-large" target="_blank"> View </a>
204
+ <a href={previewBlockOsEdit} classname="components-button is-button is-default is-large" target="_blank"> Edit </a>
205
+ <a href={previewBlockOsStatistics} classname="components-button is-button is-default is-large" target="_blank"> Statistics </a>
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">Slideshow: {previewBlockOsTitle}</div>
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
220
+ }else{
221
+ props.setAttributes({ buttonText: 'Embed'});
222
+ contentViewEditStatOs
223
+ }
224
+ return (
225
+ <div className={ props.className }>
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-embed-url={embedUrl} data-lock-embed={lockEmbed} data-button-text={buttonText}>
234
+ [os-widget path="{embedUrl}"]
235
+ </div>
236
+ );
237
+ },
238
+ } );
gutenberg/slideshow/src/block/editor.scss ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Editor Styles
3
+ *
4
+ * CSS for just Backend enqueued after style.scss
5
+ * which makes it higher in priority.
6
+ */
7
+
8
+ .wp-block-cgb-block-sampleblock {
9
+ background: $green;
10
+ border: 0.2rem solid $black;
11
+ color: $black;
12
+ margin: 0 auto;
13
+ max-width: 740px;
14
+ padding: 2rem;
15
+ }
16
+ .os-slideshow-wrapper .is-large, .os-slideshow-wrapper .is-block {
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 {
28
+ width: 100%;
29
+ float: left;
30
+ max-width: 80%;
31
+ margin-right: 10px;
32
+ }
33
+ .os-slideshow-wrapper .components-preview__block {
34
+ width: 100%;
35
+ max-width: 100%;
36
+ padding: 10px;
37
+ background: #fdfdfd;
38
+ box-shadow: 0px 1px 2px 0px #3fb2c145;
39
+ transition: 0.2s;
40
+ }
41
+ .components-preview__leftBlockImage {
42
+ width: 100%;
43
+ float: left;
44
+ }
45
+ .block-editor__container .components-preview__leftBlockImage img {
46
+ width: 100%;
47
+ }
48
+ .components-preview__rightBlockContent {
49
+ width: 100%;
50
+ float: left;
51
+ }
52
+ .components-preview__rightBlockContent .components-placeholder__label {
53
+ font-size: 18px;
54
+ font-weight: bold;
55
+ width: -webkit-fit-content;
56
+ width: -moz-fit-content;
57
+ width: fit-content;
58
+ margin: 0px;
59
+ line-height: 20px;
60
+ margin: 0px auto;
61
+ margin-top: 20px;
62
+ margin-bottom: 10px;
63
+ }
64
+ ul.components-edit-view-stats__Block {
65
+ list-style-type: none !important;
66
+ text-align: left;
67
+ color: #3fb2c1;
68
+ font-weight: bold;
69
+ margin-top: 10px !important;
70
+ }
71
+ ul.components-edit-view-stats__Block li{
72
+ width: 100%;
73
+ max-width: 30%;
74
+ display: inline-block;
75
+ float: left;
76
+ margin-top: 12px;
77
+ text-align: center;
78
+ margin: 6px;
79
+ padding: 3px;
80
+ font-weight: normal;
81
+ letter-spacing: 1px;
82
+ border-radius: 2px;
83
+ }
84
+ .clear-both-OS__Block{
85
+ clear:both;
86
+ }
87
+ ul.components-edit-view-stats__Block li a {
88
+ color: #fff;
89
+ }
90
+ ul.components-edit-view-stats__Block li a {
91
+ color: #fff;
92
+ text-decoration:none;
93
+ }
94
+
95
+ .components-preview__leftBlockImage {
96
+ position: relative;
97
+ }
98
+
99
+ .components-preview__leftBlockImage .image {
100
+ display: block;
101
+ width: 100%;
102
+ height: auto;
103
+ }
104
+
105
+ .components-preview__leftBlockImage .overlay {
106
+ position: absolute;
107
+ top: 0;
108
+ bottom: 0;
109
+ left: 0;
110
+ right: 0;
111
+ height: 100%;
112
+ width: 100%;
113
+ opacity: 0;
114
+ transition: .5s ease;
115
+ background-color: #222120;
116
+ }
117
+
118
+ .components-preview__leftBlockImage:hover .overlay {
119
+ opacity: 0.8;
120
+ }
121
+
122
+ .components-preview__leftBlockImage .text {
123
+ color: white;
124
+ font-size: 20px;
125
+ position: absolute;
126
+ top: 50%;
127
+ left: 50%;
128
+ -webkit-transslideshow: translate(-50%, -50%);
129
+ -ms-transslideshow: translate(-50%, -50%);
130
+ transslideshow: translate(-50%, -50%);
131
+ text-align: center;
132
+ }
133
+ .components-preview__leftBlockImage .text a{
134
+ border-radius: 5px;
135
+ border: 1px solid #fff;
136
+ color: #fff;
137
+ background: transparent;
138
+ cursor: pointer;
139
+ display: block;
140
+ line-height: 1;
141
+ margin: 10px auto;
142
+ padding: 10px 8px;
143
+ text-align: center;
144
+ text-decoration: none;
145
+ text-transslideshow: uppercase;
146
+ width: 140px;
147
+ }
148
+ .components-preview__leftBlockImage .text a:hover, .components-preview__block input.left-align:hover {
149
+ color: #000 !important;
150
+ background: #fff !important;
151
+ }
152
+ .components-preview__block .left-align {
153
+ color: #fff;
154
+ text-transslideshow: uppercase;
155
+ border: 1px solid #FFF;
156
+ box-shadow: 0px 0px;
157
+ text-align: center;
158
+ font-size: 19px;
159
+ border-radius: 5px;
160
+ padding: 0px 32px;
161
+ height: 40px;
162
+ width: 100%;
163
+ max-width: fit-content;
164
+ background: transparent;
165
+ }
166
+ .components-preview__block .left-align:hover{
167
+ background: transparent !important;
168
+ color: #fff !important;
169
+ border-color: #fff !important;
170
+ box-shadow: 0px 0px !important;
171
+ }
172
+ p.components-heading {
173
+ font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
174
+ font-weight: 600;
175
+ text-align: center;
176
+ }
177
+ .os-slideshow-wrapper.components-placeholder {
178
+ transition: 1s;
179
+ }
gutenberg/slideshow/src/block/style.scss ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Styles
3
+ *
4
+ * CSS for both Frontend+Backend.
5
+ */
6
+
7
+ .wp-block-cgb-block-bootstrap-alert {
8
+ background: $red;
9
+ border: 0.2rem solid $black;
10
+ color: $black;
11
+ margin: 0 auto;
12
+ max-width: 740px;
13
+ padding: 2rem;
14
+ }
gutenberg/slideshow/src/blocks.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Gutenberg Blocks
3
+ *
4
+ * All blocks related JavaScript files should be imported here.
5
+ * You can create a new block folder in this dir and include code
6
+ * for that block here as well.
7
+ *
8
+ * All blocks should be included here since this is the file that
9
+ * Webpack is compiling as the input file.
10
+ */
11
+
12
+ import './block/block.js';
gutenberg/slideshow/src/common.scss ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Common SCSS
3
+ *
4
+ * Can include things like variables and mixins
5
+ * that are used across the project.
6
+ */
7
+
8
+ // Colors.
9
+ $black: rgb(41, 41, 41);
10
+ $white: #f4f4f4;
11
+ $gray: #dedede;
12
+ $green: #bada55;
13
+ $red: orangered;
gutenberg/slideshow/src/init.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Blocks Initializer
4
+ *
5
+ * Enqueue CSS/JS of all the blocks.
6
+ *
7
+ * @since 1.0.0
8
+ * @package OSWP
9
+ */
10
+
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ function opinionStage_slideshow_oswp_block_assets_set() {
16
+ wp_enqueue_style('Bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css');
17
+ wp_enqueue_style(
18
+ 'opinionStage_slideshow_oswp_style_css_set',
19
+ plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ),
20
+ array( 'wp-blocks' )
21
+ );
22
+ }
23
+ add_action( 'enqueue_block_assets', 'opinionStage_slideshow_oswp_block_assets_set' );
24
+
25
+ function opinionStage_slideshow_oswp_editor_assets_set() {
26
+ // Scripts.
27
+ wp_enqueue_script(
28
+ 'opinionStage_slideshow_oswp_block_js_set', // Handle.
29
+ plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ),
30
+ array( 'wp-blocks', 'wp-i18n', 'wp-element','wp-components','wp-editor' ),
31
+ true
32
+ );
33
+
34
+ // Styles.
35
+ wp_enqueue_style('Bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css');
36
+ wp_enqueue_style(
37
+ 'opinionStage_slideshow_oswp_block_editor_css_set', // Handle.
38
+ plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
39
+ array( 'wp-edit-blocks' )
40
+ );
41
+ }
42
+ add_action( 'enqueue_block_editor_assets', 'opinionStage_slideshow_oswp_editor_assets_set' );
43
+ ?>
gutenberg/survey/dist/blocks.build.js ADDED
@@ -0,0 +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&amp;utm_source=wordpress&amp;utm_campaign=WPMainPI&amp;utm_medium=link&amp;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){}]);
gutenberg/survey/dist/blocks.editor.build.css ADDED
@@ -0,0 +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{display:block;width:100%;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-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}
gutenberg/survey/dist/blocks.style.build.css ADDED
@@ -0,0 +1 @@
 
1
+ .wp-block-cgb-block-bootstrap-alert{background:#ff4500;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}
gutenberg/survey/src/.DS_Store ADDED
Binary file
gutenberg/survey/src/block/block.js ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import './style.scss';
2
+ import './editor.scss';
3
+
4
+ const { __ } = wp.i18n;
5
+ const { registerBlockType } = wp.blocks;
6
+ const { SelectControl, TextControl } = wp.components;
7
+ const { RichText } = wp.editor ;
8
+
9
+ var dropdownOptions = false;
10
+ var previewBlockOsTitle;
11
+ var previewBlockOsImageUrl;
12
+ var previewBlockOsView;
13
+ var previewBlockOsEdit;
14
+ var previewBlockOsStatistics;
15
+ var options;
16
+
17
+ registerBlockType( 'opinion-stage/block-os-survey', {
18
+ title: __( 'Survey' ),
19
+ icon: 'list-view',
20
+ category: 'opinion-stage',
21
+ keywords: [
22
+ __( 'Opinion Stage Survey' ),
23
+ __( 'Opinion Stage Survey Insert' ),
24
+ ],
25
+ attributes: {
26
+ embedUrl: {
27
+ source: 'attribute',
28
+ attribute: 'data-embed-url',
29
+ selector: 'div[data-embed-url]'
30
+ },
31
+ lockEmbed: {
32
+ source: 'attribute',
33
+ attribute: 'data-lock-embed',
34
+ selector: 'div[data-lock-embed]'
35
+ },
36
+ buttonText: {
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: '' });
47
+ }else if(val != ''){
48
+ props.setAttributes({ embedUrl: val });
49
+ for (var i = 0; i < dropdownOptions.length; i++) {
50
+ var getLandingPageUrlOs = function(href) {
51
+ var locationUrlOS = document.createElement("a");
52
+ locationUrlOS.href = href;
53
+ return locationUrlOS;
54
+ };
55
+ var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
56
+ var matchValue = locationUrlOS.pathname;
57
+ if(val == matchValue){
58
+ previewBlockOsTitle = dropdownOptions[i].attributes['title'];
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
+ }
66
+ }else{
67
+ }
68
+ };
69
+ const onEmbedButtonClick = event => {
70
+ if( event.target.value == "Embed" ){
71
+ if(embedUrl == '' || embedUrl == 'Select' || embedUrl == 'createNew' || embedUrl == 'refresh'){
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&amp;utm_source=wordpress&amp;utm_campaign=WPMainPI&amp;utm_medium=link&amp;o=wp35e8';
83
+ const onCreateButtonClick = value => {
84
+ // Open Create new survey link in new page
85
+ window.open(getOsCreateButtonClickUrl, '_blank').focus();
86
+ };
87
+
88
+ if(!buttonText){
89
+ props.setAttributes({ buttonText: 'Embed' });
90
+ }
91
+
92
+ var getCallBackUrlOs = osGutenData.callbackUrlOs;
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;
100
+ var opinionStageClientToken = osGutenData.OswpClientToken;
101
+ var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=survey&page=1&per_page=99';
102
+ fetch(opinionstageFetchDataUrl, {
103
+ method: "GET",
104
+ headers: {
105
+ 'Accept':'application/vnd.api+json',
106
+ 'Content-Type':'application/vnd.api+json',
107
+ 'OSWP-Plugin-Version':opinionStageWidgetVersion,
108
+ 'OSWP-Client-Token': opinionStageClientToken
109
+ },
110
+ })
111
+ .then(async res => {
112
+ var data = await res.json();
113
+ data = data.data;
114
+ dropdownOptions = data;
115
+ // force reprinting instead!!
116
+ props.setAttributes({ buttonText: 'Embed'});
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
+ })
124
+ .catch(function(err) {
125
+ console.log('ERROR: ' + err.message);
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
+ <div className="components-placeholder__label">Connect WordPress with Opinion Stage to get started</div>
134
+ <form method="get" action={formActionUrlOS} className="components-placeholder__fieldset">
135
+ <input type="hidden" name="utm_source" value="wordpress"/>
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 Survey'},{value:'refresh',label:'Refresh'}];
149
+ OsPolulateList();
150
+ }else{
151
+ options = [{value:'Select',label:'Select a Survey'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
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',''),
155
+ label: dropdownOptions[i].attributes['title'],
156
+ };
157
+ var getLandingPageUrlOs = function(href) {
158
+ var locationUrlOS = document.createElement("a");
159
+ locationUrlOS.href = href;
160
+ return locationUrlOS;
161
+ };
162
+ var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
163
+ var matchValue = locationUrlOS.pathname;
164
+ if(embedUrl == matchValue){
165
+ previewBlockOsTitle = dropdownOptions[i].attributes['title'];
166
+ previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
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
+ <p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
181
+ <div className="components-placeholder__label">Select an existing survey or create a new one</div>
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'){
193
+ contentViewEditStatOs
194
+ }else if(buttonText == 'Change'){
195
+ contentViewEditStatOs = (
196
+ <div className="os-survey-wrapper components-placeholder">
197
+ <p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
198
+ <div className="components-preview__block" >
199
+ <div className="components-preview__leftBlockImage">
200
+ <img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
201
+ <div className="overlay">
202
+ <div className="text">
203
+ <a href={previewBlockOsView} classname="components-button is-button is-default is-large" target="_blank"> View </a>
204
+ <a href={previewBlockOsEdit} classname="components-button is-button is-default is-large" target="_blank"> Edit </a>
205
+ <a href={previewBlockOsStatistics} classname="components-button is-button is-default is-large" target="_blank"> Statistics </a>
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">Survey: {previewBlockOsTitle}</div>
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
220
+ }else{
221
+ props.setAttributes({ buttonText: 'Embed'});
222
+ contentViewEditStatOs
223
+ }
224
+ return (
225
+ <div className={ props.className }>
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-embed-url={embedUrl} data-lock-embed={lockEmbed} data-button-text={buttonText}>
234
+ [os-widget path="{embedUrl}"]
235
+ </div>
236
+ );
237
+ },
238
+ } );
gutenberg/survey/src/block/editor.scss ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Editor Styles
3
+ *
4
+ * CSS for just Backend enqueued after style.scss
5
+ * which makes it higher in priority.
6
+ */
7
+
8
+ .wp-block-cgb-block-sampleblock {
9
+ background: $green;
10
+ border: 0.2rem solid $black;
11
+ color: $black;
12
+ margin: 0 auto;
13
+ max-width: 740px;
14
+ padding: 2rem;
15
+ }
16
+ .os-survey-wrapper .is-large, .os-survey-wrapper .is-block {
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 {
28
+ width: 100%;
29
+ float: left;
30
+ max-width: 80%;
31
+ margin-right: 10px;
32
+ }
33
+ .os-survey-wrapper .components-preview__block {
34
+ width: 100%;
35
+ max-width: 100%;
36
+ padding: 10px;
37
+ background: #fdfdfd;
38
+ box-shadow: 0px 1px 2px 0px #3fb2c145;
39
+ transition: 0.2s;
40
+ }
41
+ .components-preview__leftBlockImage {
42
+ width: 100%;
43
+ float: left;
44
+ }
45
+ .block-editor__container .components-preview__leftBlockImage img {
46
+ width: 100%;
47
+ }
48
+ .components-preview__rightBlockContent {
49
+ width: 100%;
50
+ float: left;
51
+ }
52
+ .components-preview__rightBlockContent .components-placeholder__label {
53
+ font-size: 18px;
54
+ font-weight: bold;
55
+ width: -webkit-fit-content;
56
+ width: -moz-fit-content;
57
+ width: fit-content;
58
+ margin: 0px;
59
+ line-height: 20px;
60
+ margin: 0px auto;
61
+ margin-top: 20px;
62
+ margin-bottom: 10px;
63
+ }
64
+ ul.components-edit-view-stats__Block {
65
+ list-style-type: none !important;
66
+ text-align: left;
67
+ color: #3fb2c1;
68
+ font-weight: bold;
69
+ margin-top: 10px !important;
70
+ }
71
+ ul.components-edit-view-stats__Block li{
72
+ width: 100%;
73
+ max-width: 30%;
74
+ display: inline-block;
75
+ float: left;
76
+ margin-top: 12px;
77
+ text-align: center;
78
+ margin: 6px;
79
+ padding: 3px;
80
+ font-weight: normal;
81
+ letter-spacing: 1px;
82
+ border-radius: 2px;
83
+ }
84
+ .clear-both-OS__Block{
85
+ clear:both;
86
+ }
87
+ ul.components-edit-view-stats__Block li a {
88
+ color: #fff;
89
+ }
90
+ ul.components-edit-view-stats__Block li a {
91
+ color: #fff;
92
+ text-decoration:none;
93
+ }
94
+
95
+ .components-preview__leftBlockImage {
96
+ position: relative;
97
+ }
98
+
99
+ .components-preview__leftBlockImage .image {
100
+ display: block;
101
+ width: 100%;
102
+ height: auto;
103
+ }
104
+
105
+ .components-preview__leftBlockImage .overlay {
106
+ position: absolute;
107
+ top: 0;
108
+ bottom: 0;
109
+ left: 0;
110
+ right: 0;
111
+ height: 100%;
112
+ width: 100%;
113
+ opacity: 0;
114
+ transition: .5s ease;
115
+ background-color: #222120;
116
+ }
117
+
118
+ .components-preview__leftBlockImage:hover .overlay {
119
+ opacity: 0.8;
120
+ }
121
+
122
+ .components-preview__leftBlockImage .text {
123
+ color: white;
124
+ font-size: 20px;
125
+ position: absolute;
126
+ top: 50%;
127
+ left: 50%;
128
+ -webkit-transform: translate(-50%, -50%);
129
+ -ms-transform: translate(-50%, -50%);
130
+ transform: translate(-50%, -50%);
131
+ text-align: center;
132
+ }
133
+ .components-preview__leftBlockImage .text a{
134
+ border-radius: 5px;
135
+ border: 1px solid #fff;
136
+ color: #fff;
137
+ background: transparent;
138
+ cursor: pointer;
139
+ display: block;
140
+ line-height: 1;
141
+ margin: 10px auto;
142
+ padding: 10px 8px;
143
+ text-align: center;
144
+ text-decoration: none;
145
+ text-transform: uppercase;
146
+ width: 140px;
147
+ }
148
+ .components-preview__leftBlockImage .text a:hover, .components-preview__block input.left-align:hover {
149
+ color: #000 !important;
150
+ background: #fff !important;
151
+ }
152
+ .components-preview__block .left-align {
153
+ color: #fff;
154
+ text-transform: uppercase;
155
+ border: 1px solid #FFF;
156
+ box-shadow: 0px 0px;
157
+ text-align: center;
158
+ font-size: 19px;
159
+ border-radius: 5px;
160
+ padding: 0px 32px;
161
+ height: 40px;
162
+ width: 100%;
163
+ max-width: fit-content;
164
+ background: transparent;
165
+ }
166
+ .components-preview__block .left-align:hover{
167
+ background: transparent !important;
168
+ color: #fff !important;
169
+ border-color: #fff !important;
170
+ box-shadow: 0px 0px !important;
171
+ }
172
+ p.components-heading {
173
+ font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
174
+ font-weight: 600;
175
+ text-align: center;
176
+ }
177
+ .os-survey-wrapper.components-placeholder {
178
+ transition: 1s;
179
+ }
gutenberg/survey/src/block/style.scss ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Styles
3
+ *
4
+ * CSS for both Frontend+Backend.
5
+ */
6
+
7
+ .wp-block-cgb-block-bootstrap-alert {
8
+ background: $red;
9
+ border: 0.2rem solid $black;
10
+ color: $black;
11
+ margin: 0 auto;
12
+ max-width: 740px;
13
+ padding: 2rem;
14
+ }
gutenberg/survey/src/blocks.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Gutenberg Blocks
3
+ *
4
+ * All blocks related JavaScript files should be imported here.
5
+ * You can create a new block folder in this dir and include code
6
+ * for that block here as well.
7
+ *
8
+ * All blocks should be included here since this is the file that
9
+ * Webpack is compiling as the input file.
10
+ */
11
+
12
+ import './block/block.js';
gutenberg/survey/src/common.scss ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Common SCSS
3
+ *
4
+ * Can include things like variables and mixins
5
+ * that are used across the project.
6
+ */
7
+
8
+ // Colors.
9
+ $black: rgb(41, 41, 41);
10
+ $white: #f4f4f4;
11
+ $gray: #dedede;
12
+ $green: #bada55;
13
+ $red: orangered;
gutenberg/survey/src/init.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Blocks Initializer
4
+ *
5
+ * Enqueue CSS/JS of all the blocks.
6
+ *
7
+ * @since 1.0.0
8
+ * @package OSWP
9
+ */
10
+
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ function opinionStage_survey_oswp_block_assets_set() {
16
+ wp_enqueue_style('Bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css');
17
+ wp_enqueue_style(
18
+ 'opinionStage_survey_oswp_style_css_set',
19
+ plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ),
20
+ array( 'wp-blocks' )
21
+ );
22
+ }
23
+ add_action( 'enqueue_block_assets', 'opinionStage_survey_oswp_block_assets_set' );
24
+
25
+ function opinionStage_survey_oswp_editor_assets_set() {
26
+ // Scripts.
27
+ wp_enqueue_script(
28
+ 'opinionStage_survey_oswp_block_js_set', // Handle.
29
+ plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ),
30
+ array( 'wp-blocks', 'wp-i18n', 'wp-element','wp-components','wp-editor' ),
31
+ true
32
+ );
33
+
34
+
35
+ // Styles.
36
+ wp_enqueue_style('Bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css');
37
+ wp_enqueue_style(
38
+ 'opinionStage_survey_oswp_block_editor_css_set', // Handle.
39
+ plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
40
+ array( 'wp-edit-blocks' )
41
+ );
42
+ }
43
+ add_action( 'enqueue_block_editor_assets', 'opinionStage_survey_oswp_editor_assets_set' );
44
+ ?>
gutenberg/trivia/dist/blocks.build.js ADDED
@@ -0,0 +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&amp;utm_source=wordpress&amp;utm_campaign=WPMainPI&amp;utm_medium=link&amp;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){}]);
gutenberg/trivia/dist/blocks.editor.build.css ADDED
@@ -0,0 +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{display:block;width:100%;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-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}
gutenberg/trivia/dist/blocks.style.build.css ADDED
@@ -0,0 +1 @@
 
1
+ .wp-block-cgb-block-bootstrap-alert{background:#ff4500;border:0.2rem solid #292929;color:#292929;margin:0 auto;max-width:740px;padding:2rem}
gutenberg/trivia/src/.DS_Store ADDED
Binary file
gutenberg/trivia/src/block/block.js ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import './style.scss';
2
+ import './editor.scss';
3
+
4
+ const { __ } = wp.i18n;
5
+ const { registerBlockType } = wp.blocks;
6
+ const { SelectControl, TextControl } = wp.components;
7
+ const { RichText } = wp.editor ;
8
+
9
+ var dropdownOptions = false;
10
+ var previewBlockOsTitle;
11
+ var previewBlockOsImageUrl;
12
+ var previewBlockOsView;
13
+ var previewBlockOsEdit;
14
+ var previewBlockOsStatistics;
15
+ var options;
16
+
17
+ registerBlockType( 'opinion-stage/block-os-trivia', {
18
+ title: __( 'Trivia Quiz' ),
19
+ icon: 'yes',
20
+ category: 'opinion-stage',
21
+ keywords: [
22
+ __( 'Opinion Stage Trivia Quiz' ),
23
+ __( 'Opinion Stage Trivia Quiz Insert' ),
24
+ ],
25
+ attributes: {
26
+ embedUrl: {
27
+ source: 'attribute',
28
+ attribute: 'data-embed-url',
29
+ selector: 'div[data-embed-url]'
30
+ },
31
+ lockEmbed: {
32
+ source: 'attribute',
33
+ attribute: 'data-lock-embed',
34
+ selector: 'div[data-lock-embed]'
35
+ },
36
+ buttonText: {
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: '' });
47
+ }else if(val != ''){
48
+ props.setAttributes({ embedUrl: val });
49
+ for (var i = 0; i < dropdownOptions.length; i++) {
50
+ var getLandingPageUrlOs = function(href) {
51
+ var locationUrlOS = document.createElement("a");
52
+ locationUrlOS.href = href;
53
+ return locationUrlOS;
54
+ };
55
+ var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
56
+ var matchValue = locationUrlOS.pathname;
57
+ if(val == matchValue){
58
+ previewBlockOsTitle = dropdownOptions[i].attributes['title'];
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
+ }
66
+ }else{
67
+ }
68
+ };
69
+ const onEmbedButtonClick = event => {
70
+ if( event.target.value == "Embed" ){
71
+ if(embedUrl == '' || embedUrl == 'Select' || embedUrl == 'createNew' || embedUrl == 'refresh'){
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&amp;utm_source=wordpress&amp;utm_campaign=WPMainPI&amp;utm_medium=link&amp;o=wp35e8';
83
+ const onCreateButtonClick = value => {
84
+ // Open Create new trivia quiz link in new page
85
+ window.open(getOsCreateButtonClickUrl, '_blank').focus();
86
+ };
87
+
88
+ if(!buttonText){
89
+ props.setAttributes({ buttonText: 'Embed' });
90
+ }
91
+
92
+ var getCallBackUrlOs = osGutenData.callbackUrlOs;
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;
100
+ var opinionStageClientToken = osGutenData.OswpClientToken;
101
+ var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=trivia&page=1&per_page=99';
102
+ fetch(opinionstageFetchDataUrl, {
103
+ method: "GET",
104
+ headers: {
105
+ 'Accept':'application/vnd.api+json',
106
+ 'Content-Type':'application/vnd.api+json',
107
+ 'OSWP-Plugin-Version':opinionStageWidgetVersion,
108
+ 'OSWP-Client-Token': opinionStageClientToken
109
+ },
110
+ })
111
+ .then(async res => {
112
+ var data = await res.json();
113
+ data = data.data;
114
+ dropdownOptions = data;
115
+ // force reprinting instead!!
116
+ props.setAttributes({ buttonText: 'Embed'});
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
+ })
124
+ .catch(function(err) {
125
+ console.log('ERROR: ' + err.message);
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
+ <div className="components-placeholder__label">Connect WordPress with Opinion Stage to get started</div>
134
+ <form method="get" action={formActionUrlOS} className="components-placeholder__fieldset">
135
+ <input type="hidden" name="utm_source" value="wordpress"/>
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 Trivia Quiz'},{value:'refresh',label:'Refresh'}];
149
+ OsPolulateList();
150
+ }else{
151
+ options = [{value:'Select',label:'Select a Trivia Quiz'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
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',''),
155
+ label: dropdownOptions[i].attributes['title'],
156
+ };
157
+ var getLandingPageUrlOs = function(href) {
158
+ var locationUrlOS = document.createElement("a");
159
+ locationUrlOS.href = href;
160
+ return locationUrlOS;
161
+ };
162
+ var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
163
+ var matchValue = locationUrlOS.pathname;
164
+ if(embedUrl == matchValue){
165
+ previewBlockOsTitle = dropdownOptions[i].attributes['title'];
166
+ previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
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
+ <p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
181
+ <div className="components-placeholder__label">Select an existing trivia quiz or create a new one</div>
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'){
193
+ contentViewEditStatOs
194
+ }else if(buttonText == 'Change'){
195
+ contentViewEditStatOs = (
196
+ <div className="os-trivia-wrapper components-placeholder">
197
+ <p className="components-heading"><span><img src={getlogoImageLinkOs} alt=""/></span> Opinion Stage</p>
198
+ <div className="components-preview__block" >
199
+ <div className="components-preview__leftBlockImage">
200
+ <img src={previewBlockOsImageUrl} alt={previewBlockOsTitle} className="image" />
201
+ <div className="overlay">
202
+ <div className="text">
203
+ <a href={previewBlockOsView} classname="components-button is-button is-default is-large" target="_blank"> View </a>
204
+ <a href={previewBlockOsEdit} classname="components-button is-button is-default is-large" target="_blank"> Edit </a>
205
+ <a href={previewBlockOsStatistics} classname="components-button is-button is-default is-large" target="_blank"> Statistics </a>
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">Trivia Quiz: {previewBlockOsTitle}</div>
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
220
+ }else{
221
+ props.setAttributes({ buttonText: 'Embed'});
222
+ contentViewEditStatOs
223
+ }
224
+ return (
225
+ <div className={ props.className }>
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-embed-url={embedUrl} data-lock-embed={lockEmbed} data-button-text={buttonText}>
234
+ [os-widget path="{embedUrl}"]
235
+ </div>
236
+ );
237
+ },
238
+ } );
gutenberg/trivia/src/block/editor.scss ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Editor Styles
3
+ *
4
+ * CSS for just Backend enqueued after style.scss
5
+ * which makes it higher in priority.
6
+ */
7
+
8
+ .wp-block-cgb-block-sampleblock {
9
+ background: $green;
10
+ border: 0.2rem solid $black;
11
+ color: $black;
12
+ margin: 0 auto;
13
+ max-width: 740px;
14
+ padding: 2rem;
15
+ }
16
+ .os-trivia-wrapper .is-large, .os-trivia-wrapper .is-block {
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 {
28
+ width: 100%;
29
+ float: left;
30
+ max-width: 80%;
31
+ margin-right: 10px;
32
+ }
33
+ .os-trivia-wrapper .components-preview__block {
34
+ width: 100%;
35
+ max-width: 100%;
36
+ padding: 10px;
37
+ background: #fdfdfd;
38
+ box-shadow: 0px 1px 2px 0px #3fb2c145;
39
+ transition: 0.2s;
40
+ }
41
+ .components-preview__leftBlockImage {
42
+ width: 100%;
43
+ float: left;
44
+ }
45
+ .block-editor__container .components-preview__leftBlockImage img {
46
+ width: 100%;
47
+ }
48
+ .components-preview__rightBlockContent {
49
+ width: 100%;
50
+ float: left;
51
+ }
52
+ .components-preview__rightBlockContent .components-placeholder__label {
53
+ font-size: 18px;
54
+ font-weight: bold;
55
+ width: -webkit-fit-content;
56
+ width: -moz-fit-content;
57
+ width: fit-content;
58
+ margin: 0px;
59
+ line-height: 20px;
60
+ margin: 0px auto;
61
+ margin-top: 20px;
62
+ margin-bottom: 10px;
63
+ }
64
+ ul.components-edit-view-stats__Block {
65
+ list-style-type: none !important;
66
+ text-align: left;
67
+ color: #3fb2c1;
68
+ font-weight: bold;
69
+ margin-top: 10px !important;
70
+ }
71
+ ul.components-edit-view-stats__Block li{
72
+ width: 100%;
73
+ max-width: 30%;
74
+ display: inline-block;
75
+ float: left;
76
+ margin-top: 12px;
77
+ text-align: center;
78
+ margin: 6px;
79
+ padding: 3px;
80
+ font-weight: normal;
81
+ letter-spacing: 1px;
82
+ border-radius: 2px;
83
+ }
84
+ .clear-both-OS__Block{
85
+ clear:both;
86
+ }
87
+ ul.components-edit-view-stats__Block li a {
88
+ color: #fff;
89
+ }
90
+ ul.components-edit-view-stats__Block li a {
91
+ color: #fff;
92
+ text-decoration:none;
93
+ }
94
+
95
+ .components-preview__leftBlockImage {
96
+ position: relative;
97
+ }
98
+
99
+ .components-preview__leftBlockImage .image {
100
+ display: block;
101
+ width: 100%;
102
+ height: auto;
103
+ }
104
+
105
+ .components-preview__leftBlockImage .overlay {
106
+ position: absolute;
107
+ top: 0;
108
+ bottom: 0;
109
+ left: 0;
110
+ right: 0;
111
+ height: 100%;
112
+ width: 100%;
113
+ opacity: 0;
114
+ transition: .5s ease;
115
+ background-color: #222120;
116
+ }
117
+
118
+ .components-preview__leftBlockImage:hover .overlay {
119
+ opacity: 0.8;
120
+ }
121
+
122
+ .components-preview__leftBlockImage .text {
123
+ color: white;
124
+ font-size: 20px;
125
+ position: absolute;
126
+ top: 50%;
127
+ left: 50%;
128
+ -webkit-transform: translate(-50%, -50%);
129
+ -ms-transform: translate(-50%, -50%);
130
+ transform: translate(-50%, -50%);
131
+ text-align: center;
132
+ }
133
+ .components-preview__leftBlockImage .text a{
134
+ border-radius: 5px;
135
+ border: 1px solid #fff;
136
+ color: #fff;
137
+ background: transparent;
138
+ cursor: pointer;
139
+ display: block;
140
+ line-height: 1;
141
+ margin: 10px auto;
142
+ padding: 10px 8px;
143
+ text-align: center;
144
+ text-decoration: none;
145
+ text-transform: uppercase;
146
+ width: 140px;
147
+ }
148
+ .components-preview__leftBlockImage .text a:hover, .components-preview__block input.left-align:hover {
149
+ color: #000 !important;
150
+ background: #fff !important;
151
+ }
152
+ .components-preview__block .left-align {
153
+ color: #fff;
154
+ text-transform: uppercase;
155
+ border: 1px solid #FFF;
156
+ box-shadow: 0px 0px;
157
+ text-align: center;
158
+ font-size: 19px;
159
+ border-radius: 5px;
160
+ padding: 0px 32px;
161
+ height: 40px;
162
+ width: 100%;
163
+ max-width: fit-content;
164
+ background: transparent;
165
+ }
166
+ .components-preview__block .left-align:hover{
167
+ background: transparent !important;
168
+ color: #fff !important;
169
+ border-color: #fff !important;
170
+ box-shadow: 0px 0px !important;
171
+ }
172
+ p.components-heading {
173
+ font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
174
+ font-weight: 600;
175
+ text-align: center;
176
+ }
177
+ .os-trivia-wrapper.components-placeholder {
178
+ transition: 1s;
179
+ }
gutenberg/trivia/src/block/style.scss ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Styles
3
+ *
4
+ * CSS for both Frontend+Backend.
5
+ */
6
+
7
+ .wp-block-cgb-block-bootstrap-alert {
8
+ background: $red;
9
+ border: 0.2rem solid $black;
10
+ color: $black;
11
+ margin: 0 auto;
12
+ max-width: 740px;
13
+ padding: 2rem;
14
+ }
gutenberg/trivia/src/blocks.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Gutenberg Blocks
3
+ *
4
+ * All blocks related JavaScript files should be imported here.
5
+ * You can create a new block folder in this dir and include code
6
+ * for that block here as well.
7
+ *
8
+ * All blocks should be included here since this is the file that
9
+ * Webpack is compiling as the input file.
10
+ */
11
+
12
+ import './block/block.js';
gutenberg/trivia/src/common.scss ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * #.# Common SCSS
3
+ *
4
+ * Can include things like variables and mixins
5
+ * that are used across the project.
6
+ */
7
+
8
+ // Colors.
9
+ $black: rgb(41, 41, 41);
10
+ $white: #f4f4f4;
11
+ $gray: #dedede;
12
+ $green: #bada55;
13
+ $red: orangered;
gutenberg/trivia/src/init.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Blocks Initializer
4
+ *
5
+ * Enqueue CSS/JS of all the blocks.
6
+ *
7
+ * @since 1.0.0
8
+ * @package OSWP
9
+ */
10
+
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ function opinionStage_trivia_oswp_block_assets_set() {
16
+ wp_enqueue_style('Bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css');
17
+ wp_enqueue_style(
18
+ 'opinionStage_trivia_oswp_style_css_set',
19
+ plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ),
20
+ array( 'wp-blocks' )
21
+ );
22
+ }
23
+ add_action( 'enqueue_block_assets', 'opinionStage_trivia_oswp_block_assets_set' );
24
+
25
+ function opinionStage_trivia_oswp_editor_assets_set() {
26
+ // Scripts.
27
+ wp_enqueue_script(
28
+ 'opinionStage_trivia_oswp_block_js_set', // Handle.
29
+ plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ),
30
+ array( 'wp-blocks', 'wp-i18n', 'wp-element','wp-components','wp-editor' ),
31
+ true
32
+ );
33
+
34
+ // Styles.
35
+ wp_enqueue_style('Bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css');
36
+ wp_enqueue_style(
37
+ 'opinionStage_trivia_oswp_block_editor_css_set', // Handle.
38
+ plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
39
+ array( 'wp-edit-blocks' )
40
+ );
41
+ }
42
+ add_action( 'enqueue_block_editor_assets', 'opinionStage_trivia_oswp_editor_assets_set' );
43
+ ?>
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.8
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.9
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.8
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.8');
28
 
29
  define('OPINIONSTAGE_TEXT_DOMAIN', 'social-polls-by-opinionstage');
30
 
@@ -89,7 +89,10 @@ if (opinionstage_check_plugin_available('opinionstage_popup')) {
89
  require( plugin_dir_path( __FILE__ ).'public/init.php' );
90
  }
91
  }
92
-
 
 
 
93
  add_action('widgets_init', 'opinionstage_init_widget');
94
  add_action('plugins_loaded', 'opinionstage_init');
95
  }
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.9
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.9');
28
 
29
  define('OPINIONSTAGE_TEXT_DOMAIN', 'social-polls-by-opinionstage');
30
 
89
  require( plugin_dir_path( __FILE__ ).'public/init.php' );
90
  }
91
  }
92
+ //Check For Gutenberg
93
+ if( function_exists( 'is_gutenberg_page' ) ) {
94
+ require( plugin_dir_path( __FILE__ ).'gutenberg/init.php' );
95
+ }
96
  add_action('widgets_init', 'opinionstage_init_widget');
97
  add_action('plugins_loaded', 'opinionstage_init');
98
  }
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
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.8 =
166
  * readme changes
167
  * add admin loader
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.9
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.9 =
166
+ * add support for new editor Gutenberg
167
  = 19.6.8 =
168
  * readme changes
169
  * add admin loader