Call Now Button - Version 1.2.0

Version Description

  • Added an onboarding guide for new Cloud users (Cloud)
  • Option to use images/photos on buttons (PRO)
  • Create slide-out windows with iframes (Cloud)
  • 3rd party integrations with Intercom and Tally (Cloud)
  • Fix for WordPress version 4.9
  • Small UI improvements
Download this release

Release Info

Developer jasperroel
Plugin Icon 128x128 Call Now Button
Version 1.2.0
Comparing to
See all releases

Code changes from version 1.1.14 to 1.2.0

Files changed (57) hide show
  1. call-now-button.php +3 -3
  2. readme.txt +10 -2
  3. resources/images/discount.png +0 -0
  4. resources/images/onboarding/action-extra-options.png +0 -0
  5. resources/images/onboarding/action-scheduling.png +0 -0
  6. resources/images/onboarding/actions-overview.png +0 -0
  7. resources/images/onboarding/add-action.png +0 -0
  8. resources/images/onboarding/add-display-rule.png +0 -0
  9. resources/images/onboarding/button-presenation.png +0 -0
  10. resources/images/onboarding/buttons-overview.png +0 -0
  11. resources/images/onboarding/nav-position.png +0 -0
  12. resources/images/onboarding/new-button.png +0 -0
  13. resources/images/onboarding/preview.png +0 -0
  14. resources/images/onboarding/visibility-settings.png +0 -0
  15. resources/images/support.png +0 -0
  16. resources/js/action-edit-fields.js +260 -0
  17. resources/js/action-edit.js +32 -7
  18. resources/js/action-type-to-icon-text.js +23 -20
  19. resources/js/call-now-button.js +4 -197
  20. resources/js/deactivation.js +0 -42
  21. resources/js/domain-upgrade.js +46 -12
  22. resources/style/call-now-button.css +133 -23
  23. src/CallNowButton.php +6 -18
  24. src/admin/CnbAdminAjax.php +1 -1
  25. src/admin/action/CnbActionViewEdit.php +101 -398
  26. src/admin/action/partials/class-action-email-settings.php +71 -0
  27. src/admin/action/partials/class-action-iframe-settings.php +214 -0
  28. src/admin/action/partials/class-action-intercom-settings.php +75 -0
  29. src/admin/action/partials/class-action-link-settings.php +63 -0
  30. src/admin/action/partials/class-action-map-settings.php +41 -0
  31. src/admin/action/partials/class-action-sms-settings.php +46 -0
  32. src/admin/action/partials/class-action-tally-settings.php +115 -0
  33. src/admin/action/partials/class-action-whatsapp-settings.php +137 -0
  34. src/admin/api/CnbAppRemoteCoupons.php +22 -0
  35. src/admin/api/CnbAppRemotePayment.php +0 -6
  36. src/admin/button/CnbButtonView.php +40 -18
  37. src/admin/button/CnbButtonViewEdit.php +30 -12
  38. src/admin/condition/CnbConditionViewEdit.php +23 -0
  39. src/admin/deactivation/Activation.php +4 -1
  40. src/admin/deactivation/Deactivation.php +1 -11
  41. src/admin/domain/CnbDomainViewEdit.php +4 -4
  42. src/admin/domain/CnbDomainViewUpgrade.php +2 -0
  43. src/admin/domain/partials/CnbDomainViewUpgradeFinished.php +70 -21
  44. src/admin/domain/partials/CnbDomainViewUpgradeOverview.php +60 -117
  45. src/admin/getting-started/class-getting-started-view.php +21 -7
  46. src/admin/legacy/CnbLegacyEdit.php +2 -3
  47. src/admin/legacy/CnbLegacyUpgrade.php +1 -1
  48. src/admin/partials/CnbHeaderNotices.php +1 -0
  49. src/admin/settings/CnbApiKeyActivatedView.php +67 -3
  50. src/admin/settings/CnbSettingsController.php +1 -1
  51. src/admin/settings/CnbSettingsViewEdit.php +66 -24
  52. src/autoload.php +11 -0
  53. src/coupons/class-cnb-promotion-code-restrictions.php +42 -0
  54. src/coupons/class-cnb-promotion-code.php +172 -0
  55. src/utils/CnbAdminFunctions.php +15 -15
  56. src/utils/CnbUtils.php +13 -26
  57. src/utils/cnb-backwards-compatible.php +24 -0
call-now-button.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Call Now Button
4
  Plugin URI: https://callnowbutton.com
5
  Description: Mobile visitors will see a <strong>Call Now Button</strong> on your website. Easy to use but flexible to meet more demanding requirements. Change placement and color, hide on specific pages, track how many people click them or conversions of your Google Ads campaigns. It's all optional but possible.
6
- Version: 1.1.14
7
  Author: Jerry & Jasper
8
  Author URI: https://www.callnowbutton.com
9
  GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
@@ -26,7 +26,7 @@ License: GPL2
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
29
- define('CNB_VERSION', '1.1.14');
30
  define('CNB_NAME', 'Call Now Button');
31
  define('CNB_BASENAME', plugin_basename(__FILE__));
32
  define('CNB_BASEFOLDER', plugin_basename(dirname(__FILE__)));
@@ -37,6 +37,6 @@ define('CNB_APP', 'https://app.callnowbutton.com/');
37
  define('CNB_SLUG', sanitize_title(CNB_NAME));
38
 
39
  register_activation_hook(__FILE__, array('cnb\admin\deactivation\Activation', 'onActivation'));
40
- register_deactivation_hook( __FILE__, array('cnb\admin\deactivation\Deactivation', 'onDeactivation') );
41
 
42
  require_once dirname( __FILE__ ) . '/src/call-now-button.php';
3
  Plugin Name: Call Now Button
4
  Plugin URI: https://callnowbutton.com
5
  Description: Mobile visitors will see a <strong>Call Now Button</strong> on your website. Easy to use but flexible to meet more demanding requirements. Change placement and color, hide on specific pages, track how many people click them or conversions of your Google Ads campaigns. It's all optional but possible.
6
+ Version: 1.2.0
7
  Author: Jerry & Jasper
8
  Author URI: https://www.callnowbutton.com
9
  GitHub Plugin URI: https://github.com/callnowbutton/wp-plugin
26
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
  */
28
 
29
+ define('CNB_VERSION', '1.2.0');
30
  define('CNB_NAME', 'Call Now Button');
31
  define('CNB_BASENAME', plugin_basename(__FILE__));
32
  define('CNB_BASEFOLDER', plugin_basename(dirname(__FILE__)));
37
  define('CNB_SLUG', sanitize_title(CNB_NAME));
38
 
39
  register_activation_hook(__FILE__, array('cnb\admin\deactivation\Activation', 'onActivation'));
40
+ register_deactivation_hook( __FILE__, array('cnb\admin\deactivation\Deactivation', 'on_deactivation') );
41
 
42
  require_once dirname( __FILE__ ) . '/src/call-now-button.php';
readme.txt CHANGED
@@ -2,10 +2,10 @@
2
  Contributors: jgrietveld, jasperroel
3
  Donate link: https://callnowbutton.com/donate/
4
  Tags: call button, click to call, convert, call now button, contact button
5
- Requires at least: 3.9
6
  Requires PHP: 5.4
7
  Tested up to: 6.0
8
- Stable tag: 1.1.14
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -111,6 +111,14 @@ Yes, you can upgrade to Premium to enable tons of extra features. Checkout [call
111
 
112
 
113
  == Changelog ==
 
 
 
 
 
 
 
 
114
  = 1.1.14 =
115
  * New buttons active by default (Cloud)
116
  * Visible on all screens is default (Cloud)
2
  Contributors: jgrietveld, jasperroel
3
  Donate link: https://callnowbutton.com/donate/
4
  Tags: call button, click to call, convert, call now button, contact button
5
+ Requires at least: 4.1
6
  Requires PHP: 5.4
7
  Tested up to: 6.0
8
+ Stable tag: 1.2.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
111
 
112
 
113
  == Changelog ==
114
+ = 1.2.0 =
115
+ * Added an onboarding guide for new Cloud users (Cloud)
116
+ * Option to use images/photos on buttons (PRO)
117
+ * Create slide-out windows with iframes (Cloud)
118
+ * 3rd party integrations with Intercom and Tally (Cloud)
119
+ * Fix for WordPress version 4.9
120
+ * Small UI improvements
121
+
122
  = 1.1.14 =
123
  * New buttons active by default (Cloud)
124
  * Visible on all screens is default (Cloud)
resources/images/discount.png ADDED
Binary file
resources/images/onboarding/action-extra-options.png ADDED
Binary file
resources/images/onboarding/action-scheduling.png ADDED
Binary file
resources/images/onboarding/actions-overview.png ADDED
Binary file
resources/images/onboarding/add-action.png ADDED
Binary file
resources/images/onboarding/add-display-rule.png ADDED
Binary file
resources/images/onboarding/button-presenation.png ADDED
Binary file
resources/images/onboarding/buttons-overview.png ADDED
Binary file
resources/images/onboarding/nav-position.png ADDED
Binary file
resources/images/onboarding/new-button.png ADDED
Binary file
resources/images/onboarding/preview.png ADDED
Binary file
resources/images/onboarding/visibility-settings.png ADDED
Binary file
resources/images/support.png ADDED
Binary file
resources/js/action-edit-fields.js ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function cnb_action_appearance() {
2
+ jQuery('#cnb_action_type').on('change', function (obj) {
3
+ cnb_action_update_appearance(obj.target.value)
4
+ })
5
+
6
+ // Setup WHATSAPP integration
7
+ const input = document.querySelector("#cnb_action_value_input_whatsapp")
8
+ if (!input || !window.intlTelInput) {
9
+ return
10
+ }
11
+
12
+ const iti = window.intlTelInput(input, {
13
+ utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.12/js/utils.min.js',
14
+ nationalMode: false,
15
+ separateDialCode: true,
16
+ hiddenInput: 'actionValueWhatsappHidden'
17
+ })
18
+
19
+ // here, the index maps to the error code returned from getValidationError - see readme
20
+ const errorMap = [
21
+ 'Invalid number',
22
+ 'Invalid country code',
23
+ 'Too short',
24
+ 'Too long',
25
+ 'Invalid number']
26
+
27
+ const errorMsg = jQuery('#cnb-error-msg')
28
+ const validMsg = jQuery('#cnb-valid-msg')
29
+
30
+ const reset = function() {
31
+ input.classList.remove('error')
32
+ errorMsg.html('')
33
+ errorMsg.hide()
34
+ validMsg.hide()
35
+ }
36
+
37
+ const onBlur = function() {
38
+ reset()
39
+ if (input.value.trim()) {
40
+ if (iti.isValidNumber()) {
41
+ validMsg.show()
42
+ } else {
43
+ const errorCode = iti.getValidationError()
44
+ if (errorCode < 0) {
45
+ // Unknown error, ignore for now
46
+ return
47
+ }
48
+ input.classList.add('error')
49
+ errorMsg.text(errorMap[errorCode])
50
+ errorMsg.show()
51
+ }
52
+ } else {
53
+ // Empty
54
+ reset()
55
+ }
56
+ }
57
+
58
+ // on blur: validate
59
+ input.addEventListener('blur', onBlur)
60
+
61
+ // on keyup / change flag: reset
62
+ input.addEventListener('change', onBlur)
63
+ input.addEventListener('keyup', onBlur)
64
+
65
+ // init
66
+ onBlur()
67
+ }
68
+
69
+ function cnb_action_update_appearance(value) {
70
+ const emailEle = jQuery('.cnb-action-properties-email')
71
+ const emailExtraEle = jQuery('.cnb-action-properties-email-extra')
72
+ const linkEle = jQuery('.cnb-action-properties-link')
73
+ const whatsappEle = jQuery('.cnb-action-properties-whatsapp')
74
+ const whatsappExtraEle = jQuery('.cnb-action-properties-whatsapp-extra')
75
+ const signalEle = jQuery('.cnb-action-properties-signal')
76
+ const smsEle = jQuery('.cnb-action-properties-sms')
77
+ const smsExtraEle = jQuery('.cnb-action-properties-sms-extra')
78
+ const mapEle = jQuery('.cnb-action-properties-map')
79
+ const iframeEle = jQuery('.cnb-action-properties-iframe')
80
+ const tallyEle = jQuery('.cnb-action-properties-tally')
81
+ const intercomEle = jQuery('.cnb-action-properties-intercom')
82
+
83
+ const valueEle = jQuery('.cnb-action-value')
84
+ const valueTextEle = jQuery('#cnb_action_value_input')
85
+ const valuelabelEle = jQuery('#cnb_action_value')
86
+ const whatsappValueEle = jQuery('#cnb_action_value_input_whatsapp')
87
+ const intlInputLabel = jQuery('#cnb_action_value_input_intl_input')
88
+
89
+ const $all = emailEle
90
+ .add(emailExtraEle)
91
+ .add(linkEle)
92
+ .add(whatsappEle)
93
+ .add(whatsappExtraEle)
94
+ .add(signalEle)
95
+ .add(smsEle)
96
+ .add(smsExtraEle)
97
+ .add(mapEle)
98
+ .add(iframeEle)
99
+ .add(tallyEle)
100
+ .add(intercomEle)
101
+
102
+ $all.hide()
103
+
104
+ valueEle.show()
105
+ valueTextEle.prop( 'disabled', false )
106
+ whatsappValueEle.prop( 'disabled', true )
107
+
108
+ valueTextEle.removeAttr("required")
109
+ whatsappValueEle.removeAttr("required")
110
+
111
+ switch (value) {
112
+ case 'ANCHOR':
113
+ valuelabelEle.text('On-page anchor')
114
+ valueTextEle.attr("required", "required")
115
+ break
116
+ case 'EMAIL':
117
+ valuelabelEle.text('E-mail address')
118
+ valueTextEle.attr("required", "required")
119
+ emailEle.show()
120
+ break
121
+ case 'LINK':
122
+ valuelabelEle.text('Full URL')
123
+ valueTextEle.attr("required", "required")
124
+ linkEle.show()
125
+ break
126
+ case 'MAP':
127
+ valuelabelEle.text('Address')
128
+ valueTextEle.attr("required", "required")
129
+ mapEle.show()
130
+ break
131
+ case 'PHONE':
132
+ valuelabelEle.text('Phone number')
133
+ valueTextEle.attr("required", "required")
134
+ break
135
+ case 'SMS':
136
+ valuelabelEle.text('Phone number')
137
+ valueTextEle.attr("required", "required")
138
+ smsEle.show()
139
+ // SMS has a field conflict with WhatsApp, fix it
140
+ jQuery('#action-properties-message-whatsapp').attr('disabled', true)
141
+ jQuery('#action-properties-message-sms').attr('disabled', false)
142
+ break
143
+ case 'WHATSAPP':
144
+ valuelabelEle.text('WhatsApp number')
145
+ intlInputLabel.text('WhatsApp number')
146
+ valueEle.hide()
147
+ valueTextEle.prop( 'disabled', true )
148
+ whatsappValueEle.prop( 'disabled', false )
149
+ whatsappValueEle.attr("required", "required")
150
+ whatsappEle.show()
151
+
152
+ // WhatsApp has a field conflict with SMS, fix it
153
+ jQuery('#action-properties-message-whatsapp').attr('disabled', false)
154
+ jQuery('#action-properties-message-sms').attr('disabled', true)
155
+
156
+ // To ensure the modal properties are correct, fix them after revealing all
157
+ cnb_set_action_modal_fields()
158
+ break
159
+ case 'FACEBOOK':
160
+ case 'TELEGRAM':
161
+ valuelabelEle.text('Username')
162
+ valueTextEle.attr("required", "required")
163
+ break
164
+ case 'SIGNAL':
165
+ valuelabelEle.text('Signal number')
166
+ intlInputLabel.text('Signal number')
167
+ valueEle.hide()
168
+ valueTextEle.prop( 'disabled', true )
169
+ whatsappValueEle.prop( 'disabled', false )
170
+ whatsappValueEle.attr("required", "required")
171
+ signalEle.show()
172
+ break
173
+ case 'IFRAME':
174
+ valuelabelEle.text('Iframe URL')
175
+ valueTextEle.attr("required", "required")
176
+ iframeEle.show()
177
+ break
178
+ case 'TALLY':
179
+ valuelabelEle.text('Tally Form ID')
180
+ valueTextEle.attr("required", "required")
181
+ iframeEle.show()
182
+ tallyEle.show()
183
+ break
184
+ case 'INTERCOM':
185
+ valuelabelEle.text('Intercom App ID')
186
+ valueTextEle.attr("required", "required")
187
+ intercomEle.show()
188
+ break
189
+ default:
190
+ valuelabelEle.text('Action value')
191
+ valueTextEle.attr("required", "required")
192
+ }
193
+ cnb_clean_up_advanced_view()
194
+ }
195
+
196
+ function cnb_action_update_map_link(element) {
197
+ jQuery(element).prop("href", "https://maps.google.com?q=" + jQuery('#cnb_action_value_input').val())
198
+ }
199
+
200
+ function cnb_action_iframe_modal_height() {
201
+ const value = jQuery('#cnb-action-properties-modal-height-value')
202
+ const unit = jQuery('#cnb-action-properties-modal-height-unit')
203
+
204
+ const updateVal = () => {
205
+ let v = parseInt(value.val())
206
+ const u = unit.val() // "px" or "vh"
207
+
208
+ // px defaults
209
+ let min = 250
210
+ let max = 1500
211
+
212
+ // Update slider val
213
+ if (u === 'vh') {
214
+ min = 20
215
+ max = 100
216
+ }
217
+ value.attr('min', min)
218
+ value.attr('max', max)
219
+
220
+ if (v < min) {
221
+ v = min
222
+ }
223
+ if (v > max) {
224
+ v = max
225
+ }
226
+
227
+ // Update the slider left/right "helper" value
228
+ jQuery('#cnb-action-properties-modal-height-value-min').text(min)
229
+ jQuery('#cnb-action-properties-modal-height-value-max').text(max)
230
+
231
+ // Update the fields that hold the result
232
+ const result = v + u
233
+ jQuery('#cnb-action-properties-modal-height').val(result)
234
+ jQuery('.cnb-action-properties-modal-height-result').text(result)
235
+ }
236
+
237
+ value.on('change input', updateVal)
238
+ unit.on('change input', updateVal)
239
+
240
+ // Also run on render
241
+ updateVal()
242
+ }
243
+
244
+ function cnb_action_settings_section() {
245
+ jQuery(".cnb-settings-section-table").addClass("cnb-settings-section-collapsed")
246
+ jQuery(".cnb-settings-section-title").on('click', function() {
247
+ const section = jQuery(this).data("cnb-settings-block")
248
+ jQuery(this).find(".dashicons-arrow-right").toggleClass("cnb-rotate-90")
249
+ jQuery(".cnb-settings-section-" + section + " .cnb-settings-section-table").toggleClass("cnb-settings-section-collapsed")
250
+ // To ensure the modal properties are correct, fix them after revealing all
251
+ cnb_set_action_modal_fields()
252
+ });
253
+ }
254
+
255
+ jQuery( function() {
256
+ cnb_action_appearance()
257
+ cnb_action_update_appearance(jQuery('#cnb_action_type').val())
258
+ cnb_action_iframe_modal_height()
259
+ cnb_action_settings_section()
260
+ })
resources/js/action-edit.js CHANGED
@@ -3,22 +3,34 @@
3
  /**
4
  * This sets the various WhatsApp Modal fields to appear only when needed.
5
  *
6
- * When the
 
 
 
 
 
 
 
7
  */
8
  function cnb_set_action_modal_fields() {
9
  const ele = jQuery('#cnb-action-modal')
10
 
11
  // messageRow contains just the message (the non-modal message)
12
  const messageRow = jQuery("#action-properties-message-row")
13
- const messageEle = jQuery('#action-properties-message')
14
  const modalElements = jQuery('.cnb-action-properties-whatsapp-modal')
15
 
16
  const isVisible = ele.is(":visible")
17
- const isChecked = ele.prop('checked')
 
 
 
 
 
18
  if (!isVisible) {
19
  messageRow.hide()
20
  modalElements.hide()
21
- } else if (isChecked) {
22
  messageEle.attr('disabled', 'disabled')
23
  messageRow.hide()
24
  modalElements.show()
@@ -31,14 +43,13 @@ function cnb_set_action_modal_fields() {
31
 
32
  function cnb_clear_default_on_modal() {
33
  const ele = jQuery('#cnb-action-modal')
34
- ele.on('click', () => {
35
  cnb_set_action_modal_fields()
36
  })
37
  }
38
 
39
  function cnb_refresh_on_action_change() {
40
- const ele = jQuery('#cnb_action_type')
41
- ele.on('change', () => {
42
  cnb_set_action_modal_fields()
43
  })
44
  }
@@ -100,6 +111,19 @@ function cnb_init_image_select() {
100
  })
101
  }
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  jQuery(() => {
104
  // These 2 set up action handler to process changes on the form
105
  cnb_clear_default_on_modal()
@@ -110,4 +134,5 @@ jQuery(() => {
110
  // Set up the custom image property
111
  cnb_action_icon_background_image()
112
  cnb_init_image_select()
 
113
  })
3
  /**
4
  * This sets the various WhatsApp Modal fields to appear only when needed.
5
  *
6
+ * The reason this exists, is because we have fields that are not only part
7
+ * of a certain action_type, but are also dependent on properties within that
8
+ * action_type.
9
+ *
10
+ * It's not pretty or nicely built, but here we are :-).
11
+ *
12
+ * It helps to call this function anytime you update the state of the properties fields,
13
+ * to ensure that nested/dependent (modal) properties are properly shown/hidden.
14
  */
15
  function cnb_set_action_modal_fields() {
16
  const ele = jQuery('#cnb-action-modal')
17
 
18
  // messageRow contains just the message (the non-modal message)
19
  const messageRow = jQuery("#action-properties-message-row")
20
+ const messageEle = jQuery('#action-properties-message-whatsapp')
21
  const modalElements = jQuery('.cnb-action-properties-whatsapp-modal')
22
 
23
  const isVisible = ele.is(":visible")
24
+
25
+ let isModal = false
26
+ if(ele.val() === "popout") {
27
+ isModal = true
28
+ }
29
+
30
  if (!isVisible) {
31
  messageRow.hide()
32
  modalElements.hide()
33
+ } else if (isModal) {
34
  messageEle.attr('disabled', 'disabled')
35
  messageRow.hide()
36
  modalElements.show()
43
 
44
  function cnb_clear_default_on_modal() {
45
  const ele = jQuery('#cnb-action-modal')
46
+ ele.on('click change', () => {
47
  cnb_set_action_modal_fields()
48
  })
49
  }
50
 
51
  function cnb_refresh_on_action_change() {
52
+ jQuery('#cnb_action_type').on('change', () => {
 
53
  cnb_set_action_modal_fields()
54
  })
55
  }
111
  })
112
  }
113
 
114
+ function cnb_set_whatsapp_title_placeholder() {
115
+ const labelValue = jQuery('#buttonTextField').val()
116
+ jQuery("#actionWhatsappTitle").attr('placeholder',labelValue)
117
+ }
118
+
119
+ function cnb_update_whatsapp_title_placeholder() {
120
+ const ele = jQuery('#buttonTextField')
121
+ ele.on('input change click', function() {
122
+ cnb_set_whatsapp_title_placeholder()
123
+ })
124
+ cnb_set_whatsapp_title_placeholder()
125
+ }
126
+
127
  jQuery(() => {
128
  // These 2 set up action handler to process changes on the form
129
  cnb_clear_default_on_modal()
134
  // Set up the custom image property
135
  cnb_action_icon_background_image()
136
  cnb_init_image_select()
137
+ cnb_update_whatsapp_title_placeholder()
138
  })
resources/js/action-type-to-icon-text.js CHANGED
@@ -3,28 +3,28 @@
3
  *
4
  * This should have the same content as the PHP function cnb_actiontype_to_icontext
5
  *
6
- * @param {string} actionType
7
  *
8
  * @returns {string} the default iconText for the given action
9
  */
10
- function cnbActiontypeToIcontext(actionType) {
11
- switch (actionType) {
12
- case 'ANCHOR': return 'anchor'
13
- case 'EMAIL': return 'email'
14
- case 'HOURS': return 'access_time'
15
- case 'LINK': return 'link'
16
- case 'MAP': return 'directions'
17
- case 'PHONE': return 'call'
18
- case 'SMS': return 'chat'
19
- case 'WHATSAPP': return 'whatsapp'
20
- case 'FACEBOOK': return 'facebook_messenger'
21
- case 'SIGNAL': return 'signal'
22
- case 'TELEGRAM': return 'telegram'
23
- case 'IFRAME': return 'link4'
24
- case 'TALLY': return 'support'
25
- case 'INTERCOM': return 'call3'
26
  default:
27
- return 'call'
28
  }
29
  }
30
 
@@ -53,9 +53,12 @@ function cnb_change_icon_text(ele) {
53
  const cnb_action_icon_type = jQuery('#' + findIcontypeEle)
54
  cnb_action_icon_type.val(jQuery(ele).data('icon-type'))
55
 
56
- // Force an update to the preview
57
  // Since the open icon changed, ensure it is CLOSED now (so you can see the change)
58
- cnb_trigger_rerender(cnb_action_icon_text, true)
 
 
 
 
59
  } else {
60
  // Maybe it's the button-edit multibutton options
61
  // If so, get the parent and find if the 2 data attributes are set
3
  *
4
  * This should have the same content as the PHP function cnb_actiontype_to_icontext
5
  *
6
+ * @param {string} $actionType
7
  *
8
  * @returns {string} the default iconText for the given action
9
  */
10
+ function cnbActiontypeToIcontext($actionType) {
11
+ switch ( $actionType ) {
12
+ case 'ANCHOR': return 'anchor';
13
+ case 'EMAIL': return 'email';
14
+ case 'HOURS': return 'access_time';
15
+ case 'LINK': return 'link';
16
+ case 'MAP': return 'directions';
17
+ case 'SMS': return 'chat';
18
+ case 'WHATSAPP': return 'whatsapp';
19
+ case 'FACEBOOK': return 'facebook_messenger';
20
+ case 'SIGNAL': return 'signal';
21
+ case 'TELEGRAM': return 'telegram';
22
+ case 'IFRAME': return 'open_modal';
23
+ case 'TALLY': return 'call3';
24
+ case 'INTERCOM': return 'intercom';
25
+ case 'PHONE':
26
  default:
27
+ return 'call';
28
  }
29
  }
30
 
53
  const cnb_action_icon_type = jQuery('#' + findIcontypeEle)
54
  cnb_action_icon_type.val(jQuery(ele).data('icon-type'))
55
 
 
56
  // Since the open icon changed, ensure it is CLOSED now (so you can see the change)
57
+ // Only trigger this if the source is the BUTTON main icon, not an ACTION icon
58
+ const doNotExpand = findIcontextEle.includes("button-")
59
+
60
+ // Force an update to the preview
61
+ cnb_trigger_rerender(cnb_action_icon_text, doNotExpand)
62
  } else {
63
  // Maybe it's the button-edit multibutton options
64
  // If so, get the parent and find if the 2 data attributes are set
resources/js/call-now-button.js CHANGED
@@ -61,13 +61,13 @@ function cnb_hide_on_show_always() {
61
  if (show_always_checkbox) {
62
  if (show_always_checkbox.checked) {
63
  // Hide all items specific for Scheduler
64
- jQuery('.cnb_hide_on_show_always').hide()
65
 
66
  // Hide Domain Timezone notice
67
  jQuery('.cnb-notice-domain-timezone-unsupported').parent('.notice').hide()
68
  } else {
69
  // Show all items specific for Scheduler
70
- jQuery('.cnb_hide_on_show_always').show()
71
 
72
  // Show Domain Timezone notice (and move to the correct place)
73
  const domainTimezoneNotice = jQuery('.cnb-notice-domain-timezone-unsupported').parent('.notice')
@@ -124,199 +124,6 @@ function cnb_setup_toggle_label_clicks() {
124
  })
125
  }
126
 
127
- function cnb_action_appearance() {
128
- jQuery('#cnb_action_type').on('change', function (obj) {
129
- cnb_action_update_appearance(obj.target.value)
130
- })
131
-
132
- // Setup WHATSAPP integration
133
- const input = document.querySelector("#cnb_action_value_input_whatsapp")
134
- if (!input || !window.intlTelInput) {
135
- return
136
- }
137
-
138
- const iti = window.intlTelInput(input, {
139
- utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.12/js/utils.min.js',
140
- nationalMode: false,
141
- separateDialCode: true,
142
- hiddenInput: 'actionValueWhatsappHidden'
143
- })
144
-
145
- // here, the index maps to the error code returned from getValidationError - see readme
146
- const errorMap = [
147
- 'Invalid number',
148
- 'Invalid country code',
149
- 'Too short',
150
- 'Too long',
151
- 'Invalid number']
152
-
153
- const errorMsg = jQuery('#cnb-error-msg')
154
- const validMsg = jQuery('#cnb-valid-msg')
155
-
156
- const reset = function() {
157
- input.classList.remove('error')
158
- errorMsg.html('')
159
- errorMsg.hide()
160
- validMsg.hide()
161
- }
162
-
163
- const onBlur = function() {
164
- reset()
165
- if (input.value.trim()) {
166
- if (iti.isValidNumber()) {
167
- validMsg.show()
168
- } else {
169
- const errorCode = iti.getValidationError()
170
- if (errorCode < 0) {
171
- // Unknown error, ignore for now
172
- return
173
- }
174
- input.classList.add('error')
175
- errorMsg.text(errorMap[errorCode])
176
- errorMsg.show()
177
- }
178
- } else {
179
- // Empty
180
- reset()
181
- }
182
- }
183
-
184
- // on blur: validate
185
- input.addEventListener('blur', onBlur)
186
-
187
- // on keyup / change flag: reset
188
- input.addEventListener('change', onBlur)
189
- input.addEventListener('keyup', onBlur)
190
-
191
- // init
192
- onBlur()
193
- }
194
-
195
- function cnb_action_update_appearance(value) {
196
- const emailEle = jQuery('.cnb-action-properties-email')
197
- const linkEle = jQuery('.cnb-action-properties-link')
198
- const emailExtraEle = jQuery('.cnb-action-properties-email-extra')
199
- const whatsappEle = jQuery('.cnb-action-properties-whatsapp')
200
- const signalEle = jQuery('.cnb-action-properties-signal')
201
- const whatsappExtraEle = jQuery('.cnb-action-properties-whatsapp-extra')
202
- const smsEle = jQuery('.cnb-action-properties-sms')
203
- const smsExtraEle = jQuery('.cnb-action-properties-sms-extra')
204
- const iframeEle = jQuery('.cnb-action-properties-iframe')
205
- const tallyEle = jQuery('.cnb-action-properties-tally')
206
- const intercomEle = jQuery('.cnb-action-properties-intercom')
207
-
208
- const propertiesEle = jQuery('.cnb-action-properties-map')
209
- const valueEle = jQuery('.cnb-action-value')
210
- const valueTextEle = jQuery('#cnb_action_value_input')
211
- const valuelabelEle = jQuery('#cnb_action_value')
212
- const whatsappValueEle = jQuery('#cnb_action_value_input_whatsapp')
213
- const intlInputLabel = jQuery('#cnb_action_value_input_intl_input')
214
-
215
- emailEle.hide()
216
- emailExtraEle.hide()
217
- whatsappEle.hide()
218
- signalEle.hide()
219
- whatsappExtraEle.hide()
220
- smsEle.hide()
221
- smsExtraEle.hide()
222
- propertiesEle.hide()
223
- linkEle.hide()
224
- iframeEle.hide()
225
- tallyEle.hide()
226
- intercomEle.hide()
227
-
228
- valueEle.show()
229
- valueTextEle.prop( 'disabled', false )
230
- whatsappValueEle.prop( 'disabled', true )
231
-
232
- valueTextEle.removeAttr("required")
233
- whatsappValueEle.removeAttr("required")
234
-
235
- switch (value) {
236
- case 'ANCHOR':
237
- valuelabelEle.text('On-page anchor')
238
- valueTextEle.attr("required", "required")
239
- break
240
- case 'EMAIL':
241
- valuelabelEle.text('E-mail address')
242
- valueTextEle.attr("required", "required")
243
- emailEle.show()
244
- break
245
- case 'LINK':
246
- valuelabelEle.text('Full URL')
247
- valueTextEle.attr("required", "required")
248
- linkEle.show()
249
- break
250
- case 'MAP':
251
- valuelabelEle.text('Address')
252
- valueTextEle.attr("required", "required")
253
- propertiesEle.show()
254
- break
255
- case 'PHONE':
256
- valuelabelEle.text('Phone number')
257
- valueTextEle.attr("required", "required")
258
- break
259
- case 'SMS':
260
- valuelabelEle.text('Phone number')
261
- valueTextEle.attr("required", "required")
262
- smsEle.show()
263
- break
264
- case 'WHATSAPP':
265
- valuelabelEle.text('WhatsApp number')
266
- intlInputLabel.text('WhatsApp number')
267
- valueEle.hide()
268
- valueTextEle.prop( 'disabled', true )
269
- whatsappValueEle.prop( 'disabled', false )
270
- whatsappValueEle.attr("required", "required")
271
- whatsappEle.show()
272
- break
273
- case 'FACEBOOK':
274
- case 'TELEGRAM':
275
- valuelabelEle.text('Username')
276
- valueTextEle.attr("required", "required")
277
- break
278
- case 'SIGNAL':
279
- valuelabelEle.text('Signal number')
280
- intlInputLabel.text('Signal number')
281
- valueEle.hide()
282
- valueTextEle.prop( 'disabled', true )
283
- whatsappValueEle.prop( 'disabled', false )
284
- whatsappValueEle.attr("required", "required")
285
- signalEle.show()
286
- break
287
- case 'IFRAME':
288
- valuelabelEle.text('Iframe URL')
289
- valueTextEle.attr("required", "required")
290
- iframeEle.show()
291
- break
292
- case 'TALLY':
293
- valuelabelEle.text('Tally')
294
- valueTextEle.val('tally')
295
- valueEle.hide()
296
- valueTextEle.prop( 'disabled', true )
297
- valueTextEle.attr("required", "required")
298
- iframeEle.show()
299
- tallyEle.show()
300
- break
301
- case 'INTERCOM':
302
- valuelabelEle.text('Intercom')
303
- valueTextEle.val('intercom')
304
- valueEle.hide()
305
- valueTextEle.prop( 'disabled', true )
306
- valueTextEle.attr("required", "required")
307
- intercomEle.show()
308
- break
309
- default:
310
- valuelabelEle.text('Action value')
311
- valueTextEle.attr("required", "required")
312
- }
313
- cnb_clean_up_advanced_view()
314
- }
315
-
316
- function cnb_action_update_map_link(element) {
317
- jQuery(element).prop("href", "https://maps.google.com?q=" + jQuery('#cnb_action_value_input').val())
318
- }
319
-
320
  function cnb_hide_edit_action_if_advanced() {
321
  const element = jQuery('#toplevel_page_call-now-button li.current a')
322
  if (element.text() === 'Edit action') {
@@ -447,6 +254,8 @@ function cnb_button_overview_modal() {
447
 
448
  jQuery("#cnb-button-overview-modal-add-new").on("click", function() {
449
  setTimeout(function () {
 
 
450
  jQuery("input[name='button[name]']").trigger("focus")
451
  })
452
  })
@@ -546,8 +355,6 @@ jQuery( function() {
546
  cnb_setup_placements()
547
  cnb_setup_sliders()
548
  cnb_hide_on_show_always()
549
- cnb_action_appearance()
550
- cnb_action_update_appearance(jQuery('#cnb_action_type').val())
551
  cnb_hide_edit_action_if_advanced()
552
  cnb_hide_edit_domain_upgrade_if_advanced()
553
  cnb_strip_beta_from_referrer()
61
  if (show_always_checkbox) {
62
  if (show_always_checkbox.checked) {
63
  // Hide all items specific for Scheduler
64
+ jQuery('.cnb_hide_on_show_always').addClass('cnb-settings-disabled')
65
 
66
  // Hide Domain Timezone notice
67
  jQuery('.cnb-notice-domain-timezone-unsupported').parent('.notice').hide()
68
  } else {
69
  // Show all items specific for Scheduler
70
+ jQuery('.cnb_hide_on_show_always').removeClass('cnb-settings-disabled')
71
 
72
  // Show Domain Timezone notice (and move to the correct place)
73
  const domainTimezoneNotice = jQuery('.cnb-notice-domain-timezone-unsupported').parent('.notice')
124
  })
125
  }
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  function cnb_hide_edit_action_if_advanced() {
128
  const element = jQuery('#toplevel_page_call-now-button li.current a')
129
  if (element.text() === 'Edit action') {
254
 
255
  jQuery("#cnb-button-overview-modal-add-new").on("click", function() {
256
  setTimeout(function () {
257
+ // Ensure that the hidden value input is not required
258
+ jQuery('#cnb_action_value_input').removeAttr('required')
259
  jQuery("input[name='button[name]']").trigger("focus")
260
  })
261
  })
355
  cnb_setup_placements()
356
  cnb_setup_sliders()
357
  cnb_hide_on_show_always()
 
 
358
  cnb_hide_edit_action_if_advanced()
359
  cnb_hide_edit_domain_upgrade_if_advanced()
360
  cnb_strip_beta_from_referrer()
resources/js/deactivation.js DELETED
@@ -1,42 +0,0 @@
1
- function cnb_add_deactivation_init() {
2
- cnb_add_deactivation_popup_tally()
3
- }
4
-
5
- /**
6
- * Called when the Call Now Button plugin's "Deactivate" link is clicked
7
- */
8
- function cnb_add_deactivation_popup_tally() {
9
- const cnb_tally_deactivate_plugin_form_id = 'waQ6eb'
10
- const original_link = jQuery('#deactivate-call-now-button')
11
- original_link.on('click', (event) => {
12
-
13
- const options = {
14
- layout: 'modal',
15
- width: 450,
16
- hideTitle: 1,
17
- emoji: {
18
- text: '😮',
19
- animation: 'none'
20
- },
21
- hiddenFields: {
22
- wordPressUrl: window.location.href,
23
- activationTime: cnb_plugin_data.activation_time,
24
- },
25
- onClose: () => window.location = event.target.href,
26
- onSubmit: () => {
27
- setTimeout(() => {
28
- window.location = event.target.href
29
- }, 7000)
30
- },
31
- }
32
- // Check if Tally actually is loaded
33
- if (Tally) {
34
- event.preventDefault()
35
- Tally.openPopup(cnb_tally_deactivate_plugin_form_id, options)
36
- }
37
- })
38
- }
39
-
40
- jQuery(() => {
41
- cnb_add_deactivation_init()
42
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
resources/js/domain-upgrade.js CHANGED
@@ -6,7 +6,7 @@ function cnb_domain_upgrade_hide_notice() {
6
  }
7
  }
8
 
9
- function cnb_stripe_show_message(type='success', message='') {
10
  const cnb_notice = jQuery('.cnb-message');
11
 
12
  cnb_notice.hide();
@@ -20,7 +20,7 @@ function cnb_stripe_show_message(type='success', message='') {
20
  * function for the currency selector on the Upgrade page
21
  */
22
  function cnb_domain_upgrade_currency() {
23
- jQuery(".cnb-currency-select").on('click', function(){
24
  jQuery(".cnb-currency-select").removeClass('nav-tab-active');
25
  jQuery(".currency-box").removeClass('currency-box-active');
26
  jQuery(this).addClass("nav-tab-active");
@@ -45,7 +45,7 @@ function cnb_get_checkout(planId) {
45
  'domainId': jQuery('#cnb_domain_id').val()
46
  };
47
 
48
- jQuery.post(ajaxurl, data, function(response) {
49
  cnb_goto_checkout(response)
50
  });
51
  }
@@ -55,17 +55,51 @@ function cnb_get_checkout(planId) {
55
  * @param response
56
  */
57
  function cnb_goto_checkout(response) {
58
- if (typeof stripe === 'undefined') {
59
- cnb_stripe_show_message('warning', 'Using alternate provider...');
60
- location.href = 'https://www.callnowbutton.com/stripe.html?s=' + response.message;
61
- }else if (response.status === 'success') {
62
  cnb_stripe_show_message('success', 'Redirecting you...')
63
- stripe.redirectToCheckout({sessionId: response.message});
64
- }else if (response.status === 'error') {
65
  cnb_stripe_show_message('warning', response.message)
66
  }
67
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  jQuery(function () {
69
- cnb_domain_upgrade_hide_notice();
70
- cnb_domain_upgrade_currency();
71
- });
 
6
  }
7
  }
8
 
9
+ function cnb_stripe_show_message(type = 'success', message = '') {
10
  const cnb_notice = jQuery('.cnb-message');
11
 
12
  cnb_notice.hide();
20
  * function for the currency selector on the Upgrade page
21
  */
22
  function cnb_domain_upgrade_currency() {
23
+ jQuery(".cnb-currency-select").on('click', function () {
24
  jQuery(".cnb-currency-select").removeClass('nav-tab-active');
25
  jQuery(".currency-box").removeClass('currency-box-active');
26
  jQuery(this).addClass("nav-tab-active");
45
  'domainId': jQuery('#cnb_domain_id').val()
46
  };
47
 
48
+ jQuery.post(ajaxurl, data, function (response) {
49
  cnb_goto_checkout(response)
50
  });
51
  }
55
  * @param response
56
  */
57
  function cnb_goto_checkout(response) {
58
+ if (response.status === 'success') {
 
 
 
59
  cnb_stripe_show_message('success', 'Redirecting you...')
60
+ location.href = response.url
61
+ } else if (response.status === 'error') {
62
  cnb_stripe_show_message('warning', response.message)
63
  }
64
  }
65
+
66
+ /**
67
+ * Countdown timer to be used with coupon codes
68
+ */
69
+ function cnb_countdown_timer() {
70
+ const ele = jQuery("#cnb-coupon-expiration-countdown")
71
+ const countDownDate = ele.data("coupon-expiration-time") * 1000;
72
+ if (!countDownDate) return
73
+
74
+ const countDownInterval = setInterval(function () {
75
+ const now = new Date().getTime();
76
+ const distance = countDownDate - now;
77
+
78
+ const days = Math.floor(distance / (1000 * 60 * 60 * 24));
79
+ const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)).toLocaleString('en-US', {
80
+ minimumIntegerDigits: 2,
81
+ useGrouping: false
82
+ });
83
+ const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)).toLocaleString('en-US', {
84
+ minimumIntegerDigits: 2,
85
+ useGrouping: false
86
+ });
87
+ const seconds = Math.floor((distance % (1000 * 60)) / 1000).toLocaleString('en-US', {
88
+ minimumIntegerDigits: 2,
89
+ useGrouping: false
90
+ });
91
+
92
+ ele.text("Coupon expires in " + days + "d " + hours + "h " + minutes + "m " + seconds + "s ")
93
+
94
+ if (distance < 0) {
95
+ clearInterval(countDownInterval)
96
+ ele.parent().remove()
97
+ }
98
+ }, 1000);
99
+ }
100
+
101
  jQuery(function () {
102
+ cnb_domain_upgrade_hide_notice()
103
+ cnb_domain_upgrade_currency()
104
+ cnb_countdown_timer()
105
+ });
resources/style/call-now-button.css CHANGED
@@ -53,7 +53,10 @@ Universal CNB admin styling options
53
  padding-top: 0;
54
  }
55
  .top-50 {
56
- margin-top:50px;
 
 
 
57
  }
58
  .bottom-0 {
59
  margin-bottom: 0;
@@ -119,7 +122,9 @@ Other styling
119
  #post-body .cnb-side-checkbox:before {
120
  content: "\f147"; /* \f147 = yes (since 4.1), \f12a = yes-alt (since 5.2), \f15e = saved (since 5.5) */
121
  }
122
-
 
 
123
  .form-table td p.description,
124
  .inline-helper,
125
  label.small-italic {
@@ -188,6 +193,12 @@ table.form-table.nav-tab-only {
188
  .cnb-center {
189
  text-align: center;
190
  }
 
 
 
 
 
 
191
  .cnb-container input[type="radio"] + label {
192
  font-weight: 300;
193
  }
@@ -300,8 +311,8 @@ input[type='range'] {
300
  margin-right: 4px;
301
  }
302
  .cnb-plan-features {
303
- max-width: 1264px;
304
- margin-left: auto;
305
  margin-right: auto;
306
  }
307
  .cnb-pricing, .cnb-pricing td {
@@ -333,27 +344,44 @@ input[type='range'] {
333
  flex: 1 1 0;
334
  }
335
  /* Pricing page */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  .cnb-price-plans {
337
  max-width:1000px;
338
  margin: 0 auto 50px;
339
  }
340
- .cnb-price-plans .pricebox {
341
  text-align:center;
342
  padding:10px;
343
  margin:10px;
 
344
  }
345
- .cnb-price-plans .pricebox h3 {
346
  border-bottom:2px solid #ccc;
347
  margin-bottom:0.5em;
348
  padding-bottom:0.5em
349
  }
350
- .cnb-price-plans .pricebox .benefit {
351
- padding-bottom: 1em;
352
- }
353
- .cnb-price-plans .pricebox h3.yearly {
354
- border-bottom:2px solid #71B123;
355
  }
356
- .cnb-price-plans .pricebox h3.monthly {
357
  border-bottom:2px solid #B12371;
358
  }
359
  .cnb-price-plans .plan-amount {
@@ -367,7 +395,6 @@ input[type='range'] {
367
  .cnb-price-plans .timeframe {
368
  margin: 20px 0;
369
  color:#6c6c6c;
370
- font-size:80%;
371
  font-weight: normal;
372
  }
373
  .cnb-price-plans .currency {
@@ -375,11 +402,11 @@ input[type='range'] {
375
  color:#444;
376
  font-weight: normal;
377
  }
378
- .cnb-price-plans .currency-box {
379
  display:none;
380
  }
381
- .cnb-price-plans .currency-box.currency-box-active {
382
- display: flex;
383
  }
384
 
385
  .only-big-screens {
@@ -400,12 +427,16 @@ input[type='range'] {
400
  }
401
  @media screen and (min-width:600px) {
402
  .cnb-plan-features ul:first-child {
403
- max-width:130px;
 
 
 
 
404
  }
405
  }
406
  @media screen and (min-width:1100px) {
407
  .cnb-plan-features ul:first-child {
408
- max-width:20%;
409
  }
410
  .only-big-screens {
411
  display: inline;
@@ -451,7 +482,7 @@ input[type='range'] {
451
  margin-top:5px
452
  }
453
  @media screen and (max-width: 782px) {
454
- .pricebox.cnb-premium-free,
455
  .cnb-premium-label {
456
  display: none;
457
  }
@@ -631,7 +662,7 @@ input[type=checkbox].cnb_day_selector:checked + label.cnb_day_selector {
631
  color:#B12371;
632
  }
633
  .cnb-green {
634
- color:#71B123;
635
  }
636
  .cnb-promobox .cnb-promobox-header {
637
  display: flex;
@@ -655,11 +686,19 @@ input[type=checkbox].cnb_day_selector:checked + label.cnb_day_selector {
655
  color: #fff;
656
  }
657
  .cnb-promobox .cnb-promobox-header-green {
658
- background-color: #71B123;
659
- border: 1px solid #71B123;
660
  color: #fff;
661
  }
662
-
 
 
 
 
 
 
 
 
663
  .cnb-promobox .cnb-promobox-header .dashicons {
664
  margin-left: 12px;
665
  }
@@ -1183,6 +1222,9 @@ span.cnb_check_email_message {
1183
  .cnb-button-icon i {
1184
  cursor: pointer;
1185
  }
 
 
 
1186
  .icon-text-options:after {
1187
  content: '';
1188
  display: block;
@@ -1350,3 +1392,71 @@ span.cnb-pro-badge {
1350
  .cnb_disabled_feature th {
1351
  color:rgba(29,35,39,0.5);
1352
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  padding-top: 0;
54
  }
55
  .top-50 {
56
+ margin-top:50px !important;
57
+ }
58
+ .bottom-50 {
59
+ margin-bottom:50px !important;
60
  }
61
  .bottom-0 {
62
  margin-bottom: 0;
122
  #post-body .cnb-side-checkbox:before {
123
  content: "\f147"; /* \f147 = yes (since 4.1), \f12a = yes-alt (since 5.2), \f15e = saved (since 5.5) */
124
  }
125
+ .form-table td p.description {
126
+ max-width:650px;
127
+ }
128
  .form-table td p.description,
129
  .inline-helper,
130
  label.small-italic {
193
  .cnb-center {
194
  text-align: center;
195
  }
196
+ .cnb-right {
197
+ text-align: right;
198
+ }
199
+ .cnb-left {
200
+ text-align: left;
201
+ }
202
  .cnb-container input[type="radio"] + label {
203
  font-weight: 300;
204
  }
311
  margin-right: 4px;
312
  }
313
  .cnb-plan-features {
314
+ max-width: 1000px;
315
+ margin-left:auto;
316
  margin-right: auto;
317
  }
318
  .cnb-pricing, .cnb-pricing td {
344
  flex: 1 1 0;
345
  }
346
  /* Pricing page */
347
+ h1.cnb-upgrade-title {
348
+ text-align: center;
349
+ font-size: xx-large;
350
+ font-weight: bold;
351
+ margin: 1em auto;
352
+ max-width: 1000px;
353
+ border-bottom:1px solid #c3c4c7;
354
+ }
355
+ .cnb-pricebox {
356
+ text-align: center;
357
+ }
358
+ .cnb-pricebox .cnb-benefit {
359
+ font-size: 18px;
360
+ padding-bottom: 1em;
361
+ }
362
+ .cnb-pricebox.cnb-smaller .cnb-benefit {
363
+ font-size: 16px;
364
+ }
365
  .cnb-price-plans {
366
  max-width:1000px;
367
  margin: 0 auto 50px;
368
  }
369
+ .cnb-price-plans .cnb-pricebox {
370
  text-align:center;
371
  padding:10px;
372
  margin:10px;
373
+ max-width: 650px
374
  }
375
+ .cnb-price-plans .cnb-pricebox h3 {
376
  border-bottom:2px solid #ccc;
377
  margin-bottom:0.5em;
378
  padding-bottom:0.5em
379
  }
380
+
381
+ .cnb-price-plans .cnb-pricebox h3.cnb-price-eur {
382
+ border-bottom:2px solid #00aa00;
 
 
383
  }
384
+ .cnb-price-plans .cnb-pricebox h3.cnb-price-usd {
385
  border-bottom:2px solid #B12371;
386
  }
387
  .cnb-price-plans .plan-amount {
395
  .cnb-price-plans .timeframe {
396
  margin: 20px 0;
397
  color:#6c6c6c;
 
398
  font-weight: normal;
399
  }
400
  .cnb-price-plans .currency {
402
  color:#444;
403
  font-weight: normal;
404
  }
405
+ .cnb-price-plans .cnb-currency-box {
406
  display:none;
407
  }
408
+ .cnb-price-plans .cnb-currency-box.currency-box-active {
409
+ display: block;
410
  }
411
 
412
  .only-big-screens {
427
  }
428
  @media screen and (min-width:600px) {
429
  .cnb-plan-features ul:first-child {
430
+ max-width:160px;
431
+ }
432
+ .cnb-plan-features ul:first-child,
433
+ .cnb-plan-features ul:nth-child(2) {
434
+ margin-right:5px;
435
  }
436
  }
437
  @media screen and (min-width:1100px) {
438
  .cnb-plan-features ul:first-child {
439
+ max-width:216px;
440
  }
441
  .only-big-screens {
442
  display: inline;
482
  margin-top:5px
483
  }
484
  @media screen and (max-width: 782px) {
485
+ .cnb-pricebox.cnb-premium-free,
486
  .cnb-premium-label {
487
  display: none;
488
  }
662
  color:#B12371;
663
  }
664
  .cnb-green {
665
+ color:#00aa00;
666
  }
667
  .cnb-promobox .cnb-promobox-header {
668
  display: flex;
686
  color: #fff;
687
  }
688
  .cnb-promobox .cnb-promobox-header-green {
689
+ background-color: #00aa00;
690
+ border: 1px solid #00aa00;
691
  color: #fff;
692
  }
693
+ .cnb-promobox.cnb-promobox-green .button-primary {
694
+ background: #00aa00;
695
+ border-color: #00aa00;
696
+ }
697
+ .cnb-promobox.cnb-promobox-green .button-primary:hover,
698
+ .cnb-promobox.cnb-promobox-green .button-primary:active {
699
+ background: #007600;
700
+ border-color: #007600;
701
+ }
702
  .cnb-promobox .cnb-promobox-header .dashicons {
703
  margin-left: 12px;
704
  }
1222
  .cnb-button-icon i {
1223
  cursor: pointer;
1224
  }
1225
+ .icon-text-options {
1226
+ max-width: 300px;
1227
+ }
1228
  .icon-text-options:after {
1229
  content: '';
1230
  display: block;
1392
  .cnb_disabled_feature th {
1393
  color:rgba(29,35,39,0.5);
1394
  }
1395
+ .cnb-settings-section-title {
1396
+ cursor: pointer;
1397
+ display: inline-block;
1398
+ }
1399
+ .cnb-settings-section-title .dashicons-arrow-right {
1400
+ transition-property: transform;
1401
+ }
1402
+ .cnb-rotate-90 {
1403
+ transform:rotate(90deg);
1404
+ }
1405
+ .cnb-rotate-180 {
1406
+ transform:rotate(180deg);
1407
+ }
1408
+ .cnb-rotate-270 {
1409
+ transform:rotate(270deg);
1410
+ }
1411
+ .cnb-settings-section-collapsed {
1412
+ display: none;
1413
+ }
1414
+ .cnb-settings-section-table {
1415
+ width: 100%;
1416
+ }
1417
+ .cnb-body-content form.cnb-container input[type=text] {
1418
+ width: 100%;
1419
+ max-width: 232px;
1420
+ }
1421
+
1422
+ .cnb-settings-section-table input[type=text] {
1423
+ width: 100%;
1424
+ max-width: 400px;
1425
+ }
1426
+ .cnb-settings-disabled {
1427
+ filter: grayscale(1);
1428
+ opacity:40%;
1429
+ }
1430
+ .cnb-promo-bar {
1431
+ background-color: #fff;
1432
+ text-align: center;
1433
+ align-items: center;
1434
+ box-shadow: 0 1px 1px rgb(0 0 0 / 10%);
1435
+ flex-direction: column;
1436
+ padding-bottom: 18px;
1437
+ }
1438
+ .cnb-coupon-details p {
1439
+ margin: 0;
1440
+ }
1441
+ .cnb-coupon-code {
1442
+ font-family: monospace;
1443
+ font-size: 15px;
1444
+ font-weight: bold;
1445
+ text-transform: uppercase;
1446
+ }
1447
+ .cnb-coupon-details h5 {
1448
+ margin: 5px;
1449
+ font-size: 16px;
1450
+ font-weight: 900;
1451
+ }
1452
+ .cnb_onboarding_guide {
1453
+ max-width: 750px;
1454
+ }
1455
+ .cnb_onboarding_guide .cnb_screenshot img {
1456
+ border-radius: 42px;
1457
+ border: 5px solid #fff;
1458
+ box-shadow: 0 0 15px rgb(0 0 0 / 20%);
1459
+ width:100%;
1460
+ max-width: 650px;
1461
+ height: auto;
1462
+ }
src/CallNowButton.php CHANGED
@@ -16,7 +16,6 @@ use cnb\admin\CnbAdminAjax;
16
  use cnb\admin\condition\CnbConditionController;
17
  use cnb\admin\condition\CnbConditionRouter;
18
  use cnb\admin\deactivation\Activation;
19
- use cnb\admin\deactivation\Deactivation;
20
  use cnb\admin\domain\CnbDomainController;
21
  use cnb\admin\domain\CnbDomainRouter;
22
  use cnb\admin\gettingstarted\GettingStartedController;
@@ -336,6 +335,12 @@ class CallNowButton {
336
  array( CNB_SLUG . '-call-now-button' ),
337
  CNB_VERSION,
338
  true );
 
 
 
 
 
 
339
  wp_register_script(
340
  CNB_SLUG . '-button-edit',
341
  plugins_url( '../resources/js/button-edit.js', __FILE__ ),
@@ -384,12 +389,6 @@ class CallNowButton {
384
  array( CNB_SLUG . '-call-now-button' ),
385
  CNB_VERSION,
386
  true );
387
- wp_register_script(
388
- CNB_SLUG . '-deactivation',
389
- plugins_url( '../resources/js/deactivation.js', __FILE__ ),
390
- array( CNB_SLUG . '-tally' ),
391
- CNB_VERSION,
392
- true );
393
  wp_register_script(
394
  CNB_SLUG . '-error-reporting',
395
  plugins_url( '../resources/js/error-reporting.js', __FILE__ ),
@@ -419,14 +418,6 @@ class CallNowButton {
419
  null,
420
  '17.0.12',
421
  true );
422
-
423
- $activation_time = array_key_exists('activation_time', $options) ? $options['activation_time'] : 0;
424
- wp_localize_script( CNB_SLUG . '-deactivation', 'cnb_plugin_data',
425
- array(
426
- 'activation_time' => $activation_time,
427
- )
428
- );
429
-
430
  }
431
 
432
  public function register_global_actions() {
@@ -443,9 +434,6 @@ class CallNowButton {
443
  $activation = new Activation();
444
  add_action( 'admin_init', array($activation, 'redirect_to_welcome_page' ) );
445
 
446
- $deactivation = new Deactivation();
447
- add_action( 'admin_init', array($deactivation, 'register_deactivation_popup' ) );
448
-
449
  $settings_controller = new CnbSettingsController();
450
  add_filter( 'option_cnb', array( $settings_controller, 'post_option_cnb' ) );
451
 
16
  use cnb\admin\condition\CnbConditionController;
17
  use cnb\admin\condition\CnbConditionRouter;
18
  use cnb\admin\deactivation\Activation;
 
19
  use cnb\admin\domain\CnbDomainController;
20
  use cnb\admin\domain\CnbDomainRouter;
21
  use cnb\admin\gettingstarted\GettingStartedController;
335
  array( CNB_SLUG . '-call-now-button' ),
336
  CNB_VERSION,
337
  true );
338
+ wp_register_script(
339
+ CNB_SLUG . '-action-edit-fields',
340
+ plugins_url( '../resources/js/action-edit-fields.js', __FILE__ ),
341
+ array( CNB_SLUG . '-call-now-button' ),
342
+ CNB_VERSION,
343
+ true );
344
  wp_register_script(
345
  CNB_SLUG . '-button-edit',
346
  plugins_url( '../resources/js/button-edit.js', __FILE__ ),
389
  array( CNB_SLUG . '-call-now-button' ),
390
  CNB_VERSION,
391
  true );
 
 
 
 
 
 
392
  wp_register_script(
393
  CNB_SLUG . '-error-reporting',
394
  plugins_url( '../resources/js/error-reporting.js', __FILE__ ),
418
  null,
419
  '17.0.12',
420
  true );
 
 
 
 
 
 
 
 
421
  }
422
 
423
  public function register_global_actions() {
434
  $activation = new Activation();
435
  add_action( 'admin_init', array($activation, 'redirect_to_welcome_page' ) );
436
 
 
 
 
437
  $settings_controller = new CnbSettingsController();
438
  add_filter( 'option_cnb', array( $settings_controller, 'post_option_cnb' ) );
439
 
src/admin/CnbAdminAjax.php CHANGED
@@ -61,7 +61,7 @@ class CnbAdminAjax {
61
  // Get link based on Stripe checkoutSessionId
62
  wp_send_json( array(
63
  'status' => 'success',
64
- 'message' => $checkoutSession->checkoutSessionId
65
  ) );
66
  }
67
  do_action( 'cnb_finish' );
61
  // Get link based on Stripe checkoutSessionId
62
  wp_send_json( array(
63
  'status' => 'success',
64
+ 'url' => $checkoutSession->url
65
  ) );
66
  }
67
  do_action( 'cnb_finish' );
src/admin/action/CnbActionViewEdit.php CHANGED
@@ -145,6 +145,7 @@ class CnbActionViewEdit {
145
  wp_enqueue_script( 'jquery-ui-core' );
146
  wp_enqueue_script( 'jquery-ui-slider' );
147
  wp_enqueue_script( CNB_SLUG . '-action-edit-scheduler' );
 
148
 
149
  // For the image selector
150
  wp_enqueue_media();
@@ -173,8 +174,7 @@ class CnbActionViewEdit {
173
  </tr>
174
  <?php } ?>
175
  <tr class="cnb_hide_on_modal">
176
- <th></th>
177
- <td></td>
178
  </tr>
179
  <tr class="cnb_hide_on_modal">
180
  <th scope="row"><label for="cnb_action_type">Button type</label></th>
@@ -186,6 +186,7 @@ class CnbActionViewEdit {
186
  </option>
187
  <?php } ?>
188
  </select>
 
189
  </td>
190
  </tr>
191
  <tr class="cnb-action-value cnb_hide_on_modal">
@@ -193,16 +194,18 @@ class CnbActionViewEdit {
193
  <label for="cnb_action_value_input">
194
  <span id="cnb_action_value">Action value</span>
195
  </label>
196
-
197
  </th>
198
  <td>
199
  <input type="text" id="cnb_action_value_input"
200
  name="actions[<?php echo esc_attr( $action->id ) ?>][actionValue]"
201
  value="<?php echo esc_attr( $action->actionValue ) ?>"/>
202
- <p class="description cnb-action-properties-map">Preview via <a href="#"
203
  onclick="cnb_action_update_map_link(this)"
204
  target="_blank">Google Maps</a></p>
205
-
 
 
 
206
  </td>
207
  </tr>
208
  <tr class="cnb-action-properties-whatsapp cnb-action-properties-signal">
@@ -217,11 +220,7 @@ class CnbActionViewEdit {
217
  </td>
218
  </tr>
219
  <tr class="button-text cnb_hide_on_modal">
220
- <th scope="row"><label for="buttonTextField">Button label text <a
221
- href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/button-label/', 'question-mark', 'button-label' ) ) ?>"
222
- target="_blank" class="cnb-nounderscore">
223
- <span class="dashicons dashicons-editor-help"></span>
224
- </a></label></th>
225
  <td>
226
  <input id="buttonTextField" type="text"
227
  name="actions[<?php echo esc_attr( $action->id ) ?>][labelText]"
@@ -230,7 +229,7 @@ class CnbActionViewEdit {
230
  </tr>
231
 
232
  <tr class="cnb_hide_on_modal">
233
- <th scope="row"><label for="actions-<?php echo esc_attr( $action->id ) ?>-iconText">Icon</label></th>
234
  <td data-icon-text-target="cnb_action_icon_text" data-icon-type-target="cnb_action_icon_type">
235
  <div class="icon-text-options" id="icon-text-ANCHOR">
236
  <div class="cnb-button-icon">
@@ -348,20 +347,86 @@ class CnbActionViewEdit {
348
  </div>
349
  <div class="icon-text-options" id="icon-text-IFRAME">
350
  <div class="cnb-button-icon">
351
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="link4">link4</i>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
  </div>
353
  </div>
354
  <div class="icon-text-options" id="icon-text-TALLY">
355
  <div class="cnb-button-icon">
356
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="support">support</i>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  </div>
358
  </div>
359
  <div class="icon-text-options" id="icon-text-INTERCOM">
360
  <div class="cnb-button-icon">
361
- <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="call3">call3</i>
362
  </div>
363
  </div>
364
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
  <a
366
  href="#"
367
  onclick="return cnb_show_icon_text_advanced(this)"
@@ -390,45 +455,6 @@ class CnbActionViewEdit {
390
  The Call Now Button uses the <code>filled</code> version of icons.</p>
391
  </td>
392
  </tr>
393
- <tr class="cnb_advanced_view">
394
- <th scope="row">
395
- <label for="cnb_select_image">
396
- <span>Image</span>
397
- </label>
398
-
399
- </th>
400
- <td>
401
- <input
402
- type="hidden"
403
- name="actions[<?php echo esc_attr( $action->id ) ?>][iconBackgroundImage]"
404
- value="<?php echo esc_attr( $action->iconBackgroundImage ) ?>"
405
- id="cnb_action_icon_background_image"/>
406
- <input
407
- type='button'
408
- class="button-primary" value="<?php esc_attr_e( 'Select image' ); ?>"
409
- id="cnb_select_image"
410
- <?php if (!$isPro) { ?>disabled="disabled"<?php } ?>
411
- />
412
- <?php if (!empty($action->iconBackgroundImage) && stripos($action->iconBackgroundImage, 'url(') !== false) {
413
- $clean = str_replace(')', '', str_replace('url(', '', $action->iconBackgroundImage)) ?>
414
- <br />Currently set via your media gallery:<br /><img id="cnb_selected_image" src="<?php echo esc_attr($clean) ?>" alt="Action background image" style="max-height: 100px;max-width: 100px;"/>
415
- <?php } ?>
416
- <p class="description">Instead of an icon, you can choose to use an image from your Media Library.</p>
417
- <?php if (!$isPro && $domain) {
418
- $upgrade_link =
419
- add_query_arg( array(
420
- 'page' => 'call-now-button-domains',
421
- 'action' => 'upgrade',
422
- 'id' => $domain->id
423
- ),
424
- admin_url( 'admin.php' ) );
425
- ?>
426
- <p class="description">
427
- <a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a> to unlock this <span class="cnb-pro-badge">Pro</span> feature.
428
- </p>
429
- <?php } ?>
430
- </td>
431
- </tr>
432
 
433
  <?php if ( $button && $button->type === 'SINGLE' ) { ?>
434
  <tr class="cnb_hide_on_modal cnb_advanced_view">
@@ -477,357 +503,34 @@ class CnbActionViewEdit {
477
  class="cnb_toggle_state cnb_toggle_true">Show icon</span>
478
  </td>
479
  </tr>
480
- <?php } // End Multi/Buttonbar ?>
481
- <?php } ?>
 
482
 
483
- <tr class="cnb-action-properties-whatsapp">
484
- <th colspan="2">
485
- <hr/>
486
- </th>
487
- </tr>
488
 
489
- <tr class="cnb-action-properties-whatsapp">
490
- <th scope="row">Show WhatsApp modal <a
491
- href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/whatsapp-modal/', 'question-mark', 'whatsapp-modal' ) ) ?>"
492
- target="_blank" class="cnb-nounderscore">
493
- <span class="dashicons dashicons-editor-help"></span>
494
- </a></th>
495
- <td class="appearance">
496
- <input type="hidden"
497
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][whatsapp-dialog-type]"
498
- value=""/>
499
- <input id="cnb-action-modal" class="cnb_toggle_checkbox" type="checkbox"
500
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][whatsapp-dialog-type]"
501
- value="popout"
502
- <?php checked( true, isset( $action->properties ) && isset( $action->properties->{'whatsapp-dialog-type'} ) && $action->properties->{'whatsapp-dialog-type'} ); ?> />
503
- <label for="cnb-action-modal" class="cnb_toggle_label">Toggle</label>
504
- <span data-cnb_toggle_state_label="cnb-action-modal"
505
- class="cnb_toggle_state cnb_toggle_false">(Off)</span>
506
- <span data-cnb_toggle_state_label="cnb-action-modal"
507
- class="cnb_toggle_state cnb_toggle_true">Yes</span>
508
- </td>
509
- </tr>
510
- <tr id="action-properties-message-row" class="cnb-action-properties-sms">
511
- <th scope="row"><label for="action-properties-message">Message template <a
512
- href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/message-template/', 'question-mark', 'message-template' ) ) ?>"
513
- target="_blank" class="cnb-nounderscore">
514
- <span class="dashicons dashicons-editor-help"></span>
515
- </a></label></th>
516
- <td>
517
- <textarea id="action-properties-message"
518
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][message]" class="code"
519
- rows="3"
520
- placeholder="Optional"><?php if ( isset( $action->properties ) && isset( $action->properties->message ) ) {
521
- echo esc_textarea( $action->properties->message );
522
- } ?></textarea>
523
- </td>
524
- </tr>
525
 
526
- <tr class="cnb-action-properties-whatsapp-modal">
527
- <th scope="row"><label for="actionWhatsappTitle">Title</label></th>
528
- <td>
529
- <input id="actionWhatsappTitle" type="text"
530
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][whatsapp-title]"
531
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'whatsapp-title'} ) ) {
532
- echo esc_attr( $action->properties->{'whatsapp-title'} );
533
- } ?>" maxlength="30" placeholder="Optional"/>
534
- <p class="description">When left empty, the "Button label text" entered above will be used here.</p>
535
- </td>
536
- </tr>
537
- <tr class="cnb-action-properties-whatsapp-modal">
538
- <th scope="row"><label for="actionWhatsappWelcomeMessage">Welcome message</label></th>
539
- <td>
540
- <textarea id="actionWhatsappWelcomeMessage" rows="3"
541
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][whatsapp-welcomeMessage]"
542
- placeholder="How can we help?"><?php if ( isset( $action->properties ) && isset( $action->properties->{'whatsapp-welcomeMessage'} ) ) {
543
- echo esc_textarea( $action->properties->{'whatsapp-welcomeMessage'} );
544
- } ?></textarea>
545
- <p class="description">Press [Enter] to start a new speech bubble in the chat modal. Speech bubbles
546
- will appear in a sequence with a short pause between them.</p>
547
- </td>
548
- </tr>
549
- <tr class="cnb-action-properties-whatsapp">
550
- <th scope="row"><label for="cnb-action-show-notification-count">Show notification count</label></th>
551
- <td class="appearance">
552
- <input type="hidden"
553
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][show-notification-count]"
554
- value=""/>
555
- <input id="cnb-action-show-notification-count" class="cnb_toggle_checkbox" type="checkbox"
556
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][show-notification-count]"
557
- value="true"
558
- <?php checked( true, isset( $action->properties ) && isset( $action->properties->{'show-notification-count'} ) && $action->properties->{'show-notification-count'} ); ?> />
559
- <label for="cnb-action-show-notification-count" class="cnb_toggle_label">Toggle</label>
560
- <span data-cnb_toggle_state_label="cnb-action-show-notification-count"
561
- class="cnb_toggle_state cnb_toggle_false">(Off)</span>
562
- <span data-cnb_toggle_state_label="cnb-action-show-notification-count"
563
- class="cnb_toggle_state cnb_toggle_true">Yes</span>
564
- <p class="description">Show a small red notification badge on WhatsApp the button to draw the
565
- attention.</p>
566
- </td>
567
- </tr>
568
- <tr class="cnb-action-properties-whatsapp-modal">
569
- <th scope="row"><label for="actionWhatsappPlaceholderMessage">Placeholder message</label></th>
570
- <td>
571
- <input id="actionWhatsappPlaceholderMessage" type="text"
572
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][whatsapp-placeholderMessage]"
573
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'whatsapp-placeholderMessage'} ) ) {
574
- echo esc_attr( $action->properties->{'whatsapp-placeholderMessage'} );
575
- } ?>" placeholder="Type your message"/>
576
- </td>
577
- </tr>
578
- <tr class="cnb-action-properties-email">
579
- <th colspan="2">
580
- <hr/>
581
- </th>
582
- </tr>
583
- <tr class="cnb-action-properties-email">
584
- <th scope="row"><label for="action-properties-subject">Subject</label></th>
585
- <td><input placeholder="Optional" id="action-properties-subject"
586
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][subject]" type="text"
587
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->subject ) ) {
588
- echo esc_attr( $action->properties->subject );
589
- } ?>"/></td>
590
- </tr>
591
- <tr class="cnb-action-properties-email">
592
- <th scope="row"><label for="action-properties-body">Message template <a
593
- href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/message-template/', 'question-mark', 'message-template' ) ) ?>"
594
- target="_blank" class="cnb-nounderscore">
595
- <span class="dashicons dashicons-editor-help"></span>
596
- </a></label></th>
597
- <td><textarea placeholder="Optional" id="action-properties-body"
598
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][body]"
599
- class="large-text code"
600
- rows="3"><?php if ( isset( $action->properties ) && isset( $action->properties->body ) ) {
601
- echo esc_textarea( $action->properties->body );
602
- } ?></textarea></td>
603
 
604
- </tr>
605
- <tr class="cnb-action-properties-email">
606
- <th scope="row"><label for="action-properties-cc">CC</label></th>
607
- <td><input placeholder="Optional" id="action-properties-cc"
608
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][cc]" type="text"
609
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->cc ) ) {
610
- echo esc_attr( $action->properties->cc );
611
- } ?>"/></td>
612
- </tr>
613
- <tr class="cnb-action-properties-email">
614
- <th scope="row"><label for="action-properties-bcc">BCC</label></th>
615
- <td><input placeholder="Optional" id="action-properties-bcc"
616
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][bcc]" type="text"
617
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->bcc ) ) {
618
- echo esc_attr( $action->properties->bcc );
619
- } ?>"/></td>
620
- </tr>
621
- <tr class="cnb-action-properties-link">
622
- <th colspan="2">
623
- <hr/>
624
- </th>
625
- </tr>
626
- <tr class="cnb-action-properties-link cnb_hide_on_modal">
627
- <th scope="row"><label for="actionLinkTargetSelect">Open link in</label></th>
628
- <td>
629
- <?php $action_link_target = isset( $action->properties ) && isset( $action->properties->{'link-target'} ) ? $action->properties->{'link-target'} : null; ?>
630
- <select id="actionLinkTargetSelect"
631
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][link-target]">
632
- <option value="_blank" <?php selected( '_blank', $action_link_target ) ?>>New window</option>
633
- <option value="_self" <?php selected( '_self', $action_link_target ) ?>>Current window</option>
634
- </select>
635
- </td>
636
- </tr>
637
- <tr class="cnb-action-properties-link cnb_advanced_view cnb_hide_on_modal">
638
- <th scope="row"><label for="actionLinkDownload">Download</label></th>
639
- <td>
640
- <?php
641
- $action_download_enabled = isset( $action->properties ) && isset( $action->properties->{'link-download-enabled'} ) ? $action->properties->{'link-download-enabled'} : false;
642
- $action_download_value = isset( $action->properties ) && isset( $action->properties->{'link-download'} ) ? $action->properties->{'link-download'} : null;
643
- ?>
644
- <p><input type="hidden"
645
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][link-download-enabled]"
646
- value="0"/>
647
- <input id="cnb-action-link-download-enabled" class="cnb_toggle_checkbox" type="checkbox"
648
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][link-download-enabled]"
649
- value="true" <?php checked( true, $action_download_enabled ); ?>>
650
- <label for="cnb-action-link-download-enabled" class="cnb_toggle_label">Toggle</label>
651
- <span data-cnb_toggle_state_label="cnb-action-link-download-enabled"
652
- class="cnb_toggle_state cnb_toggle_false">(No)</span>
653
- <span data-cnb_toggle_state_label="cnb-action-link-download-enabled"
654
- class="cnb_toggle_state cnb_toggle_true">Yes</span></p>
655
- <p><input id="actionLinkDownload" type="text"
656
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][link-download]"
657
- value="<?php echo esc_attr( $action_download_value ) ?>" placeholder="Download filename"/>
658
- </p>
659
- </td>
660
- </tr>
661
- <tr class="cnb-action-properties-map">
662
- <th colspan="2">
663
- <hr/>
664
- </th>
665
- </tr>
666
- <tr class="cnb-action-properties-map">
667
- <th scope="row"><label for="actionMapQueryTypeSelect">Maps display</label></th>
668
- <td>
669
- <?php $action_map_query_type = isset( $action->properties ) && isset( $action->properties->{'map-query-type'} ) ? $action->properties->{'map-query-type'} : null; ?>
670
- <select id="actionMapQueryTypeSelect"
671
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][map-query-type]">
672
- <option value="q" <?php selected( 'q', $action_map_query_type ) ?>>Show location</option>
673
- <option value="daddr" <?php selected( 'daddr', $action_map_query_type ) ?>>Show travel
674
- directions
675
- </option>
676
- </select>
677
- </td>
678
- </tr>
679
 
680
- <tr class="cnb-action-properties-iframe">
681
- <th colspan="2">
682
- <hr/>
683
- </th>
684
- </tr>
685
- <tr class="cnb-action-properties-iframe">
686
- <th scope="row"><label for="cnb-action-properties-iframe-title">Iframe Title</label></th>
687
- <td><input placeholder="Optional" id="cnb-action-properties-iframe-title"
688
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][iframe-title]" type="text"
689
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'iframe-title'} ) ) {
690
- echo esc_attr( $action->properties->{'iframe-title'} );
691
- } ?>"/>
692
- <p class="description">This will display a header, including the icon selected above and a "close" icon</p>
693
- </td>
694
- </tr>
695
- <tr class="cnb-action-properties-iframe">
696
- <th scope="row"><label for="cnb-action-properties-iframe-width">Iframe Width</label></th>
697
- <td><input placeholder="Optional" id="cnb-action-properties-iframe-width"
698
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][iframe-width]" type="text"
699
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'iframe-width'} ) ) {
700
- echo esc_attr( $action->properties->{'iframe-width'} );
701
- } ?>"/>
702
- <p class="description">Width of the iframe (max 400px).</p>
703
- </td>
704
- </tr>
705
- <tr class="cnb-action-properties-iframe">
706
- <th scope="row"><label for="cnb-action-properties-iframe-height">Iframe Height</label></th>
707
- <td><input placeholder="Optional" id="cnb-action-properties-iframe-height"
708
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][iframe-height]" type="text"
709
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'iframe-height'} ) ) {
710
- echo esc_attr( $action->properties->{'iframe-height'} );
711
- } ?>"/>
712
- <p class="description">Height of the iframe (min 100px).</p>
713
- </td>
714
- </tr>
715
- <tr class="cnb-action-properties-iframe">
716
- <th scope="row"><label for="cnb-action-properties-iframe-frameborder">Iframe Frameborder</label></th>
717
- <td><input placeholder="Optional" id="cnb-action-properties-iframe-frameborder"
718
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][iframe-frameborder]" type="text"
719
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'iframe-frameborder'} ) ) {
720
- echo esc_attr( $action->properties->{'iframe-frameborder'} );
721
- } ?>"/>
722
- <p class="description">1 or 0</p>
723
- </td>
724
- </tr>
725
- <tr class="cnb-action-properties-iframe">
726
- <th scope="row"><label for="cnb-action-properties-iframe-marginheight">Iframe Marginheight</label></th>
727
- <td><input placeholder="Optional" id="cnb-action-properties-iframe-marginheight"
728
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][iframe-marginheight]" type="text"
729
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'iframe-marginheight'} ) ) {
730
- echo esc_attr( $action->properties->{'iframe-marginheight'} );
731
- } ?>"/>
732
- <p class="description">obsolete? Sets <code>marginheight</code> on the iframe</p>
733
- </td>
734
- </tr>
735
- <tr class="cnb-action-properties-iframe">
736
- <th scope="row"><label for="cnb-action-properties-iframe-marginwidth">Iframe Marginwidth</label></th>
737
- <td><input placeholder="Optional" id="cnb-action-properties-iframe-marginwidth"
738
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][iframe-marginwidth]" type="text"
739
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'iframe-marginwidth'} ) ) {
740
- echo esc_attr( $action->properties->{'iframe-marginwidth'} );
741
- } ?>"/>
742
- <p class="description">obsolete? Sets <code>marginwidth</code> on the iframe</p>
743
- </td>
744
- </tr>
745
- <tr class="cnb-action-properties-tally">
746
- <th scope="row"><label for="cnb-action-properties-tally-id">Tally form ID</label></th>
747
- <td><input placeholder="Optional" id="cnb-action-properties-tally-id"
748
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][tally-id]" type="text"
749
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'tally-id'} ) ) {
750
- echo esc_attr( $action->properties->{'tally-id'} );
751
- } ?>"/>
752
- <p class="description">Tally form ID (last of the Share Link, e.g. <code>wA74do</code> for <code>https://tally.so/r/wA74do</code>.</p>
753
- </td>
754
- </tr>
755
- <tr class="cnb-action-properties-tally">
756
- <th scope="row"><label for="cnb-action-properties-tally-hide-title">Hide Title</label></th>
757
- <td><input placeholder="Optional" id="cnb-action-properties-tally-hide-title"
758
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][tally-hide-title]" type="text"
759
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'tally-hide-title'} ) ) {
760
- echo esc_attr( $action->properties->{'tally-hide-title'} );
761
- } ?>"/>
762
- <p class="description">Hide the title from the Tally form.</p>
763
- </td>
764
- </tr>
765
- <tr class="cnb-action-properties-tally">
766
- <th scope="row"><label for="cnb-action-properties-tally-transparent-background">Transparent Background</label></th>
767
- <td><input placeholder="Optional" id="cnb-action-properties-tally-transparent-background"
768
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][tally-transparent-background]" type="text"
769
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'tally-transparent-background'} ) ) {
770
- echo esc_attr( $action->properties->{'tally-transparent-background'} );
771
- } ?>"/>
772
- <p class="description">1 for transparant, 0 for white</p>
773
- </td>
774
- </tr>
775
- <tr class="cnb-action-properties-tally">
776
- <th scope="row"><label for="cnb-action-properties-tally-align-left">Align Left</label></th>
777
- <td><input placeholder="Optional" id="cnb-action-properties-tally-align-left"
778
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][tally-align-left]" type="text"
779
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'tally-align-left'} ) ) {
780
- echo esc_attr( $action->properties->{'tally-align-left'} );
781
- } ?>"/>
782
- <p class="description">1 for alight left, 0 for default</p>
783
- </td>
784
- </tr>
785
 
786
- <tr class="cnb-action-properties-intercom">
787
- <th colspan="2">
788
- <hr/>
789
- </th>
790
- </tr>
791
- <tr class="cnb-action-properties-intercom">
792
- <th scope="row"><label for="cnb-action-properties-intercom-app-id">App ID</label></th>
793
- <td><input placeholder="Optional" id="cnb-action-properties-intercom-app-id"
794
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][intercom-app-id]" type="text"
795
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'intercom-app-id'} ) ) {
796
- echo esc_attr( $action->properties->{'intercom-app-id'} );
797
- } ?>"/>
798
- <p class="description">Your intercom app ID, something like <code>p7okjh23</code>.</p>
799
- </td>
800
- </tr>
801
- <tr class="cnb-action-properties-intercom">
802
- <th scope="row"><label for="cnb-action-properties-intercom-alignment">Alignment</label></th>
803
- <td><input placeholder="Optional" id="cnb-action-properties-intercom-alignment"
804
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][intercom-alignment]" type="text"
805
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'intercom-alignment'} ) ) {
806
- echo esc_attr( $action->properties->{'intercom-alignment'} );
807
- } ?>"/>
808
- <p class="description"><code>left</code> or <code>right</code> (default).</p>
809
- </td>
810
- </tr>
811
- <tr class="cnb-action-properties-intercom">
812
- <th scope="row"><label for="cnb-action-properties-intercom-horizontal-padding">Horizontal padding</label></th>
813
- <td><input placeholder="Optional" id="cnb-action-properties-intercom-horizontal-padding"
814
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][intercom-horizontal-padding]" type="text"
815
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'intercom-horizontal-padding'} ) ) {
816
- echo esc_attr( $action->properties->{'intercom-horizontal-padding'} );
817
- } ?>"/>
818
- <p class="description">Horizontal padding (in whole numbers), defaults to <code>0</code>.</p>
819
- </td>
820
- </tr>
821
- <tr class="cnb-action-properties-intercom">
822
- <th scope="row"><label for="cnb-action-properties-intercom-vertical-padding">Vertical padding</label></th>
823
- <td><input placeholder="Optional" id="cnb-action-properties-intercom-vertical-padding"
824
- name="actions[<?php echo esc_attr( $action->id ) ?>][properties][intercom-vertical-padding]" type="text"
825
- value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'intercom-vertical-padding'} ) ) {
826
- echo esc_attr( $action->properties->{'intercom-vertical-padding'} );
827
- } ?>"/>
828
- <p class="description">Vertical padding (in whole numbers), defaults to <code>0</code>.</p>
829
- </td>
830
- </tr>
831
 
832
  </table>
833
  <table data-tab-name="scheduler"
145
  wp_enqueue_script( 'jquery-ui-core' );
146
  wp_enqueue_script( 'jquery-ui-slider' );
147
  wp_enqueue_script( CNB_SLUG . '-action-edit-scheduler' );
148
+ wp_enqueue_script( CNB_SLUG . '-action-edit-fields' );
149
 
150
  // For the image selector
151
  wp_enqueue_media();
174
  </tr>
175
  <?php } ?>
176
  <tr class="cnb_hide_on_modal">
177
+ <th colspan="2"></th>
 
178
  </tr>
179
  <tr class="cnb_hide_on_modal">
180
  <th scope="row"><label for="cnb_action_type">Button type</label></th>
186
  </option>
187
  <?php } ?>
188
  </select>
189
+ <p class="description cnb-action-properties-tally"><a target="_blank" href="https://tally.so?ref=callnowbutton&utm_source=callnowbutton&utm_medium=wordpress">Tally</a> is our favorite form tool.</p>
190
  </td>
191
  </tr>
192
  <tr class="cnb-action-value cnb_hide_on_modal">
194
  <label for="cnb_action_value_input">
195
  <span id="cnb_action_value">Action value</span>
196
  </label>
 
197
  </th>
198
  <td>
199
  <input type="text" id="cnb_action_value_input"
200
  name="actions[<?php echo esc_attr( $action->id ) ?>][actionValue]"
201
  value="<?php echo esc_attr( $action->actionValue ) ?>"/>
202
+ <p class="description cnb-action-properties-map">Preview on <a href="#"
203
  onclick="cnb_action_update_map_link(this)"
204
  target="_blank">Google Maps</a></p>
205
+ <p class="description cnb-action-properties-tally">ID is last part of the share link, e.g. <code>wA74do</code> for <code>https://tally.so/r/wA74do</code>.</p>
206
+ <p class="description cnb-action-properties-intercom">E.g. <code>gkeb4bs</code>. See <a
207
+ href="https://www.intercom.com/help/en/articles/3539-where-can-i-find-my-workspace-id-app-id?utm_source=callnowbutton&utm_medium=callnowbutton-plugin"
208
+ target="_blank">this Intercom article</a> on how to find your app ID.</p>
209
  </td>
210
  </tr>
211
  <tr class="cnb-action-properties-whatsapp cnb-action-properties-signal">
220
  </td>
221
  </tr>
222
  <tr class="button-text cnb_hide_on_modal">
223
+ <th scope="row"><label for="buttonTextField">Button label</label></th>
 
 
 
 
224
  <td>
225
  <input id="buttonTextField" type="text"
226
  name="actions[<?php echo esc_attr( $action->id ) ?>][labelText]"
229
  </tr>
230
 
231
  <tr class="cnb_hide_on_modal">
232
+ <th scope="row"><label for="actions-<?php echo esc_attr( $action->id ) ?>-iconText">Button icon/image</label></th>
233
  <td data-icon-text-target="cnb_action_icon_text" data-icon-type-target="cnb_action_icon_type">
234
  <div class="icon-text-options" id="icon-text-ANCHOR">
235
  <div class="cnb-button-icon">
347
  </div>
348
  <div class="icon-text-options" id="icon-text-IFRAME">
349
  <div class="cnb-button-icon">
350
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="open_modal">open_modal</i>
351
+ </div>
352
+ <div class="cnb-button-icon">
353
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="calendar">calendar</i>
354
+ </div>
355
+ <div class="cnb-button-icon">
356
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="communicate">communicate</i>
357
+ </div>
358
+ <div class="cnb-button-icon">
359
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="conversation">conversation</i>
360
+ </div>
361
+ <div class="cnb-button-icon">
362
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="more_info">more_info</i>
363
+ </div>
364
+ <div class="cnb-button-icon">
365
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="call_back">call_back</i>
366
+ </div>
367
+ <div class="cnb-button-icon">
368
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="donate">donate</i>
369
+ </div>
370
+ <div class="cnb-button-icon">
371
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="payment">payment</i>
372
  </div>
373
  </div>
374
  <div class="icon-text-options" id="icon-text-TALLY">
375
  <div class="cnb-button-icon">
376
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="call3">call3</i>
377
+ </div>
378
+ <div class="cnb-button-icon">
379
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="email">email</i>
380
+ </div>
381
+ <div class="cnb-button-icon">
382
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="chat">chat</i>
383
+ </div>
384
+ <div class="cnb-button-icon">
385
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="communicate">communicate</i>
386
+ </div>
387
+ <div class="cnb-button-icon">
388
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="open_modal">open_modal</i>
389
+ </div>
390
+ <div class="cnb-button-icon">
391
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="donate">donate</i>
392
+ </div>
393
+ <div class="cnb-button-icon">
394
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="payment">payment</i>
395
  </div>
396
  </div>
397
  <div class="icon-text-options" id="icon-text-INTERCOM">
398
  <div class="cnb-button-icon">
399
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="intercom">intercom</i>
400
  </div>
401
  </div>
402
 
403
+ <input
404
+ type="hidden"
405
+ name="actions[<?php echo esc_attr( $action->id ) ?>][iconBackgroundImage]"
406
+ value="<?php echo esc_attr( $action->iconBackgroundImage ) ?>"
407
+ id="cnb_action_icon_background_image"/>
408
+ <input
409
+ type='button'
410
+ class="button-secondary" value="<?php esc_attr_e( 'Select image' ); ?>"
411
+ id="cnb_select_image"
412
+ <?php if (!$isPro) { ?>disabled="disabled"<?php } ?>
413
+ />
414
+
415
+
416
+ <?php if (!$isPro && $domain) {
417
+ $upgrade_link =
418
+ add_query_arg( array(
419
+ 'page' => 'call-now-button-domains',
420
+ 'action' => 'upgrade',
421
+ 'id' => $domain->id
422
+ ),
423
+ admin_url( 'admin.php' ) );
424
+ ?>
425
+ <p class="description">
426
+ <a href="<?php echo esc_url( $upgrade_link ) ?>">Upgrade</a> to unlock this <span class="cnb-pro-badge">Pro</span> feature.
427
+ </p>
428
+ <?php } ?>
429
+
430
  <a
431
  href="#"
432
  onclick="return cnb_show_icon_text_advanced(this)"
455
  The Call Now Button uses the <code>filled</code> version of icons.</p>
456
  </td>
457
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
 
459
  <?php if ( $button && $button->type === 'SINGLE' ) { ?>
460
  <tr class="cnb_hide_on_modal cnb_advanced_view">
503
  class="cnb_toggle_state cnb_toggle_true">Show icon</span>
504
  </td>
505
  </tr>
506
+ <?php
507
+ } // End Multi/Buttonbar
508
+ } // End Single (/"button" options)
509
 
510
+ $action_sms_settings = new ActionSmsSettings();
511
+ $action_sms_settings->render($action);
 
 
 
512
 
513
+ $action_whatsapp_settings = new ActionWhatsappSettings();
514
+ $action_whatsapp_settings->render($action);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
515
 
516
+ $action_email_settings = new ActionEmailSettings();
517
+ $action_email_settings->render($action);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
518
 
519
+ $action_link_settings = new ActionLinkSettings();
520
+ $action_link_settings->render($action);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
 
522
+ $action_map_settings = new ActionMapSettings();
523
+ $action_map_settings->render($action);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
524
 
525
+ $action_iframe_settings = new ActionIframeSettings();
526
+ $action_iframe_settings->render($action);
527
+
528
+ $action_tally_options = new ActionTallySettings();
529
+ $action_tally_options->render($action);
530
+
531
+ $action_intercom_settings = new ActionIntercomSettings();
532
+ $action_intercom_settings->render($action);
533
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
534
 
535
  </table>
536
  <table data-tab-name="scheduler"
src/admin/action/partials/class-action-email-settings.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cnb\admin\action;
4
+
5
+ // don't load directly
6
+ use cnb\utils\CnbUtils;
7
+
8
+ defined( 'ABSPATH' ) || die( '-1' );
9
+
10
+ class ActionEmailSettings {
11
+
12
+ /**
13
+ * @param CnbAction $action
14
+ *
15
+ * @return void
16
+ */
17
+ function render( $action ) {
18
+ $cnb_utils = new CnbUtils();
19
+
20
+ ?>
21
+ <tr class="cnb-action-properties-email cnb-settings-section cnb-settings-section-email">
22
+ <td colspan="2">
23
+ <h3 class="cnb-settings-section-title" data-cnb-settings-block="email"><span
24
+ class="dashicons dashicons-arrow-right"></span> Extra email settings</h3>
25
+
26
+ <table class="cnb-settings-section-table">
27
+ <tr class="cnb-action-properties-email">
28
+ <th scope="row"><label for="action-properties-subject">Subject</label></th>
29
+ <td><input placeholder="Optional" id="action-properties-subject"
30
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][subject]"
31
+ type="text"
32
+ value="<?php if ( isset( $action->properties ) && isset( $action->properties->subject ) ) {
33
+ echo esc_attr( $action->properties->subject );
34
+ } ?>"/></td>
35
+ </tr>
36
+ <tr class="cnb-action-properties-email">
37
+ <th scope="row"><label for="action-properties-body">Message template <a
38
+ href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/message-template/', 'question-mark', 'message-template' ) ) ?>"
39
+ target="_blank" class="cnb-nounderscore">
40
+ <span class="dashicons dashicons-editor-help"></span>
41
+ </a></label></th>
42
+ <td><textarea placeholder="Optional" id="action-properties-body"
43
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][body]"
44
+ class="large-text code"
45
+ rows="3"><?php if ( isset( $action->properties ) && isset( $action->properties->body ) ) {
46
+ echo esc_textarea( $action->properties->body );
47
+ } ?></textarea></td>
48
+
49
+ </tr>
50
+ <tr class="cnb-action-properties-email">
51
+ <th scope="row"><label for="action-properties-cc">CC</label></th>
52
+ <td><input placeholder="Optional" id="action-properties-cc"
53
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][cc]" type="text"
54
+ value="<?php if ( isset( $action->properties ) && isset( $action->properties->cc ) ) {
55
+ echo esc_attr( $action->properties->cc );
56
+ } ?>"/></td>
57
+ </tr>
58
+ <tr class="cnb-action-properties-email">
59
+ <th scope="row"><label for="action-properties-bcc">BCC</label></th>
60
+ <td><input placeholder="Optional" id="action-properties-bcc"
61
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][bcc]" type="text"
62
+ value="<?php if ( isset( $action->properties ) && isset( $action->properties->bcc ) ) {
63
+ echo esc_attr( $action->properties->bcc );
64
+ } ?>"/></td>
65
+ </tr>
66
+ </table>
67
+ </td>
68
+ </tr>
69
+ <?php
70
+ }
71
+ }
src/admin/action/partials/class-action-iframe-settings.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cnb\admin\action;
4
+
5
+ // don't load directly
6
+ defined( 'ABSPATH' ) || die( '-1' );
7
+
8
+ class ActionIframeSettings {
9
+ /**
10
+ * @param CnbAction $action
11
+ *
12
+ * @return void
13
+ */
14
+ function render( $action ) {
15
+ $this->render_header();
16
+ $this->render_iframe_options( $action );
17
+ $this->render_modal_options( $action );
18
+ $this->render_close_header();
19
+ }
20
+
21
+ /**
22
+ * @param CnbAction $action
23
+ *
24
+ * @return void
25
+ */
26
+ function render_modal_options( $action ) {
27
+ $this->render_modal_height( $action );
28
+ $this->render_modal_width( $action );
29
+ $this->render_modal_colors( $action );
30
+ }
31
+
32
+ /**
33
+ * NOTE: This function does NOT close its opened tags - that is done via "render_close_header"
34
+ * @return void
35
+ */
36
+ function render_header() { ?>
37
+ <tr class="cnb-action-properties-iframe cnb-settings-section cnb-settings-section-iframe">
38
+ <td colspan="2">
39
+ <h3 class="cnb-settings-section-title" data-cnb-settings-block="iframe"><span
40
+ class="dashicons dashicons-arrow-right"></span> Pop-up settings</h3>
41
+ <?php
42
+ }
43
+
44
+ /**
45
+ * This function closes the tags opened in render_header
46
+ * @return void
47
+ */
48
+ function render_close_header() {
49
+ ?>
50
+ </td>
51
+ </tr>
52
+ <?php
53
+ }
54
+
55
+ /**
56
+ * @param CnbAction $action
57
+ *
58
+ * @return void
59
+ */
60
+ function render_iframe_options( $action ) {
61
+ ?>
62
+
63
+ <table class="cnb-settings-section-table">
64
+ <tr class="cnb-action-properties-iframe">
65
+ <th scope="row"><label for="cnb-action-properties-iframe-title">Title</label></th>
66
+ <td><input placeholder="Optional" id="cnb-action-properties-iframe-title"
67
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][iframe-title]" type="text"
68
+ value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'iframe-title'} ) ) {
69
+ echo esc_attr( $action->properties->{'iframe-title'} );
70
+ } ?>"/>
71
+
72
+ </td>
73
+ </tr>
74
+ <?php }
75
+
76
+ /**
77
+ * @param CnbAction $action
78
+ *
79
+ * @return void
80
+ */
81
+ function render_modal_height( $action ) {
82
+ // Default
83
+ $action_properties_modal_height = '';
84
+ if ( isset( $action->properties ) && isset( $action->properties->{'modal-height'} ) ) {
85
+ $action_properties_modal_height = $action->properties->{'modal-height'};
86
+ }
87
+
88
+ // Set defaults for slider
89
+ $action_properties_modal_height_value = 400;
90
+ $action_properties_modal_height_unit = 'px';
91
+ // If there is a value, split it up
92
+ if ( $action_properties_modal_height ) {
93
+ $action_properties_modal_height_split = preg_split( '#(?<=\d)(?=[a-z])#i', $action_properties_modal_height );
94
+ if ( isset( $action_properties_modal_height_split[0] ) ) {
95
+ $action_properties_modal_height_value = $action_properties_modal_height_split[0];
96
+ }
97
+ if ( isset( $action_properties_modal_height_split[1] ) ) {
98
+ $action_properties_modal_height_unit = $action_properties_modal_height_split[1];
99
+ }
100
+ }
101
+ ?>
102
+ <tr class="cnb-action-properties-iframe">
103
+ <th scope="row"><label for="cnb-action-properties-modal-height-value">Window height <span
104
+ class="cnb_font_normal">(<span
105
+ class="cnb-action-properties-modal-height-result"><?php echo esc_attr( $action_properties_modal_height ) ?></span>)</span></label>
106
+ </th>
107
+ <td>
108
+ <input
109
+ type="hidden"
110
+ placeholder="Optional" id="cnb-action-properties-modal-height"
111
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][modal-height]"
112
+ value="<?php echo esc_attr( $action_properties_modal_height ) ?>"
113
+ />
114
+
115
+ <div id="cnb-action-properties-modal-height-slider">
116
+ <label class="cnb_slider_value" id="cnb-action-properties-modal-height-value-min"></label>
117
+ <input id="cnb-action-properties-modal-height-value"
118
+ type="range"
119
+ min="10"
120
+ max="2000"
121
+ step="5"
122
+ value="<?php echo esc_attr( $action_properties_modal_height_value ) ?>"/>
123
+ <label class="cnb_slider_value" id="cnb-action-properties-modal-height-value-max"></label>
124
+ <select id="cnb-action-properties-modal-height-unit">
125
+ <option value="px" <?php selected( 'px', $action_properties_modal_height_unit ) ?>>px</option>
126
+ <option value="vh" <?php selected( 'vh', $action_properties_modal_height_unit ) ?>>vh</option>
127
+ </select>
128
+ </div>
129
+ </td>
130
+ </tr>
131
+ <?php }
132
+
133
+ /**
134
+ * @param CnbAction $action
135
+ *
136
+ * @return void
137
+ */
138
+ function render_modal_width( $action ) {
139
+
140
+ // Default
141
+ $action_properties_modal_width = '';
142
+ if ( isset( $action->properties ) && isset( $action->properties->{'modal-width'} ) ) {
143
+ $action_properties_modal_width = $action->properties->{'modal-width'};
144
+ }
145
+
146
+ ?>
147
+ <tr class="cnb-action-properties-iframe">
148
+ <th scope="row"><label for="cnb-action-properties-modal-width">Modal Width</label></th>
149
+ <td>
150
+ <select id="cnb-action-properties-modal-width"
151
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][modal-width]">
152
+ <option value="400px" <?php selected( '400px', $action_properties_modal_width ) ?>>Normal</option>
153
+ <option value="500px" <?php selected( '500px', $action_properties_modal_width ) ?>>Wide</option>
154
+ <option value="600px" <?php selected( '600px', $action_properties_modal_width ) ?>>Extra Wide
155
+ </option>
156
+ </select>
157
+ </td>
158
+ </tr>
159
+ <?php }
160
+
161
+ function render_modal_colors( $action ) {
162
+ $modal_background_color = '';
163
+ $modal_header_background_color = '#009900';
164
+ $modal_header_text_color = '#ffffff';
165
+ if ( isset( $action->properties ) && isset( $action->properties->{'modal-background-color'} ) ) {
166
+ $modal_background_color = $action->properties->{'modal-background-color'};
167
+ }
168
+ if ( isset( $action->properties ) && isset( $action->properties->{'modal-header-background-color'} ) ) {
169
+ $modal_header_background_color = $action->properties->{'modal-header-background-color'};
170
+ }
171
+ if ( isset( $action->properties ) && isset( $action->properties->{'modal-header-text-color'} ) ) {
172
+ $modal_header_text_color = $action->properties->{'modal-header-text-color'};
173
+ }
174
+ ?>
175
+ <tr class="cnb-action-properties-iframe cnb_advanced_view">
176
+ <th scope="row"><label for="cnb-action-properties-modal-background-color">Modal Background Color</label>
177
+ </th>
178
+ <td>
179
+ <input
180
+ id="cnb-action-properties-modal-background-color"
181
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][modal-background-color]"
182
+ type="text"
183
+ value="<?php echo esc_attr( $modal_background_color ) ?>"
184
+ class="cnb-color-field" data-default-color="#ffffff"/>
185
+ </td>
186
+ </tr>
187
+ <tr class="cnb-action-properties-iframe">
188
+ <th scope="row"><label for="cnb-action-properties-modal-header-background-color">Header color</label></th>
189
+ <td>
190
+ <input
191
+ id="cnb-action-properties-modal-header-background-color"
192
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][modal-header-background-color]"
193
+ type="text"
194
+ value="<?php echo esc_attr( $modal_header_background_color ) ?>"
195
+ class="cnb-color-field" data-default-color="#009900"/>
196
+ </td>
197
+ </tr>
198
+ <tr class="cnb-action-properties-iframe">
199
+ <th scope="row"><label for="cnb-action-properties-modal-header-text-color">Header text color</label>
200
+ </th>
201
+ <td>
202
+ <input
203
+ id="cnb-action-properties-modal-header-text-color"
204
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][modal-header-text-color]"
205
+ type="text"
206
+ value="<?php echo esc_attr( $modal_header_text_color ) ?>"
207
+ class="cnb-color-field" data-default-color="#ffffff"/>
208
+
209
+ </td>
210
+ </tr>
211
+ </table>
212
+ <?php
213
+ }
214
+ }
src/admin/action/partials/class-action-intercom-settings.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cnb\admin\action;
4
+
5
+ // don't load directly
6
+ defined( 'ABSPATH' ) || die( '-1' );
7
+
8
+ class ActionIntercomSettings {
9
+ /**
10
+ * @param CnbAction $action
11
+ *
12
+ * @return void
13
+ */
14
+ function render( $action ) {
15
+ $this->render_options( $action );
16
+ }
17
+
18
+ /**
19
+ * @param CnbAction $action
20
+ *
21
+ * @return void
22
+ */
23
+ function render_options( $action ) {
24
+ $alignment = '';
25
+ $horizontal_padding = 0;
26
+ $vertical_padding = 0;
27
+
28
+ if ( isset( $action->properties ) && isset( $action->properties->{'intercom-alignment'} ) ) {
29
+ $alignment = $action->properties->{'intercom-alignment'};
30
+ }
31
+ if ( isset( $action->properties ) && isset( $action->properties->{'intercom-horizontal-padding'} ) ) {
32
+ $horizontal_padding = $action->properties->{'intercom-horizontal-padding'};
33
+ }
34
+ if ( isset( $action->properties ) && isset( $action->properties->{'intercom-vertical-padding'} ) ) {
35
+ $vertical_padding = $action->properties->{'intercom-vertical-padding'};
36
+ }
37
+ ?>
38
+ <tr class="cnb-action-properties-intercom">
39
+ <th scope="row"><label for="cnb-action-properties-intercom-alignment">Intercom window placement</label></th>
40
+ <td>
41
+ <select id="cnb-action-properties-intercom-alignment"
42
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][intercom-alignment]">
43
+ <option value="right" <?php selected( $alignment, 'right' ); ?>>
44
+ Right side
45
+ </option>
46
+ <option value="left" <?php selected( $alignment, 'left' ); ?>>
47
+ Left side
48
+ </option>
49
+ </select>
50
+ </td>
51
+ </tr>
52
+ <tr class="cnb-action-properties-intercom cnb_advanced_view">
53
+ <th scope="row"><label for="cnb-action-properties-intercom-horizontal-padding">Horizontal padding</label>
54
+ </th>
55
+ <td><input placeholder="Optional" id="cnb-action-properties-intercom-horizontal-padding"
56
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][intercom-horizontal-padding]"
57
+ type="number" min="0"
58
+ value="<?php echo esc_attr( $horizontal_padding ) ?>"/>
59
+ <p class="description">Horizontal padding (in whole numbers (<code>px</code>), defaults to
60
+ <code>0</code>.</p>
61
+ </td>
62
+ </tr>
63
+ <tr class="cnb-action-properties-intercom cnb_advanced_view">
64
+ <th scope="row"><label for="cnb-action-properties-intercom-vertical-padding">Vertical padding</label></th>
65
+ <td><input placeholder="Optional" id="cnb-action-properties-intercom-vertical-padding"
66
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][intercom-vertical-padding]"
67
+ type="number" min="0"
68
+ value="<?php echo esc_attr( $vertical_padding ) ?>"/>
69
+ <p class="description">Vertical padding (in whole numbers (<code>px</code>)), defaults to <code>0</code>.
70
+ </p>
71
+ </td>
72
+ </tr>
73
+ <?php
74
+ }
75
+ }
src/admin/action/partials/class-action-link-settings.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cnb\admin\action;
4
+
5
+ // don't load directly
6
+ defined( 'ABSPATH' ) || die( '-1' );
7
+
8
+ class ActionLinkSettings {
9
+
10
+ /**
11
+ * @param CnbAction $action
12
+ *
13
+ * @return void
14
+ */
15
+ function render( $action ) {
16
+ $this->render_options( $action );
17
+ }
18
+
19
+ /**
20
+ * @param CnbAction $action
21
+ *
22
+ * @return void
23
+ */
24
+ function render_options( $action ) {
25
+ ?>
26
+ <tr class="cnb-action-properties-link cnb_hide_on_modal">
27
+ <th scope="row"><label for="actionLinkTargetSelect">Open link in</label></th>
28
+ <td>
29
+ <?php $action_link_target = isset( $action->properties ) && isset( $action->properties->{'link-target'} ) ? $action->properties->{'link-target'} : null; ?>
30
+ <select id="actionLinkTargetSelect"
31
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][link-target]">
32
+ <option value="_blank" <?php selected( '_blank', $action_link_target ) ?>>New window</option>
33
+ <option value="_self" <?php selected( '_self', $action_link_target ) ?>>Current window</option>
34
+ </select>
35
+ </td>
36
+ </tr>
37
+ <tr class="cnb-action-properties-link cnb_advanced_view cnb_hide_on_modal">
38
+ <th scope="row"><label for="actionLinkDownload">Download</label></th>
39
+ <td>
40
+ <?php
41
+ $action_download_enabled = isset( $action->properties ) && isset( $action->properties->{'link-download-enabled'} ) ? $action->properties->{'link-download-enabled'} : false;
42
+ $action_download_value = isset( $action->properties ) && isset( $action->properties->{'link-download'} ) ? $action->properties->{'link-download'} : null;
43
+ ?>
44
+ <p><input type="hidden"
45
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][link-download-enabled]"
46
+ value="0"/>
47
+ <input id="cnb-action-link-download-enabled" class="cnb_toggle_checkbox" type="checkbox"
48
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][link-download-enabled]"
49
+ value="true" <?php checked( true, $action_download_enabled ); ?>>
50
+ <label for="cnb-action-link-download-enabled" class="cnb_toggle_label">Toggle</label>
51
+ <span data-cnb_toggle_state_label="cnb-action-link-download-enabled"
52
+ class="cnb_toggle_state cnb_toggle_false">(No)</span>
53
+ <span data-cnb_toggle_state_label="cnb-action-link-download-enabled"
54
+ class="cnb_toggle_state cnb_toggle_true">Yes</span></p>
55
+ <p><input id="actionLinkDownload" type="text"
56
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][link-download]"
57
+ value="<?php echo esc_attr( $action_download_value ) ?>" placeholder="Download filename"/>
58
+ </p>
59
+ </td>
60
+ </tr>
61
+ <?php
62
+ }
63
+ }
src/admin/action/partials/class-action-map-settings.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cnb\admin\action;
4
+
5
+ // don't load directly
6
+ defined( 'ABSPATH' ) || die( '-1' );
7
+
8
+ class ActionMapSettings {
9
+
10
+ /**
11
+ * @param CnbAction $action
12
+ *
13
+ * @return void
14
+ */
15
+ function render( $action ) {
16
+ $this->render_options( $action );
17
+ }
18
+
19
+ /**
20
+ * @param CnbAction $action
21
+ *
22
+ * @return void
23
+ */
24
+ function render_options( $action ) {
25
+ ?>
26
+ <tr class="cnb-action-properties-map">
27
+ <th scope="row"><label for="actionMapQueryTypeSelect">Map display</label></th>
28
+ <td>
29
+ <?php $action_map_query_type = isset( $action->properties ) && isset( $action->properties->{'map-query-type'} ) ? $action->properties->{'map-query-type'} : null; ?>
30
+ <select id="actionMapQueryTypeSelect"
31
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][map-query-type]">
32
+ <option value="q" <?php selected( 'q', $action_map_query_type ) ?>>Show location</option>
33
+ <option value="daddr" <?php selected( 'daddr', $action_map_query_type ) ?>>Show travel
34
+ directions
35
+ </option>
36
+ </select>
37
+ </td>
38
+ </tr>
39
+ <?php
40
+ }
41
+ }
src/admin/action/partials/class-action-sms-settings.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cnb\admin\action;
4
+
5
+ // don't load directly
6
+ use cnb\utils\CnbUtils;
7
+
8
+ defined( 'ABSPATH' ) || die( '-1' );
9
+
10
+ class ActionSmsSettings {
11
+ /**
12
+ * @param CnbAction $action
13
+ *
14
+ * @return void
15
+ */
16
+ function render( $action ) {
17
+ $this->render_options( $action );
18
+ }
19
+
20
+
21
+ /**
22
+ * @param CnbAction $action
23
+ *
24
+ * @return void
25
+ */
26
+ function render_options( $action ) {
27
+ $cnb_utils = new CnbUtils();
28
+ ?>
29
+ <tr class="cnb-action-properties-sms">
30
+ <th scope="row"><label for="action-properties-message-sms">Message template <a
31
+ href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/message-template/', 'question-mark', 'message-template' ) ) ?>"
32
+ target="_blank" class="cnb-nounderscore">
33
+ <span class="dashicons dashicons-editor-help"></span>
34
+ </a></label></th>
35
+ <td>
36
+ <textarea id="action-properties-message-sms"
37
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][message]" class="code"
38
+ rows="3"
39
+ placeholder="Optional"><?php if ( isset( $action->properties ) && isset( $action->properties->message ) ) {
40
+ echo esc_textarea( $action->properties->message );
41
+ } ?></textarea>
42
+ </td>
43
+ </tr>
44
+ <?php
45
+ }
46
+ }
src/admin/action/partials/class-action-tally-settings.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cnb\admin\action;
4
+
5
+ // don't load directly
6
+ defined( 'ABSPATH' ) || die( '-1' );
7
+
8
+ class ActionTallySettings {
9
+ /**
10
+ * @param CnbAction $action
11
+ *
12
+ * @return void
13
+ */
14
+ function render( $action ) {
15
+ $this->render_header();
16
+ $this->render_options( $action );
17
+ $this->render_close_header();
18
+ }
19
+
20
+ /**
21
+ * NOTE: This function does NOT close its opened tags - that is done via "render_close_header"
22
+ * @return void
23
+ */
24
+ function render_header() { ?>
25
+ <tr class="cnb-action-properties-tally cnb-settings-section cnb-settings-section-tally">
26
+ <td colspan="2">
27
+ <h3 class="cnb-settings-section-title" data-cnb-settings-block="tally"><span
28
+ class="dashicons dashicons-arrow-right"></span> Tally specific settings</h3>
29
+ <?php
30
+ }
31
+
32
+ /**
33
+ * This function closes the tags opened in render_header
34
+ * @return void
35
+ */
36
+ function render_close_header() {
37
+ ?>
38
+ </td>
39
+ </tr>
40
+ <?php
41
+ }
42
+
43
+ /**
44
+ * @param CnbAction $action
45
+ *
46
+ * @return void
47
+ */
48
+ function render_options( $action ) {
49
+ ?>
50
+ <table class="cnb-settings-section-table">
51
+ <tr class="cnb-action-properties-tally">
52
+ <th scope="row"><label for="cnb-action-properties-tally-hide-title">Form title</label></th>
53
+ <td>
54
+ <?php
55
+ $value = '1';
56
+ if ( isset( $action->properties ) && isset( $action->properties->{'tally-hide-title'} ) ) {
57
+ $value = $action->properties->{'tally-hide-title'};
58
+ }
59
+ ?>
60
+ <select id="cnb-action-properties-tally-hide-title"
61
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][tally-hide-title]">
62
+ <option value="" <?php selected( $value, '' ); ?>>
63
+ Show
64
+ </option>
65
+ <option value="1" <?php selected( $value, '1' ); ?>>
66
+ Hide
67
+ </option>
68
+ </select>
69
+ </td>
70
+ </tr>
71
+ <tr class="cnb-action-properties-tally cnb_advanced_view">
72
+ <th scope="row"><label for="cnb-action-properties-tally-transparent-background">Form background</label>
73
+ </th>
74
+ <td>
75
+ <?php
76
+ $value = '';
77
+ if ( isset( $action->properties ) && isset( $action->properties->{'tally-transparent-background'} ) ) {
78
+ $value = $action->properties->{'tally-transparent-background'};
79
+ }
80
+ ?>
81
+ <select id="cnb-action-properties-tally-transparent-background"
82
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][tally-transparent-background]">
83
+ <option value="" <?php selected( $value, '' ); ?>>
84
+ Default background
85
+ </option>
86
+ <option value="1" <?php selected( $value, '1' ); ?>>
87
+ Transparent background (recommended)
88
+ </option>
89
+ </select>
90
+ </td>
91
+ </tr>
92
+ <tr class="cnb-action-properties-tally">
93
+ <th scope="row"><label for="cnb-action-properties-tally-align-left">Content alignment</label></th>
94
+ <td>
95
+ <?php
96
+ $value = '1';
97
+ if ( isset( $action->properties ) && isset( $action->properties->{'tally-align-left'} ) ) {
98
+ $value = $action->properties->{'tally-align-left'};
99
+ }
100
+ ?>
101
+ <select id="cnb-action-properties-tally-align-left"
102
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][tally-align-left]">
103
+ <option value="" <?php selected( $value, '' ); ?>>
104
+ Tally default
105
+ </option>
106
+ <option value="1" <?php selected( $value, '1' ); ?>>
107
+ Left
108
+ </option>
109
+ </select>
110
+ </td>
111
+ </tr>
112
+ </table>
113
+ <?php
114
+ }
115
+ }
src/admin/action/partials/class-action-whatsapp-settings.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cnb\admin\action;
4
+
5
+ // don't load directly
6
+ use cnb\utils\CnbUtils;
7
+
8
+ defined( 'ABSPATH' ) || die( '-1' );
9
+
10
+ class ActionWhatsappSettings {
11
+ /**
12
+ * @param CnbAction $action
13
+ *
14
+ * @return void
15
+ */
16
+ function render( $action ) {
17
+ $this->render_header();
18
+ $this->render_options( $action );
19
+ $this->render_close_header();
20
+ }
21
+
22
+ /**
23
+ * NOTE: This function does NOT close its opened tags - that is done via "render_close_header"
24
+ * @return void
25
+ */
26
+ function render_header() {
27
+ ?>
28
+ <tr class="cnb-action-properties-whatsapp cnb-settings-section cnb-settings-section-whatsapp">
29
+ <td colspan="2">
30
+ <h3 class="cnb-settings-section-title" data-cnb-settings-block="whatsapp"><span
31
+ class="dashicons dashicons-arrow-right"></span> Extra WhatsApp settings</h3>
32
+ <?php
33
+ }
34
+
35
+ /**
36
+ * This function closes the tags opened in render_header
37
+ * @return void
38
+ */
39
+ function render_close_header() {
40
+ ?>
41
+ </td>
42
+ </tr>
43
+ <?php
44
+ }
45
+
46
+ /**
47
+ * @param CnbAction $action
48
+ *
49
+ * @return void
50
+ */
51
+ function render_options( $action ) {
52
+ $cnb_utils = new CnbUtils();
53
+ ?>
54
+ <table class="cnb-settings-section-table">
55
+ <tr class="cnb-action-properties-whatsapp">
56
+ <th scope="row">When clicked...</th>
57
+ <td class="appearance">
58
+ <?php $value = isset( $action->properties ) && isset( $action->properties->{'whatsapp-dialog-type'} ) && $action->properties->{'whatsapp-dialog-type'} ? $action->properties->{'whatsapp-dialog-type'} : ''; ?>
59
+ <select id="cnb-action-modal"
60
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][whatsapp-dialog-type]">
61
+ <option value="" <?php selected( $value, '' ); ?>>...directly open WhatsApp</option>
62
+ <option value="popout" <?php selected( $value, 'popout' ); ?>>...start with WhatsApp modal
63
+ </option>
64
+ </select>
65
+ </td>
66
+ </tr>
67
+ <!-- TODO: Message template kijkt naar isVisible maar "Extra WhatsApp Settings" zijn nu hidden by default -->
68
+ <tr id="action-properties-message-row" class="cnb-action-properties-whatsapp">
69
+ <th scope="row"><label for="action-properties-message-whatsapp">Message template <a
70
+ href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress/buttons/message-template/', 'question-mark', 'message-template' ) ) ?>"
71
+ target="_blank" class="cnb-nounderscore">
72
+ <span class="dashicons dashicons-editor-help"></span>
73
+ </a></label></th>
74
+ <td>
75
+ <textarea id="action-properties-message-whatsapp"
76
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][message]" class="code"
77
+ rows="3"
78
+ placeholder="Optional"><?php if ( isset( $action->properties ) && isset( $action->properties->message ) ) {
79
+ echo esc_textarea( $action->properties->message );
80
+ } ?></textarea>
81
+ </td>
82
+ </tr>
83
+
84
+ <tr class="cnb-action-properties-whatsapp cnb-action-properties-whatsapp-modal">
85
+ <th scope="row"><label for="actionWhatsappTitle">Window title</label></th>
86
+ <td>
87
+ <input id="actionWhatsappTitle" type="text"
88
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][whatsapp-title]"
89
+ value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'whatsapp-title'} ) ) {
90
+ echo esc_attr( $action->properties->{'whatsapp-title'} );
91
+ } ?>" maxlength="30" placeholder="Optional"/>
92
+ </td>
93
+ </tr>
94
+ <tr class="cnb-action-properties-whatsapp cnb-action-properties-whatsapp-modal">
95
+ <th scope="row"><label for="actionWhatsappWelcomeMessage">Welcome message</label></th>
96
+ <td>
97
+ <textarea id="actionWhatsappWelcomeMessage" rows="3"
98
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][whatsapp-welcomeMessage]"
99
+ placeholder="How can we help?"><?php if ( isset( $action->properties ) && isset( $action->properties->{'whatsapp-welcomeMessage'} ) ) {
100
+ echo esc_textarea( $action->properties->{'whatsapp-welcomeMessage'} );
101
+ } ?></textarea>
102
+ <p class="description">Start a new line by pressing the <code>Enter</code> key. Every line will
103
+ become its own speech bubble. Speech bubbles appear in sequence with a short pause between them.
104
+ </p>
105
+ </td>
106
+ </tr>
107
+ <tr class="cnb-action-properties-whatsapp cnb-action-properties-whatsapp-modal">
108
+ <th scope="row"><label for="cnb-action-show-notification-count">Show notification badge</label></th>
109
+ <td class="appearance">
110
+ <input type="hidden"
111
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][show-notification-count]"
112
+ value=""/>
113
+ <input id="cnb-action-show-notification-count" class="cnb_toggle_checkbox" type="checkbox"
114
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][show-notification-count]"
115
+ value="true"
116
+ <?php checked( true, isset( $action->properties ) && isset( $action->properties->{'show-notification-count'} ) && $action->properties->{'show-notification-count'} ); ?> />
117
+ <label for="cnb-action-show-notification-count" class="cnb_toggle_label">Toggle</label>
118
+ <span data-cnb_toggle_state_label="cnb-action-show-notification-count"
119
+ class="cnb_toggle_state cnb_toggle_false">(Off)</span>
120
+ <span data-cnb_toggle_state_label="cnb-action-show-notification-count"
121
+ class="cnb_toggle_state cnb_toggle_true">Yes</span>
122
+ </td>
123
+ </tr>
124
+ <tr class="cnb-action-properties-whatsapp cnb-action-properties-whatsapp-modal">
125
+ <th scope="row"><label for="actionWhatsappPlaceholderMessage">Placeholder visitor input</label></th>
126
+ <td>
127
+ <input id="actionWhatsappPlaceholderMessage" type="text"
128
+ name="actions[<?php echo esc_attr( $action->id ) ?>][properties][whatsapp-placeholderMessage]"
129
+ value="<?php if ( isset( $action->properties ) && isset( $action->properties->{'whatsapp-placeholderMessage'} ) ) {
130
+ echo esc_attr( $action->properties->{'whatsapp-placeholderMessage'} );
131
+ } ?>" placeholder="Type your message"/>
132
+ </td>
133
+ </tr>
134
+ </table>
135
+ <?php
136
+ }
137
+ }
src/admin/api/CnbAppRemoteCoupons.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cnb\admin\api;
4
+
5
+ // don't load directly
6
+ defined( 'ABSPATH' ) || die( '-1' );
7
+
8
+ use cnb\admin\models\CnbPlan;
9
+ use cnb\coupons\CnbPromotionCode;
10
+ use WP_Error;
11
+
12
+ class CnbAppRemotePromotionCodes {
13
+
14
+ /**
15
+ * @return CnbPromotionCode|WP_Error
16
+ */
17
+ public function get_coupon() {
18
+ $rest_endpoint = '/v1/stripe/coupons/wp';
19
+
20
+ return CnbPromotionCode::fromObject( CnbAppRemote::cnb_remote_get( $rest_endpoint ) );
21
+ }
22
+ }
src/admin/api/CnbAppRemotePayment.php CHANGED
@@ -19,12 +19,6 @@ class CnbAppRemotePayment {
19
  return CnbPlan::fromObjects( CnbAppRemote::cnb_remote_get( $rest_endpoint, false ) );
20
  }
21
 
22
- public static function cnb_remote_get_stripe_key() {
23
- $rest_endpoint = '/v1/stripe/key';
24
-
25
- return CnbAppRemote::cnb_remote_get( $rest_endpoint );
26
- }
27
-
28
  public static function cnb_remote_post_subscription( $planId, $domainId, $callbackUri = null ) {
29
  $callbackUri = $callbackUri === null
30
  ? get_site_url()
19
  return CnbPlan::fromObjects( CnbAppRemote::cnb_remote_get( $rest_endpoint, false ) );
20
  }
21
 
 
 
 
 
 
 
22
  public static function cnb_remote_post_subscription( $planId, $domainId, $callbackUri = null ) {
23
  $callbackUri = $callbackUri === null
24
  ? get_site_url()
src/admin/button/CnbButtonView.php CHANGED
@@ -6,6 +6,7 @@ namespace cnb\admin\button;
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
8
  use cnb\admin\api\CnbAppRemote;
 
9
  use cnb\admin\domain\CnbDomain;
10
  use cnb\utils\CnbAdminFunctions;
11
  use cnb\notices\CnbAdminNotices;
@@ -137,31 +138,52 @@ class CnbButtonView {
137
  private function render_promos( $domain ) {
138
  $cnb_utils = new CnbUtils();
139
  $upgrade_url = $cnb_utils->get_cnb_domain_upgrade( $domain );
140
- $support_url = $cnb_utils->get_support_url('', 'promobox-need-help', 'Help Center');
141
- $faq_url = $cnb_utils->get_support_url('wordpress/#faq', 'promobox-need-help', 'FAQ');
142
  if ( isset( $upgrade_url ) && $upgrade_url ) {
143
  echo '<div class="cnb-postbox-container cnb-side-column"> <!-- Sidebar promo boxes -->';
144
  if ( $domain !== null && ! ( $domain instanceof WP_Error ) && $domain->type === 'FREE' ) {
145
- echo '<!-- Sidebar messages -->';
146
- ( new CnbAdminFunctions() )->cnb_promobox(
147
- 'purple',
148
- 'Remove "Powered by"',
149
- '<p>Remove the <em>powered by</em> branding from your buttons!</p>
150
- <p>Enjoy unlimited access to all features and publish your buttons without branding.</p>
151
- <p>Get <strong><span class="usd-discount"></span>% off</strong> with the annual plan!</p>',
152
- 'flag',
153
- '<strong>&euro;<span class="eur-per-month"></span>/$<span class="usd-per-month"></span> per month</strong>',
154
- 'Upgrade',
155
- $upgrade_url
156
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
 
158
  ( new CnbAdminFunctions() )->cnb_promobox(
159
  'blue',
160
  'Need help?',
161
- '<p>Please head over to our <a href="' . esc_url( $support_url ) . '" target="_blank">Help Center</a> for all your questions.</p>
162
- <p>&check; <a href="' . esc_url( $support_url ) . '" target="_blank">Help Center</a></p>
163
- <p>&check; <a href="' . esc_url( $faq_url ) . '" target="_blank">FAQ</a></p>',
164
- 'welcome-learn-more'
 
 
 
165
  );
166
  echo '</div>';
167
  }
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
8
  use cnb\admin\api\CnbAppRemote;
9
+ use cnb\admin\api\CnbAppRemotePromotionCodes;
10
  use cnb\admin\domain\CnbDomain;
11
  use cnb\utils\CnbAdminFunctions;
12
  use cnb\notices\CnbAdminNotices;
138
  private function render_promos( $domain ) {
139
  $cnb_utils = new CnbUtils();
140
  $upgrade_url = $cnb_utils->get_cnb_domain_upgrade( $domain );
141
+ $support_url = $cnb_utils->get_support_url( '', 'promobox-need-help', 'Help Center' );
142
+ $faq_url = $cnb_utils->get_support_url( 'wordpress/#faq', 'promobox-need-help', 'FAQ' );
143
  if ( isset( $upgrade_url ) && $upgrade_url ) {
144
  echo '<div class="cnb-postbox-container cnb-side-column"> <!-- Sidebar promo boxes -->';
145
  if ( $domain !== null && ! ( $domain instanceof WP_Error ) && $domain->type === 'FREE' ) {
146
+ $coupon = ( new CnbAppRemotePromotionCodes() )->get_coupon();
147
+ $discount_illustration = plugins_url( '../../../resources/images/discount.png', __FILE__ );
148
+ if ( $coupon != null && ! is_wp_error( $coupon ) ) {
149
+ ( new CnbAdminFunctions() )->cnb_promobox(
150
+ 'green',
151
+ 'SPECIAL UPGRADE OFFER!',
152
+ '<h4>Get an extra ' . esc_html( $coupon->get_discount() ) . ' off the PRO plan!</h4>' .
153
+ '<p>Enter coupon code <code class="cnb-coupon-code">' . esc_html( $coupon->code ) . '</code> during checkout.</p>' .
154
+ '<div class="cnb-center" style="padding: 10px 30px"><img src="' . esc_url( $discount_illustration ) . '" alt="Upgrade your domain to PRO with an extra discount" style="max-width:300px; width:100%; height:auto;" /></div>',
155
+ 'flag',
156
+ 'Code: <code class="cnb-coupon-code">' . esc_html( $coupon->code ) . '</code>',
157
+ 'Upgrade',
158
+ $upgrade_url
159
+ );
160
+ } else {
161
+ ( new CnbAdminFunctions() )->cnb_promobox(
162
+ 'purple',
163
+ 'Remove "Powered by"',
164
+ '<p>✨ Remove the <em>Powered by</em> notice</p>
165
+ <p><strong>Plus enable extra features:</strong><br>
166
+ 📷 Add custom images to your buttons<br>
167
+ ↕️ Buttons can appear after scrolling <br>
168
+ 🌍 Include and exclude countries</p>',
169
+ 'flag',
170
+ '<strong>&euro;<span class="eur-per-month"></span>/$<span class="usd-per-month"></span> per month</strong>',
171
+ 'Upgrade',
172
+ $upgrade_url
173
+ );
174
+ }
175
  }
176
+ $support_illustration = plugins_url( '../../../resources/images/support.png', __FILE__ );
177
  ( new CnbAdminFunctions() )->cnb_promobox(
178
  'blue',
179
  'Need help?',
180
+ '<p>Please head over to our <strong>Help Center</strong> for all your questions and support needs.</p>
181
+
182
+ <div class="cnb-right" style="padding: 10px 10px 10px 70px"><img src="' . esc_url( $support_illustration ) . '" alt="Our Help Center and support options" style="max-width:300px; width:100%; height:auto;" /></div>',
183
+ 'welcome-learn-more',
184
+ '',
185
+ 'Open Help Center',
186
+ $support_url
187
  );
188
  echo '</div>';
189
  }
src/admin/button/CnbButtonViewEdit.php CHANGED
@@ -149,14 +149,6 @@ class CnbButtonViewEdit {
149
  <th></th>
150
  <td></td>
151
  </tr>
152
- <tr>
153
- <th scope="row"><label for="button_name">Button name</label></th>
154
-
155
- <td class="activated">
156
- <input type="text" name="button[name]" id="button_name" required="required"
157
- value="<?php echo esc_attr( $button->name ); ?>"/>
158
- </td>
159
- </tr>
160
  <tr class="cnb_hide_on_modal">
161
  <th scope="row"><label for="cnb-enable">Button status</label></th>
162
 
@@ -170,6 +162,14 @@ class CnbButtonViewEdit {
170
  class="cnb_toggle_state cnb_toggle_true">Active</span>
171
  </td>
172
  </tr>
 
 
 
 
 
 
 
 
173
  <tr class="cnb_hide_on_modal cnb_advanced_view">
174
  <th scope="row"><label for="button_domain">Domain</label></th>
175
  <td>
@@ -279,7 +279,11 @@ class CnbButtonViewEdit {
279
  <table class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'extra_options' ) ) ?>"
280
  data-tab-name="extra_options">
281
  <?php if ( $button->type === 'FULL' ) { ?>
282
- <tr>
 
 
 
 
283
  <th colspan="2">
284
  <h3>Colors for the Buttonbar are defined via the individual Action(s).</h3>
285
  <input name="button[options][iconBackgroundColor]" type="hidden"
@@ -382,12 +386,26 @@ class CnbButtonViewEdit {
382
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="communicate">communicate</i>
383
  </div>
384
  <div class="cnb-button-icon">
385
- <i class="cnb-font-icon" data-icon-type="FONT"
386
- data-icon-text="more_info">more_info</i>
387
  </div>
388
  <div class="cnb-button-icon">
389
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="conversation">conversation</i>
390
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  </div>
392
  <div class="cnb_advanced_view">
393
  <a
@@ -474,7 +492,7 @@ class CnbButtonViewEdit {
474
  <?php } ?>
475
  <tr>
476
  <th scope="row">Position <a
477
- href="<?php echo esc_url( $cnb_utils->get_support_url( 'button-position/', 'question-mark', 'button-position' ) ) ?>"
478
  target="_blank" class="cnb-nounderscore">
479
  <span class="dashicons dashicons-editor-help"></span>
480
  </a></th>
149
  <th></th>
150
  <td></td>
151
  </tr>
 
 
 
 
 
 
 
 
152
  <tr class="cnb_hide_on_modal">
153
  <th scope="row"><label for="cnb-enable">Button status</label></th>
154
 
162
  class="cnb_toggle_state cnb_toggle_true">Active</span>
163
  </td>
164
  </tr>
165
+ <tr>
166
+ <th scope="row"><label for="button_name">Button name</label></th>
167
+
168
+ <td class="activated">
169
+ <input type="text" name="button[name]" id="button_name" required="required"
170
+ value="<?php echo esc_attr( $button->name ); ?>"/>
171
+ </td>
172
+ </tr>
173
  <tr class="cnb_hide_on_modal cnb_advanced_view">
174
  <th scope="row"><label for="button_domain">Domain</label></th>
175
  <td>
279
  <table class="form-table <?php echo esc_attr( $adminFunctions->is_active_tab( 'extra_options' ) ) ?>"
280
  data-tab-name="extra_options">
281
  <?php if ( $button->type === 'FULL' ) { ?>
282
+ <tr class="cnb_hide_on_modal">
283
+ <th></th>
284
+ <td></td>
285
+ </tr>
286
+ <tr class="cnb_advanced_view">
287
  <th colspan="2">
288
  <h3>Colors for the Buttonbar are defined via the individual Action(s).</h3>
289
  <input name="button[options][iconBackgroundColor]" type="hidden"
386
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="communicate">communicate</i>
387
  </div>
388
  <div class="cnb-button-icon">
389
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="more_info">more_info</i>
 
390
  </div>
391
  <div class="cnb-button-icon">
392
  <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="conversation">conversation</i>
393
  </div>
394
+ <div class="cnb-button-icon">
395
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="call3">call3</i>
396
+ </div>
397
+ <div class="cnb-button-icon">
398
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="whatsapp">whatsapp</i>
399
+ </div>
400
+ <div class="cnb-button-icon">
401
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="email">email</i>
402
+ </div>
403
+ <div class="cnb-button-icon">
404
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="call">call</i>
405
+ </div>
406
+ <div class="cnb-button-icon">
407
+ <i class="cnb-font-icon" data-icon-type="FONT" data-icon-text="directions3">directions3</i>
408
+ </div>
409
  </div>
410
  <div class="cnb_advanced_view">
411
  <a
492
  <?php } ?>
493
  <tr>
494
  <th scope="row">Position <a
495
+ href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/presentation/button-position/', 'question-mark', 'button-position' ) ) ?>"
496
  target="_blank" class="cnb-nounderscore">
497
  <span class="dashicons dashicons-editor-help"></span>
498
  </a></th>
src/admin/condition/CnbConditionViewEdit.php CHANGED
@@ -37,7 +37,30 @@ class CnbConditionViewEdit {
37
  function render_table( $condition ) {
38
  global $cnb_domain;
39
  $isPro = $cnb_domain != null && !is_wp_error($cnb_domain) && $cnb_domain->type === 'PRO';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  ?>
 
41
  <table class="form-table nav-tab-active">
42
  <tbody>
43
  <tr>
37
  function render_table( $condition ) {
38
  global $cnb_domain;
39
  $isPro = $cnb_domain != null && !is_wp_error($cnb_domain) && $cnb_domain->type === 'PRO';
40
+ $cnb_utils = new CnbUtils();
41
+ $bid = $cnb_utils->get_query_val( 'bid' );
42
+ if ( $bid !== null ) {
43
+ // Create back link
44
+ $url = admin_url( 'admin.php' );
45
+ $redirect_link = esc_url(
46
+ add_query_arg(
47
+ array(
48
+ 'page' => 'call-now-button',
49
+ 'action' => 'edit',
50
+ 'tab' => 'visibility',
51
+ 'id' => $bid
52
+ ),
53
+ $url ) );
54
+ ?>
55
+ <h2 class="nav-tab-wrapper">
56
+ <a href="<?php echo esc_url( $redirect_link ); ?>" class="cnb-nav-tab"><span
57
+ class="dashicons dashicons-arrow-left-alt"></span></a>
58
+ </h2>
59
+ <?php
60
+
61
+ }
62
  ?>
63
+
64
  <table class="form-table nav-tab-active">
65
  <tbody>
66
  <tr>
src/admin/deactivation/Activation.php CHANGED
@@ -27,9 +27,12 @@ class Activation {
27
  * It is only used to register when it was last activated,
28
  * which is used in feedback forms.
29
  *
 
 
 
30
  * @return void
31
  */
32
- public static function onActivation($set_redirect = true) {
33
  $activation = new Activation();
34
 
35
  $activation->init_activation();
27
  * It is only used to register when it was last activated,
28
  * which is used in feedback forms.
29
  *
30
+ * @param $network_wide bool ignored by this function
31
+ * @param $set_redirect bool default true
32
+ *
33
  * @return void
34
  */
35
+ public static function onActivation($network_wide = false, $set_redirect = true) {
36
  $activation = new Activation();
37
 
38
  $activation->init_activation();
src/admin/deactivation/Deactivation.php CHANGED
@@ -12,17 +12,7 @@ class Deactivation {
12
  *
13
  * @return void
14
  */
15
- static public function onDeactivation() {
16
  // Noop
17
  }
18
-
19
- /**
20
- * @return void
21
- */
22
- public function register_deactivation_popup() {
23
- global $parent_file;
24
- if ('plugins.php' === $parent_file) {
25
- wp_enqueue_script(CNB_SLUG . '-deactivation');
26
- }
27
- }
28
  }
12
  *
13
  * @return void
14
  */
15
+ static public function on_deactivation() {
16
  // Noop
17
  }
 
 
 
 
 
 
 
 
 
 
18
  }
src/admin/domain/CnbDomainViewEdit.php CHANGED
@@ -80,7 +80,7 @@ class CnbDomainViewEdit {
80
  <?php
81
  if ( $domain->type !== 'PRO' && ! empty( $domain->id ) ) {
82
  echo '<a href="' . esc_url( $upgrade_link ) . '">Upgrade!</a>
83
- <p class="description">The FREE plan offers 99% of all features but adds delicate branding to your buttons.</p>';
84
  }
85
  ?>
86
  </td>
@@ -188,9 +188,9 @@ class CnbDomainViewEdit {
188
  <label class="cnb_slider_value" for="cnb_order_slider"
189
  onclick="jQuery('#cnb_order_slider:enabled')[0].stepUp();cnb_update_sliders()">&nbsp;&raquo;&nbsp;Front</label>
190
  <p class="description">The default (and recommended) value is all the way to the front so the
191
- button sits on top of everything else. In case you have a specific usecase where you want
192
- something else to sit in front of the Call Now Button (e.g. a chat window or a cookie
193
- notice) you can move this backwards one step at a time to adapt it to your situation.</p>
194
  </td>
195
  </tr>
196
  <tr>
80
  <?php
81
  if ( $domain->type !== 'PRO' && ! empty( $domain->id ) ) {
82
  echo '<a href="' . esc_url( $upgrade_link ) . '">Upgrade!</a>
83
+ <p class="description">The FREE plan adds delicate branding to your buttons and enables most features.</p>';
84
  }
85
  ?>
86
  </td>
188
  <label class="cnb_slider_value" for="cnb_order_slider"
189
  onclick="jQuery('#cnb_order_slider:enabled')[0].stepUp();cnb_update_sliders()">&nbsp;&raquo;&nbsp;Front</label>
190
  <p class="description">The default (and recommended) value is all the way to the front so the
191
+ button sits on top of everything. <a
192
+ href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/settings/set-order/', 'domain-settings-question-mark', 'Order' ) ) ?>" target="_blank">Learn
193
+ more...</a></p>
194
  </td>
195
  </tr>
196
  <tr>
src/admin/domain/CnbDomainViewUpgrade.php CHANGED
@@ -68,6 +68,8 @@ class CnbDomainViewUpgrade {
68
  if ( $notice ) {
69
  // And if so, refetch the domain
70
  $domain = CnbDomain::setSaneDefault( $this->get_domain() );
 
 
71
  }
72
  wp_enqueue_script( CNB_SLUG . '-domain-upgrade' );
73
 
68
  if ( $notice ) {
69
  // And if so, refetch the domain
70
  $domain = CnbDomain::setSaneDefault( $this->get_domain() );
71
+ // Also flush the cache
72
+ do_action( 'cnb_after_button_changed' );
73
  }
74
  wp_enqueue_script( CNB_SLUG . '-domain-upgrade' );
75
 
src/admin/domain/partials/CnbDomainViewUpgradeFinished.php CHANGED
@@ -6,6 +6,7 @@ namespace cnb\admin\domain;
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
8
  use cnb\admin\api\CnbAppRemote;
 
9
  use cnb\notices\CnbAdminNotices;
10
  use cnb\notices\CnbNotice;
11
  use cnb\utils\CnbUtils;
@@ -27,6 +28,59 @@ class CnbDomainViewUpgradeFinished {
27
  return esc_url( $tab_link );
28
  }
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  /**
31
  * print SVG wrapped in a div with a big, nice and pretty "Yay!"
32
  *
@@ -43,42 +97,37 @@ class CnbDomainViewUpgradeFinished {
43
  * @return void
44
  */
45
  function render( $domain, $notice = null ) {
46
- $cnb_utils = new CnbUtils();
47
- $support_url = $cnb_utils->get_support_url('', 'upgrade-success-page', 'help-center');
48
-
49
- $portal_url = CnbAppRemote::cnb_remote_create_billing_portal();
50
-
51
- echo '<p>Your domain <strong>' . esc_html( $domain->name ) . '</strong> ';
52
- echo 'is currently on the <code>' . esc_html( $domain->type ) . '</code> cloud plan.</p>';
53
 
54
  // Render notice if JUST upgraded and show general information about domain (instead of upgrade form)
55
  if ( $notice ) {
56
  CnbAdminNotices::get_instance()->renderNotice( $notice );
57
  // Big "Yay!"
58
- echo '<div style="width:200px; height:auto">';
 
59
  $this->echoBigYaySvg();
60
  echo '</div>';
61
- echo '<h1><strong>' . esc_html( $domain->name ) . '</strong> has been successfully upgraded!</h1>';
62
- echo '<h3>All branding has been removed from your buttons and you can enjoy:</h3>';
63
- echo '<div>';
64
- echo '<div><b>&check;</b> Phone, Email, Location, WhatsApp, Links, Maps, Anchor links with smooth scroll, Signal, Telegram, Facebook Messenger and more.</div>';
65
- echo '<div><b>&check;</b> Lots of buttons</div>';
66
- echo '<div><b>&check;</b> Multibutton (expandable multi action single button)</div>';
67
- echo '<div><b>&check;</b> Buttonbar (full width button with up to 5 actions)</div>';
68
- echo '<div><b>&check;</b> Advanced page targeting options</div>';
69
- echo '<div><b>&check;</b> Scheduling</div>';
70
- echo '<div><b>&check;</b> And much more!</div>';
71
  echo '</div>';
 
 
 
72
  }
73
 
 
74
  echo '<p>';
75
  if ( ! empty( $domain->expires ) ) {
76
  echo 'Your subscription will';
77
  echo $domain->renew == 1 ? ' renew automatically ' : ' expire ';
78
  echo 'on ' . esc_html( date( 'F d, Y', strtotime( $domain->expires ) ) ) . '.';
79
  }
80
- echo 'Review your settings on the <a href="' . esc_url( $this->get_settings_url() ) . '">settings page</a>.</p>';
81
- echo '<p>You can access and download your invoice via <a target="_blank" href="' . esc_url( $portal_url->url ) . '">the invoice dashboard</a>. ';
82
- echo 'For any questions, please head over to our <a href="' . esc_url( $support_url ) . '">help center</a>.</p>';
83
  }
84
  }
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
8
  use cnb\admin\api\CnbAppRemote;
9
+ use cnb\admin\domain\CnbDomainViewUpgradeOverview;
10
  use cnb\notices\CnbAdminNotices;
11
  use cnb\notices\CnbNotice;
12
  use cnb\utils\CnbUtils;
28
  return esc_url( $tab_link );
29
  }
30
 
31
+ /**
32
+ * @return string
33
+ */
34
+ private function get_button_overview_url() {
35
+ $url = admin_url( 'admin.php' );
36
+
37
+ return add_query_arg(
38
+ array(
39
+ 'page' => 'call-now-button',
40
+ ),
41
+ $url );
42
+ }
43
+ /**
44
+ * Print Cloud benefits
45
+ *
46
+ * @return void
47
+ */
48
+ private function renderBenefits() {
49
+ echo '<div>';
50
+ echo '<h1 class="cnb-center top-50"><strong>Other features include:</strong></h1><hr>';
51
+ ( new CnbDomainViewUpgradeOverview() )->renderBenefits();
52
+ echo '</div>';
53
+ }
54
+
55
+ private function renderLetsGo() {
56
+ $portal_url = CnbAppRemote::cnb_remote_create_billing_portal();
57
+ echo sprintf( '
58
+ <div class="cnb-get-started cnb-plan-features cnb-center top-50">
59
+ <h1 class="cnb-center"><strong>Let\'s get started</strong></h1><hr>
60
+ <div class="cnb-flexbox">
61
+ <div class="box">
62
+ <h2>Manage your buttons</h2>
63
+ <p>
64
+ <a class="button premium-button" href="%1$s">Button overview</a>
65
+ </p>
66
+ </div>
67
+ <div class="box">
68
+ <h2>Check your Settings</h2>
69
+ <p><a class="button premium-button" href="%2$s">Open settings
70
+ </a></p>
71
+ </div>
72
+ <div class="box">
73
+ <h2>Administration</h2>
74
+ <p><a class="button premium-button" href="%3$s">Invoices</a></p>
75
+ </div>
76
+ </div>
77
+ </div>',
78
+ esc_url( $this->get_button_overview_url() ),
79
+ esc_url( $this->get_settings_url() ),
80
+ esc_url( $portal_url->url )
81
+ );
82
+ }
83
+
84
  /**
85
  * print SVG wrapped in a div with a big, nice and pretty "Yay!"
86
  *
97
  * @return void
98
  */
99
  function render( $domain, $notice = null ) {
100
+ if($domain->type != 'PRO') {
101
+ echo '<p>Your domain <strong>' . esc_html( $domain->name ) . '</strong> ';
102
+ echo 'is currently on the <code>' . esc_html( $domain->type ) . '</code> cloud plan.</p>';
103
+ }
 
 
 
104
 
105
  // Render notice if JUST upgraded and show general information about domain (instead of upgrade form)
106
  if ( $notice ) {
107
  CnbAdminNotices::get_instance()->renderNotice( $notice );
108
  // Big "Yay!"
109
+ echo '<h1 class="cnb-upgrade-title"><span style="text-transform:uppercase">' . esc_html( $domain->name ) . '</span> is now a PRO domain!</h1>';
110
+ echo '<div style="width:200px; height:auto; margin:0 auto">';
111
  $this->echoBigYaySvg();
112
  echo '</div>';
113
+ echo '<div class="cnb-pricebox">';
114
+ echo '<div class="cnb-benefit">✨ All "Powered by" notices are removed! ✨</div>';
115
+ echo '<div class="cnb-benefit">📷 Use custom images on buttons 📷</div>';
116
+ echo '<div class="cnb-benefit">🌍 You can include and exclude countries 🌍</div>';
117
+ echo '<div class="cnb-benefit">↕️ Set a scroll height for buttons to appear ↕️</div>';
 
 
 
 
 
118
  echo '</div>';
119
+
120
+ $this->renderLetsGo();
121
+ $this->renderBenefits();
122
  }
123
 
124
+
125
  echo '<p>';
126
  if ( ! empty( $domain->expires ) ) {
127
  echo 'Your subscription will';
128
  echo $domain->renew == 1 ? ' renew automatically ' : ' expire ';
129
  echo 'on ' . esc_html( date( 'F d, Y', strtotime( $domain->expires ) ) ) . '.';
130
  }
131
+
 
 
132
  }
133
  }
src/admin/domain/partials/CnbDomainViewUpgradeOverview.php CHANGED
@@ -6,6 +6,7 @@ namespace cnb\admin\domain;
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
8
  use cnb\admin\api\CnbAppRemotePayment;
 
9
  use cnb\admin\models\CnbPlan;
10
  use cnb\admin\models\CnbUser;
11
 
@@ -37,10 +38,31 @@ class CnbDomainViewUpgradeOverview {
37
  <code><?php echo esc_html( $domain->type ) ?></code> plan.</p>
38
  <?php } ?>
39
 
40
- <h2>Select a plan that works best for <strong><?php echo esc_html( $domain->name ) ?></strong></h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  <?php
42
  $this->renderUpgradeForm( $domain );
43
- echo '<h3 class="cnb-center">All plans contain the following features:</h3>';
44
  $this->renderBenefits();
45
  }
46
 
@@ -54,26 +76,6 @@ class CnbDomainViewUpgradeOverview {
54
  }
55
  }
56
 
57
- private function renderStripeJs() {
58
- // Stripe integration
59
- // phpcs:ignore WordPress.WP
60
- echo '<script src="https://js.stripe.com/v3/"></script>';
61
- echo '<script>
62
- jQuery(() => {
63
- try {
64
- stripe = Stripe("' . esc_js( CnbAppRemotePayment::cnb_remote_get_stripe_key()->key ) . '");
65
- } catch(e) {
66
- // Do not show "Live Stripe.js integrations must use HTTPS", we deal with that particular error internally
67
- if (e && e.message.includes("Live Stripe.js integrations must use HTTPS")) {
68
- return;
69
- }
70
-
71
- cnb_stripe_show_message("error", e);
72
- }
73
- });
74
- </script>';
75
- }
76
-
77
  /**
78
  * @param $domain CnbDomain
79
  *
@@ -81,7 +83,6 @@ class CnbDomainViewUpgradeOverview {
81
  */
82
  public function renderUpgradeForm( $domain ) {
83
  global $cnb_user;
84
- $this->renderStripeJs();
85
  $this->renderJsToHideCurrency( $cnb_user );
86
  $plans = CnbAppRemotePayment::cnb_remote_get_plans();
87
  $active_currency = $this->getActiveCurrency( $cnb_user );
@@ -89,124 +90,63 @@ class CnbDomainViewUpgradeOverview {
89
  ?>
90
  <form id="wp_domain_upgrade" method="post">
91
  <input type="hidden" name="cnb_domain_id" id="cnb_domain_id" value="<?php echo esc_attr( $domain->id ) ?>">
92
- <h2 class="nav-tab-wrapper">
93
- <a
94
- href="#"
95
- data-cnb-currency="eur"
96
- class="cnb-currency-select cnb-currency-eur nav-tab
97
- <?php if ( $active_currency !== 'usd' ) { ?>nav-tab-active<?php } ?>">
98
- Euro (&euro;)</a>
99
- <a
100
- href="#"
101
- data-cnb-currency="usd"
102
- class="cnb-currency-select
103
- cnb-currency-usd
104
- nav-tab
105
- <?php if ( $active_currency === 'usd' ) { ?>nav-tab-active<?php } ?>">
106
- US Dollar ($)</a>
107
- </h2>
108
- <div class="cnb-message notice"><p class="cnb-error-message"></p></div>
109
  <div class="cnb-price-plans">
 
 
110
  <div class="currency-box
111
  currency-box-eur
112
  cnb-flexbox
113
- <?php if ( $active_currency !== 'usd' ) { ?>currency-box-active<?php } ?>">
114
  <?php
115
- $plan = $this->get_plan( $plans, 'powered-by-eur-yearly' );
116
- $plan_x = floor( $plan->price / 12.0 );
117
- $plan_y = round( ( $plan->price / 12.0 ) - floor( $plan->price / 12.0 ), 2 ) * 100;
118
-
119
  $plan_month = $this->get_plan( $plans, 'powered-by-eur-monthly' );
120
- $annual_discount = $domain_controller->get_discount_percentage($plan, $plan_month)
 
 
121
  ?>
122
- <div class="pricebox">
123
- <h3 class="yearly"><span class="cnb-premium-label">PRO </span>Yearly <span class="cnb-green">Save <?php echo esc_html( $annual_discount ); ?>%!</span></h3>
124
- <div class="benefit">🧰 All features from Cloud</div>
125
- <div class="benefit">✨ "Powered by" notice removed</div>
126
- <div class="benefit">🌍 Include and exclude countries</div>
127
- <div class="benefit">↕️ Set scroll height for buttons to appear</div>
128
- <div class="plan-amount"><span class="currency">€</span><span
129
- class="euros"><?php echo esc_html( $plan_x ) ?></span><span
130
- class="cents">.<?php echo esc_html( $plan_y ) ?></span><span class="timeframe">/month</span>
131
- </div>
132
- <div class="billingprice">
133
- Billed annually
134
- </div>
135
- <a class="button button-primary button-upgrade powered-by-eur-yearly" href="#"
136
- onclick="cnb_get_checkout('<?php echo esc_js( $plan->id ) ?>')">Upgrade</a>
137
- </div>
138
 
139
- <?php
140
- $plan = $this->get_plan( $plans, 'powered-by-eur-monthly' );
141
- $plan_x = floor( $plan->price );
142
- $plan_y = round( ( $plan->price ) - floor( $plan->price ), 2 ) * 100;
143
- ?>
144
- <div class="pricebox">
145
- <h3 class="monthly"><span class="cnb-premium-label">PRO </span>Monthly</h3>
146
- <div class="benefit">🧰 All features from Cloud</div>
147
- <div class="benefit">✨ "Powered by" notice removed</div>
148
- <div class="benefit">🌍 Include and exclude countries</div>
149
- <div class="benefit">↕️ Set scroll height for buttons to appear</div>
150
  <div class="plan-amount"><span class="currency">€</span><span
151
  class="euros"><?php echo esc_html( $plan_x ) ?></span><span
152
- class="cents">.<?php echo esc_html( $plan_y ) ?></span><span class="timeframe">/month</span>
153
  </div>
154
  <div class="billingprice">
155
- Billed monthly
156
  </div>
157
  <a class="button button-secondary button-upgrade powered-by-eur-monthly" href="#"
158
- onclick="cnb_get_checkout('<?php echo esc_js( $plan->id ) ?>')">Upgrade</a>
 
 
159
  </div>
160
- </div>
161
- <div class="currency-box
162
- currency-box-usd
163
- cnb-flexbox
164
- <?php if ( $active_currency === 'usd' ) { ?>currency-box-active<?php } ?>">
165
- <?php
166
- $plan = $this->get_plan( $plans, 'powered-by-usd-yearly' );
167
- $plan_x = floor( $plan->price / 12.0 );
168
- $plan_y = round( ( $plan->price / 12.0 ) - floor( $plan->price / 12.0 ), 2 ) * 100;
169
 
170
- $plan_month = $this->get_plan( $plans, 'powered-by-usd-monthly' );
171
- $annual_discount = $domain_controller->get_discount_percentage($plan, $plan_month)
172
- ?>
173
- <div class="pricebox">
174
- <h3 class="yearly"><span class="cnb-premium-label">PRO </span>Yearly <span class="cnb-green">Save <?php echo esc_html( $annual_discount ); ?>%!</span></h3>
175
- <div class="benefit">🧰 All features from Cloud</div>
176
- <div class="benefit">✨ "Powered by" notice removed</div>
177
- <div class="benefit">🌍 Include and exclude countries</div>
178
- <div class="benefit">↕️ Set scroll height for buttons to appear</div>
179
- <div class="plan-amount"><span class="currency">$</span><span
180
- class="euros"><?php echo esc_html( $plan_x ) ?></span><span
181
- class="cents">.<?php echo esc_html( $plan_y ) ?></span><span class="timeframe">/month</span>
182
- </div>
183
- <div class="billingprice">
184
- Billed annually
185
- </div>
186
- <a class="button button-primary button-upgrade powered-by-usd-yearly" href="#"
187
- onclick="cnb_get_checkout('<?php echo esc_js( $plan->id ) ?>')">Upgrade</a>
188
- </div>
189
  <?php
190
- $plan = $this->get_plan( $plans, 'powered-by-usd-monthly' );
191
- $plan_x = floor( $plan->price );
192
- $plan_y = round( ( $plan->price ) - floor( $plan->price ), 2 ) * 100;
 
 
193
  ?>
194
- <div class="pricebox">
195
- <h3 class="monthly"><span class="cnb-premium-label">PRO </span>Monthly</h3>
196
- <div class="benefit">🧰 All features from Cloud</div>
197
- <div class="benefit">✨ "Powered by" notice removed</div>
198
- <div class="benefit">🌍 Include and exclude countries</div>
199
- <div class="benefit">↕️ Set scroll height for buttons to appear</div>
200
  <div class="plan-amount"><span class="currency">$</span><span
201
  class="euros"><?php echo esc_html( $plan_x ) ?></span><span
202
  class="cents">.<?php echo esc_html( $plan_y ) ?></span><span class="timeframe">/month</span>
203
  </div>
204
  <div class="billingprice">
205
- Billed monthly
206
  </div>
207
- <a class="button button-secondary button-upgrade powered-by-usd-monthly" href="#"
208
- onclick="cnb_get_checkout('<?php echo esc_js( $plan->id ) ?>')">Upgrade</a>
 
 
209
  </div>
 
210
  </div>
211
  </div>
212
  </form>
@@ -235,6 +175,8 @@ class CnbDomainViewUpgradeOverview {
235
  (Add up to 5 actions to a full width button)
236
  </li>
237
  <li><strong>WhatsApp modal</strong><br>A chat-like modal to kickstart the conversation</li>
 
 
238
  </ul>
239
  <ul class="cnb-checklist">
240
  <li><strong>Button animations</strong><br>Draw more attention to your buttons with subtle
@@ -245,6 +187,8 @@ class CnbDomainViewUpgradeOverview {
245
  <li><strong>Advanced page targeting options</strong><br>Ability to select full URLs, entire
246
  folders or even url parameters
247
  </li>
 
 
248
  <li><strong>Scheduling</strong><br>Select days and times your buttons should be visible</li>
249
  <li><strong>And so much more!</strong></li>
250
  </ul>
@@ -266,5 +210,4 @@ class CnbDomainViewUpgradeOverview {
266
 
267
  return null;
268
  }
269
-
270
  }
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
8
  use cnb\admin\api\CnbAppRemotePayment;
9
+ use cnb\admin\api\CnbAppRemotePromotionCodes;
10
  use cnb\admin\models\CnbPlan;
11
  use cnb\admin\models\CnbUser;
12
 
38
  <code><?php echo esc_html( $domain->type ) ?></code> plan.</p>
39
  <?php } ?>
40
 
41
+ <?php
42
+
43
+ $coupon = (new CnbAppRemotePromotionCodes())->get_coupon();
44
+ if ($coupon != null && !is_wp_error($coupon)) { ?>
45
+ <div class="cnb-promo-bar cnb-flexbox">
46
+ <div class="cnb_align_right cnb-coupon-timer" style="width:100%; padding-right:10px;" id="cnb-coupon-expiration-countdown" data-coupon-expiration-time="<?php echo esc_attr($coupon->redeemBy);?>">
47
+ Coupon expires in <?php echo esc_html($coupon->get_redeem_by()) ?>
48
+ </div>
49
+ <div class="cnb-coupon-details">
50
+ <h5>USE COUPON <code class="cnb-coupon-code"><?php echo esc_html($coupon->code); ?></code> FOR EXTRA <?php echo esc_html($coupon->get_discount()); ?> DISCOUNT</h5>
51
+ <p>Add coupon code <code class="cnb-coupon-code"><?php echo esc_html($coupon->code); ?></code> during checkout for an extra <strong><?php echo esc_html($coupon->get_discount()); ?></strong> off <?php echo esc_html($coupon->get_period()); ?> on <?php echo esc_html($coupon->get_plan()); ?>.</div>
52
+ </div>
53
+ <?php } ?>
54
+
55
+ <h1 class="cnb-upgrade-title">Upgrade <?php echo esc_html( $domain->name ) ?> to PRO</h1>
56
+ <div class="cnb-pricebox">
57
+ <div class="cnb-benefit">🧰 All features from Cloud</div>
58
+ <div class="cnb-benefit">✨ "Powered by" notice removed</div>
59
+ <div class="cnb-benefit">📷 Use custom images on buttons</div>
60
+ <div class="cnb-benefit">🌍 Include and exclude countries</div>
61
+ <div class="cnb-benefit">↕️ Set scroll height for buttons to appear</div>
62
+ </div>
63
  <?php
64
  $this->renderUpgradeForm( $domain );
65
+ echo '<h3 class="cnb-center cnb-plan-features">All plans contain the following features:</h3>';
66
  $this->renderBenefits();
67
  }
68
 
76
  }
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  /**
80
  * @param $domain CnbDomain
81
  *
83
  */
84
  public function renderUpgradeForm( $domain ) {
85
  global $cnb_user;
 
86
  $this->renderJsToHideCurrency( $cnb_user );
87
  $plans = CnbAppRemotePayment::cnb_remote_get_plans();
88
  $active_currency = $this->getActiveCurrency( $cnb_user );
90
  ?>
91
  <form id="wp_domain_upgrade" method="post">
92
  <input type="hidden" name="cnb_domain_id" id="cnb_domain_id" value="<?php echo esc_attr( $domain->id ) ?>">
93
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  <div class="cnb-price-plans">
95
+ <div class="cnb-message notice"><p class="cnb-error-message"></p></div>
96
+
97
  <div class="currency-box
98
  currency-box-eur
99
  cnb-flexbox
100
+ ">
101
  <?php
102
+ $plan_year = $this->get_plan( $plans, 'powered-by-eur-yearly' );
 
 
 
103
  $plan_month = $this->get_plan( $plans, 'powered-by-eur-monthly' );
104
+ $annual_discount = $domain_controller->get_discount_percentage($plan_year, $plan_month);
105
+ $plan_x = floor( $plan_month->price );
106
+ $plan_y = round( ( $plan_month->price ) - floor( $plan_month->price ), 2 ) * 100;
107
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
 
109
+ <div class="cnb-pricebox cnb-currency-box
110
+ <?php if ( $active_currency !== 'usd' ) { ?>currency-box-active<?php } ?>">
111
+ <h3 class="cnb-price-eur"><span class="cnb-premium-label">PRO </span>&euro;</h3>
112
+
 
 
 
 
 
 
 
113
  <div class="plan-amount"><span class="currency">€</span><span
114
  class="euros"><?php echo esc_html( $plan_x ) ?></span><span
115
+ class="cents">.<?php echo esc_html( $plan_y ) ?></span><span class="timeframe">/monthly</span>
116
  </div>
117
  <div class="billingprice">
118
+ <span class="">Pay yearly and save <?php echo esc_html( $annual_discount ); ?>%!</span>
119
  </div>
120
  <a class="button button-secondary button-upgrade powered-by-eur-monthly" href="#"
121
+ onclick="cnb_get_checkout('<?php echo esc_js( $plan_month->id ) ?>')">Pay monthly</a>
122
+ <a class="button button-primary button-upgrade powered-by-eur-yearly" href="#"
123
+ onclick="cnb_get_checkout('<?php echo esc_js( $plan_year->id ) ?>')">Pay yearly</a>
124
  </div>
 
 
 
 
 
 
 
 
 
125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  <?php
127
+ $plan_year = $this->get_plan( $plans, 'powered-by-usd-yearly' );
128
+ $plan_month = $this->get_plan( $plans, 'powered-by-usd-monthly' );
129
+ $plan_x = floor( $plan_month->price );
130
+ $plan_y = round( ( $plan_month->price ) - floor( $plan_month->price ), 2 ) * 100;
131
+ $annual_discount = $domain_controller->get_discount_percentage($plan_year, $plan_month);
132
  ?>
133
+ <div class="cnb-pricebox cnb-currency-box
134
+ <?php if ( $active_currency !== 'eur' ) { ?>currency-box-active<?php } ?>">
135
+ <h3 class="cnb-price-usd"><span class="cnb-premium-label">PRO </span>$</h3>
136
+
 
 
137
  <div class="plan-amount"><span class="currency">$</span><span
138
  class="euros"><?php echo esc_html( $plan_x ) ?></span><span
139
  class="cents">.<?php echo esc_html( $plan_y ) ?></span><span class="timeframe">/month</span>
140
  </div>
141
  <div class="billingprice">
142
+ <span class="">Pay yearly and save <?php echo esc_html( $annual_discount ); ?>%!</span>
143
  </div>
144
+ <a class="button button-secondary button-upgrade powered-by-eur-monthly" href="#"
145
+ onclick="cnb_get_checkout('<?php echo esc_js( $plan_month->id ) ?>')">Pay monthly</a>
146
+ <a class="button button-primary button-upgrade powered-by-eur-yearly" href="#"
147
+ onclick="cnb_get_checkout('<?php echo esc_js( $plan_year->id ) ?>')">Pay yearly</a>
148
  </div>
149
+
150
  </div>
151
  </div>
152
  </form>
175
  (Add up to 5 actions to a full width button)
176
  </li>
177
  <li><strong>WhatsApp modal</strong><br>A chat-like modal to kickstart the conversation</li>
178
+ <li><strong>Iframe pop-up</strong><br>Slide in a window with any url to keep people on the page.</li>
179
+ <li><strong>Intercom integration</strong><br>Fire Intercom from a matching style button.</li>
180
  </ul>
181
  <ul class="cnb-checklist">
182
  <li><strong>Button animations</strong><br>Draw more attention to your buttons with subtle
187
  <li><strong>Advanced page targeting options</strong><br>Ability to select full URLs, entire
188
  folders or even url parameters
189
  </li>
190
+ <li><strong>Clicks & conversions</strong><br>Clicks & conversion tracking with Google
191
+ </li>
192
  <li><strong>Scheduling</strong><br>Select days and times your buttons should be visible</li>
193
  <li><strong>And so much more!</strong></li>
194
  </ul>
210
 
211
  return null;
212
  }
 
213
  }
src/admin/getting-started/class-getting-started-view.php CHANGED
@@ -29,11 +29,13 @@ class GettingStartedView {
29
  <h1>Welcome to Call Now Button</h1>
30
  <h3>Thank you for choosing Call Now Button - The web's most popular click-to-call button</h3>
31
  <div class="cnb-divider"></div>
32
- <h2>Create a (free) account to enable additional features:</h2>
33
  <div class="cnb-block cnb-features-list">
34
  <div class="cnb-column cnb-col-1">
35
- <h3>🎁 Additional actions</h3>
36
- <p>SMS/Text, Email, Maps, URLs, Scroll to point, WhatsApp, Messenger, Telegram, Signal</p>
 
 
37
  <h3>🆕 Lots of buttons</h3>
38
  <p>Multiple buttons for your website, even on a single page</p>
39
  <h3>🗂️ Multi action buttons</h3>
@@ -53,6 +55,9 @@ class GettingStartedView {
53
  <p>Add extra attention grabbing animations</p>
54
  <h3>🎨 Icon picker</h3>
55
  <p>Select the right icon for your button</p>
 
 
 
56
  </div>
57
  </div>
58
  <div class="cnb-block cnb-signup-box">
@@ -66,7 +71,7 @@ class GettingStartedView {
66
 
67
  <div class="cnb-block">
68
  <h1>Why do I need an account?</h1>
69
- <h3>With an account you enabable the cloud features from callnowbutton.com.</h3>
70
  <p>Here's a close-up of some of the cloud features:</p>
71
  <div class="cnb-divider"></div>
72
 
@@ -76,7 +81,7 @@ class GettingStartedView {
76
 
77
  <div class="cnb-divider"></div>
78
 
79
- <h2>💬 WhatsApp chat modal 💬</h2>
80
  <img src="<?php echo esc_url(WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/whatsapp-modal.png');?>" alt="WhatsApp modal">
81
  <p>Start the WhatsApp conversation on your website.</p>
82
 
@@ -84,7 +89,7 @@ class GettingStartedView {
84
 
85
  <h2>💎 Multibutton 💎</h2>
86
  <img class="cnb-width-80" src="<?php echo esc_url(WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/multibutton.png');?>" alt="Multibutton">
87
- <p>Takes up little space but reaveals a treasure of options.</p>
88
 
89
  <div class="cnb-divider"></div>
90
 
@@ -102,6 +107,15 @@ class GettingStartedView {
102
  <h3>And much more!</h3>
103
  </div>
104
  </div>
 
 
 
 
 
 
 
 
 
105
  <div class="cnb-welcome-blocks">
106
  <div class="cnb-block cnb-signup-box">
107
  <h2>Create your free account and supercharge your Call Now Button.</h2>
@@ -110,6 +124,6 @@ class GettingStartedView {
110
  <div class="cnb-divider"></div>
111
  <p><i>Only need a Call button? <a href="<?php echo esc_url( $link ) ?>">Continue without an account</a>.</i></p>
112
  </div>
113
- </div>
114
  <?php }
115
  }
29
  <h1>Welcome to Call Now Button</h1>
30
  <h3>Thank you for choosing Call Now Button - The web's most popular click-to-call button</h3>
31
  <div class="cnb-divider"></div>
32
+ <h2>Create an account to enable additional features:</h2>
33
  <div class="cnb-block cnb-features-list">
34
  <div class="cnb-column cnb-col-1">
35
+ <h3>👋 Additional actions</h3>
36
+ <p>SMS/Text, Email, Maps, URLs, Scroll to top</p>
37
+ <h3>🤗 Social chat</h3>
38
+ <p>WhatsApp, Messenger, Telegram, Signal</p>
39
  <h3>🆕 Lots of buttons</h3>
40
  <p>Multiple buttons for your website, even on a single page</p>
41
  <h3>🗂️ Multi action buttons</h3>
55
  <p>Add extra attention grabbing animations</p>
56
  <h3>🎨 Icon picker</h3>
57
  <p>Select the right icon for your button</p>
58
+ <h3>👽 3rd party integrations</h3>
59
+ <p>Iframes, Intercom chat and Tally forms</p>
60
+
61
  </div>
62
  </div>
63
  <div class="cnb-block cnb-signup-box">
71
 
72
  <div class="cnb-block">
73
  <h1>Why do I need an account?</h1>
74
+ <h3>With an account you enable the cloud features from callnowbutton.com.</h3>
75
  <p>Here's a close-up of some of the cloud features:</p>
76
  <div class="cnb-divider"></div>
77
 
81
 
82
  <div class="cnb-divider"></div>
83
 
84
+ <h2>💬 Pop up windows for WhatsApp, iframes & more 💬</h2>
85
  <img src="<?php echo esc_url(WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/whatsapp-modal.png');?>" alt="WhatsApp modal">
86
  <p>Start the WhatsApp conversation on your website.</p>
87
 
89
 
90
  <h2>💎 Multibutton 💎</h2>
91
  <img class="cnb-width-80" src="<?php echo esc_url(WP_PLUGIN_URL . '/' . CNB_BASEFOLDER . '/resources/images/multibutton.png');?>" alt="Multibutton">
92
+ <p>Takes up little space but reveals a treasure of options.</p>
93
 
94
  <div class="cnb-divider"></div>
95
 
107
  <h3>And much more!</h3>
108
  </div>
109
  </div>
110
+ <div class="cnb-welcome-blocks">
111
+ <h2>PRO features include</h2>
112
+ <div class="cnb-center">
113
+ <h3>📷 Use custom images on buttons</h3>
114
+ <h3>🌍 Include and exclude countries</h3>
115
+ <h3>↕️ Set scroll height for buttons to appear</h3>
116
+ </div>
117
+ </div>
118
+ </div>
119
  <div class="cnb-welcome-blocks">
120
  <div class="cnb-block cnb-signup-box">
121
  <h2>Create your free account and supercharge your Call Now Button.</h2>
124
  <div class="cnb-divider"></div>
125
  <p><i>Only need a Call button? <a href="<?php echo esc_url( $link ) ?>">Continue without an account</a>.</i></p>
126
  </div>
127
+
128
  <?php }
129
  }
src/admin/legacy/CnbLegacyEdit.php CHANGED
@@ -225,15 +225,14 @@ class CnbLegacyEdit {
225
  value="<?php echo esc_attr( $cnb_options['number'] ) ?>"/></td>
226
  </tr>
227
  <tr class="button-text">
228
- <th scope="row"><label for="buttonTextField">Button text</label> <small
229
- style="font-weight: 400">(optional)</small> <a
230
  href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/basics/using-text-buttons/', 'legacy-basics-question-mark', 'using-text-buttons' ) ) ?>"
231
  target="_blank" class="cnb-nounderscore">
232
  <span class="dashicons dashicons-editor-help"></span>
233
  </a></th>
234
  <td>
235
  <input id="buttonTextField" type="text" name="cnb[text]"
236
- value="<?php echo esc_attr( $cnb_options['text'] ) ?>" maxlength="30"/>
237
  <p class="description">Leave this field empty to only show an icon.</p>
238
  </td>
239
  </tr>
225
  value="<?php echo esc_attr( $cnb_options['number'] ) ?>"/></td>
226
  </tr>
227
  <tr class="button-text">
228
+ <th scope="row"><label for="buttonTextField">Button text</label><a
 
229
  href="<?php echo esc_url( $cnb_utils->get_support_url( 'wordpress-free/basics/using-text-buttons/', 'legacy-basics-question-mark', 'using-text-buttons' ) ) ?>"
230
  target="_blank" class="cnb-nounderscore">
231
  <span class="dashicons dashicons-editor-help"></span>
232
  </a></th>
233
  <td>
234
  <input id="buttonTextField" type="text" name="cnb[text]"
235
+ value="<?php echo esc_attr( $cnb_options['text'] ) ?>" maxlength="30" placeholder="Optional"/>
236
  <p class="description">Leave this field empty to only show an icon.</p>
237
  </td>
238
  </tr>
src/admin/legacy/CnbLegacyUpgrade.php CHANGED
@@ -117,7 +117,7 @@ class CnbLegacyUpgrade {
117
  WordPress powered website. The Cloud version of the Call Now Button can be used by everyone on any website. You can
118
  continue to manage your buttons from your WordPress instance, but you could also do this via our web
119
  app on <a href="https://callnowbutton.com" target="_blank">callnowbutton.com</a>. And should you ever move to a different CMS, your button(s) will just move with you.</p>
120
- <h3>What is the "powered by" notice?</h3>
121
  <p>The cloud version of Call Now Button is available for a small yearly or monthly fee, but there is also a
122
  <em>free</em> option. The free option introduces a small notice to your buttons that says "Powered by Call
123
  Now Button". It's very delicate and will not distract the the visitor from your content.</p>
117
  WordPress powered website. The Cloud version of the Call Now Button can be used by everyone on any website. You can
118
  continue to manage your buttons from your WordPress instance, but you could also do this via our web
119
  app on <a href="https://callnowbutton.com" target="_blank">callnowbutton.com</a>. And should you ever move to a different CMS, your button(s) will just move with you.</p>
120
+ <h3>What is the "Powered by" notice?</h3>
121
  <p>The cloud version of Call Now Button is available for a small yearly or monthly fee, but there is also a
122
  <em>free</em> option. The free option introduces a small notice to your buttons that says "Powered by Call
123
  Now Button". It's very delicate and will not distract the the visitor from your content.</p>
src/admin/partials/CnbHeaderNotices.php CHANGED
@@ -222,6 +222,7 @@ class CnbHeaderNotices {
222
  */
223
  function get_show_changelog_versions() {
224
  return array(
 
225
  '1.1.4',
226
  '1.0.6'
227
  );
222
  */
223
  function get_show_changelog_versions() {
224
  return array(
225
+ '1.2.0',
226
  '1.1.4',
227
  '1.0.6'
228
  );
src/admin/settings/CnbApiKeyActivatedView.php CHANGED
@@ -77,7 +77,6 @@ class CnbApiKeyActivatedView {
77
 
78
  if ( is_wp_error( $button ) ) {
79
  $this->renderButtonError( $button );
80
-
81
  return;
82
  }
83
 
@@ -142,6 +141,64 @@ class CnbApiKeyActivatedView {
142
  $nonce_field );
143
  }
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  /**
146
  *
147
  * @return void
@@ -156,8 +213,14 @@ class CnbApiKeyActivatedView {
156
  return;
157
  }
158
  echo '<div class="cnb-plan-features cnb-center top-50">';
159
- echo '<h1><strong>Upgrade to PRO!</strong></h1>';
160
- echo '<h3>🤩 All features from Cloud plus more! 🤩</h3>';
 
 
 
 
 
 
161
  ( new CnbDomainViewUpgradeOverview() )->renderUpgradeForm( $domain );
162
  echo '</div>';
163
  }
@@ -195,6 +258,7 @@ class CnbApiKeyActivatedView {
195
  if ( $this->activation->success || ! is_wp_error( $user ) ) {
196
  $this->renderBenefits();
197
  $this->renderGetStarted();
 
198
  $this->renderUpgradeToPro();
199
  } else {
200
  $this->renderActivationFailure( $user );
77
 
78
  if ( is_wp_error( $button ) ) {
79
  $this->renderButtonError( $button );
 
80
  return;
81
  }
82
 
141
  $nonce_field );
142
  }
143
 
144
+ private function renderOnboarding() {
145
+ $img_scheduling = plugins_url( '../../../resources/images/onboarding/action-scheduling.png', __FILE__ );
146
+ $img_action_extras = plugins_url( '../../../resources/images/onboarding/action-extra-options.png', __FILE__ );
147
+ $img_actions = plugins_url( '../../../resources/images/onboarding/actions-overview.png', __FILE__ );
148
+ $img_add_action = plugins_url( '../../../resources/images/onboarding/add-action.png', __FILE__ );
149
+ $img_add_rule = plugins_url( '../../../resources/images/onboarding/add-display-rule.png', __FILE__ );
150
+ $img_presentation = plugins_url( '../../../resources/images/onboarding/button-presenation.png', __FILE__ );
151
+ $img_buttons = plugins_url( '../../../resources/images/onboarding/buttons-overview.png', __FILE__ );
152
+ $img_nav_position = plugins_url( '../../../resources/images/onboarding/nav-position.png', __FILE__ );
153
+ $img_new_button = plugins_url( '../../../resources/images/onboarding/new-button.png', __FILE__ );
154
+ $img_preview = plugins_url( '../../../resources/images/onboarding/preview.png', __FILE__ );
155
+ $img_visibility = plugins_url( '../../../resources/images/onboarding/visibility-settings.png', __FILE__ );
156
+ ?>
157
+ <div class="cnb_onboarding_guide cnb-plan-features cnb-center top-50">
158
+ <h1>Quick start guide</h1>
159
+ <h2 class="cnb-left">Locating the Call Now Button</h2>
160
+ <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_nav_position ) ?>" alt="Find the Call Now Button in the side nav of your WordPress dashboard."></div>
161
+ <p class="bottom-50">Find the Call Now Button in the side nav of your WordPress dashboard.</p>
162
+ <h2 class="cnb-left">Your buttons overview</h2>
163
+ <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_buttons ) ?>" alt="The buttons overview page where you can add, edit and remove buttons."></div>
164
+ <p class="bottom-50">The buttons overview page where you can add, edit and remove buttons. Click <strong>Add New</strong> at the top to start a new button.</p>
165
+ <h2 class="cnb-left">Create a new button</h2>
166
+ <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_new_button ) ?>" alt="When creating a new button, start with selecting your button type."></div>
167
+ <p class="bottom-50">When creating a new button, start with selecting your button type.</p>
168
+ <h2 class="cnb-left">Add an action to your button</h2>
169
+ <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_add_action ) ?>" alt="Every button contains one or more actions."></div>
170
+ <p class="bottom-50">Every button contains one or more actions.</p>
171
+ <h2 class="cnb-left">Some actions have additional options</h2>
172
+ <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_action_extras ) ?>" alt="Some actions accept extra settings for more advanced features. Here's an example for WhatsApp."></div>
173
+ <p class="bottom-50">Some actions accept extra settings for more advanced features. Here's an example for WhatsApp.</p>
174
+ <h2 class="cnb-left">Multi-action buttons contain action overviews</h2>
175
+ <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_actions ) ?>" alt="You can drag & drop the actions on the Buttonbar and the Multibutton to change the order."></div>
176
+ <p class="bottom-50">You can drag & drop the actions on the Buttonbar and the Multibutton to change the order.</p>
177
+ <h2 class="cnb-left">Every action can be scheduled</h2>
178
+ <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_scheduling ) ?>" alt="Every action can be individually scheduled."></div>
179
+ <p class="bottom-50">Every action can be individually scheduled.</p>
180
+ <h2 class="cnb-left">Change the presentation of your button</h2>
181
+ <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_presentation ) ?>" alt="In the presentation tab you can set placement, the colors and pick an animation effect for your button."></div>
182
+ <p class="bottom-50">In the presentation tab you can set placement, the colors and pick an animation effect for your button.</p>
183
+ <h2 class="cnb-left">Adjust the visibility of your button</h2>
184
+ <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_visibility ) ?>" alt="On the Visibility tab you can decide where your button should appear. Here you also see an overview of all active Display Rules."></div>
185
+ <p class="bottom-50">On the Visibility tab you can decide where your button should appear. Here you also see an overview of all active Display Rules.</p>
186
+ <h2 class="cnb-left">Adding Display Rules</h2>
187
+ <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_add_rule ) ?>" alt="Add display rules to select the pages where the button should appear or not."></div>
188
+ <p class="bottom-50">Add display rules to select the pages where the button should appear or not.</p>
189
+ <h2 class="cnb-left">The preview phone</h2>
190
+ <div class="cnb_screenshot"><img src="<?php echo esc_url( $img_preview ) ?>" alt="A preview phone is always visible to validate your edits. The time in the phone can be changed to test your scheduled actions."></div>
191
+ <p class="bottom-50">A preview phone is always visible to validate your edits. The time in the phone can be changed to test your scheduled actions.</p>
192
+ <h1>Let's go!</h1>
193
+ <p>
194
+ <a class="button button-primary button-large" href="<?php echo esc_url( $this->getNewButtonLink() ) ?>">Create new button</a>
195
+ <a class="button button-large" href="<?php echo esc_url( $this->getAllButtonsLink() ) ?>">Button overview</a>
196
+ </p>
197
+ </div><hr class="top-50"/>
198
+ <?php
199
+ }
200
+
201
+
202
  /**
203
  *
204
  * @return void
213
  return;
214
  }
215
  echo '<div class="cnb-plan-features cnb-center top-50">';
216
+ echo '<h1>🤩 <strong>Ready for PRO?</strong> 🤩</h1>';
217
+ echo '<h3>All features from Cloud plus...</h3>';
218
+ echo '<div class="cnb-pricebox cnb-smaller">
219
+ <div class="cnb-benefit">✨ "Powered by" notice removed</div>
220
+ <div class="cnb-benefit">📷 Add custom images to your buttons</div>
221
+ <div class="cnb-benefit">🌍 Include and exclude countries</div>
222
+ <div class="cnb-benefit">↕️ Set scroll height for buttons to appear</div>
223
+ </div>';
224
  ( new CnbDomainViewUpgradeOverview() )->renderUpgradeForm( $domain );
225
  echo '</div>';
226
  }
258
  if ( $this->activation->success || ! is_wp_error( $user ) ) {
259
  $this->renderBenefits();
260
  $this->renderGetStarted();
261
+ $this->renderOnboarding();
262
  $this->renderUpgradeToPro();
263
  } else {
264
  $this->renderActivationFailure( $user );
src/admin/settings/CnbSettingsController.php CHANGED
@@ -436,7 +436,7 @@ class CnbSettingsController {
436
  $nonce = filter_input( INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING );
437
  $success = 0;
438
  if ( $nonce && wp_verify_nonce( $nonce, 'cnb_set_default_settings' ) ) {
439
- Activation::onActivation( false );
440
  $success = 2;
441
  }
442
  // Always redirect back, even when not succesful
436
  $nonce = filter_input( INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING );
437
  $success = 0;
438
  if ( $nonce && wp_verify_nonce( $nonce, 'cnb_set_default_settings' ) ) {
439
+ Activation::onActivation( null, false );
440
  $success = 2;
441
  }
442
  // Always redirect back, even when not succesful
src/admin/settings/CnbSettingsViewEdit.php CHANGED
@@ -6,6 +6,7 @@ namespace cnb\admin\settings;
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
8
  use cnb\admin\api\CnbAppRemote;
 
9
  use cnb\admin\domain\CnbDomain;
10
  use cnb\admin\domain\CnbDomainViewEdit;
11
  use cnb\admin\legacy\CnbLegacyEdit;
@@ -72,7 +73,8 @@ class CnbSettingsViewEdit {
72
  class="cnb_toggle_state cnb_toggle_false">(Not sharing)</span>
73
  <span data-cnb_toggle_state_label="cnb-error-reporting"
74
  class="cnb_toggle_state cnb_toggle_true">Share</span>
75
- <p class="description">Allows us to capture anonymous error reports and usage statistics to help us improve the product.</p>
 
76
  </td>
77
  </tr>
78
  <?php
@@ -114,21 +116,23 @@ class CnbSettingsViewEdit {
114
  <td><code id="cnb_user_id"><?php echo esc_html( $cnb_user->id ) ?></code></td>
115
  </tr>
116
  <?php
117
- if ( $cnb_options['cloud_enabled'] == 1 && !is_wp_error($cnb_cloud_domain) && $cnb_cloud_domain->type === 'PRO' ) {
118
  $stripe_link = CnbAppRemote::cnb_remote_create_billing_portal();
119
- if (!is_wp_error($stripe_link)) {
120
- ?>
121
- <tr>
122
- <th scope="row">Invoices</th>
123
- <td><a href="<? echo esc_url($stripe_link->url) ?>" target="_blank">Billing portal</a></td>
124
- </tr>
 
125
  <?php } ?>
126
  <?php } ?>
127
  <tr>
128
  <th>Product updates</th>
129
  <td>
130
  <input type="hidden" name="cnb[user_marketing_email_opt_in]" value="0"/>
131
- <input id="cnb_user_marketing_email_opt_in" class="cnb_toggle_checkbox" name="cnb[user_marketing_email_opt_in]"
 
132
  type="checkbox"
133
  value="1" <?php checked( $cnb_user->marketingData->emailOptIn ); ?> />
134
  <label for="cnb_user_marketing_email_opt_in" class="cnb_toggle_label">Receive e-mail</label>
@@ -136,7 +140,8 @@ class CnbSettingsViewEdit {
136
  class="cnb_toggle_state cnb_toggle_false">(Disabled)</span>
137
  <span data-cnb_toggle_state_label="user_marketing_email_opt_in"
138
  class="cnb_toggle_state cnb_toggle_true">Enabled</span>
139
- <p class="description">Receive email updates on new features we're adding and how to use them.</p>
 
140
  </td>
141
  </tr>
142
  <?php } ?>
@@ -176,11 +181,14 @@ class CnbSettingsViewEdit {
176
  <input type="button" name="cnb_api_key_delete" id="cnb_api_key_delete"
177
  class="button button-secondary"
178
  value="<?php esc_attr_e( 'Disconnect account' ) ?>"
179
- onclick="return cnb_delete_apikey();"> </p>
180
- <p class="description">Clicking "Disconnect account" will drop the API key and disconnect the plugin from your account. You will lose access to your buttons and all cloud functionality until you reconnect with a callnowbutton.com account.</p>
 
 
181
 
182
 
183
- <input type="hidden" name="cnb[api_key]" id="cnb_api_key" value="delete_me" disabled="disabled"/>
 
184
  <?php } ?>
185
  </td>
186
  </tr>
@@ -383,17 +391,49 @@ class CnbSettingsViewEdit {
383
  );
384
  }
385
  if ( $use_cloud && isset( $cnb_cloud_domain ) && ! is_wp_error( $cnb_cloud_domain ) && $cnb_cloud_domain->type !== 'PRO' ) {
386
- ( new CnbAdminFunctions() )->cnb_promobox(
387
- 'purple',
388
- 'Remove Branding with PRO!',
389
- '<p>Remove the <em>powered by</em> branding from your buttons!</p>' .
390
- '<p>Enjoy unlimited access to all features and publish your buttons without branding.</p>',
391
- 'flag',
392
- '<strong>&euro;<span class="eur-per-month"></span>/$<span class="usd-per-month"></span> monthly</strong>',
393
- 'Upgrade now',
394
- ( new CnbUtils() )->get_cnb_domain_upgrade( $cnb_cloud_domain )
395
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
396
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  echo '</div>';
398
  }
399
 
@@ -431,7 +471,9 @@ class CnbSettingsViewEdit {
431
  <span data-cnb_toggle_state_label="cnb_cloud_enabled"
432
  class="cnb_toggle_state cnb_toggle_true">Active</span>
433
  <?php if ( $cnb_options['cloud_enabled'] == 0 ) { ?>
434
- <p class="description"><a href="<?php echo esc_url( ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page() ) ?>">Sign up</a> (free) to enable cloud and enjoy extra functionality.
 
 
435
  <a href="<?php echo esc_url( ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page() ) ?>">Learn
436
  more</a>
437
  </p>
6
  defined( 'ABSPATH' ) || die( '-1' );
7
 
8
  use cnb\admin\api\CnbAppRemote;
9
+ use cnb\admin\api\CnbAppRemotePromotionCodes;
10
  use cnb\admin\domain\CnbDomain;
11
  use cnb\admin\domain\CnbDomainViewEdit;
12
  use cnb\admin\legacy\CnbLegacyEdit;
73
  class="cnb_toggle_state cnb_toggle_false">(Not sharing)</span>
74
  <span data-cnb_toggle_state_label="cnb-error-reporting"
75
  class="cnb_toggle_state cnb_toggle_true">Share</span>
76
+ <p class="description">Allows us to capture anonymous error reports and usage statistics to help us
77
+ improve the product.</p>
78
  </td>
79
  </tr>
80
  <?php
116
  <td><code id="cnb_user_id"><?php echo esc_html( $cnb_user->id ) ?></code></td>
117
  </tr>
118
  <?php
119
+ if ( $cnb_options['cloud_enabled'] == 1 && ! is_wp_error( $cnb_cloud_domain ) && $cnb_cloud_domain->type === 'PRO' ) {
120
  $stripe_link = CnbAppRemote::cnb_remote_create_billing_portal();
121
+ if ( ! is_wp_error( $stripe_link ) ) {
122
+ ?>
123
+ <tr>
124
+ <th scope="row">Invoices</th>
125
+ <td><a href="<? echo esc_url( $stripe_link->url ) ?>" target="_blank">Billing portal</a>
126
+ </td>
127
+ </tr>
128
  <?php } ?>
129
  <?php } ?>
130
  <tr>
131
  <th>Product updates</th>
132
  <td>
133
  <input type="hidden" name="cnb[user_marketing_email_opt_in]" value="0"/>
134
+ <input id="cnb_user_marketing_email_opt_in" class="cnb_toggle_checkbox"
135
+ name="cnb[user_marketing_email_opt_in]"
136
  type="checkbox"
137
  value="1" <?php checked( $cnb_user->marketingData->emailOptIn ); ?> />
138
  <label for="cnb_user_marketing_email_opt_in" class="cnb_toggle_label">Receive e-mail</label>
140
  class="cnb_toggle_state cnb_toggle_false">(Disabled)</span>
141
  <span data-cnb_toggle_state_label="user_marketing_email_opt_in"
142
  class="cnb_toggle_state cnb_toggle_true">Enabled</span>
143
+ <p class="description">Receive email updates on new features we're adding and how to use
144
+ them.</p>
145
  </td>
146
  </tr>
147
  <?php } ?>
181
  <input type="button" name="cnb_api_key_delete" id="cnb_api_key_delete"
182
  class="button button-secondary"
183
  value="<?php esc_attr_e( 'Disconnect account' ) ?>"
184
+ onclick="return cnb_delete_apikey();"></p>
185
+ <p class="description">Clicking "Disconnect account" will drop the API key and disconnect the
186
+ plugin from your account. You will lose access to your buttons and all cloud functionality
187
+ until you reconnect with a callnowbutton.com account.</p>
188
 
189
 
190
+ <input type="hidden" name="cnb[api_key]" id="cnb_api_key" value="delete_me"
191
+ disabled="disabled"/>
192
  <?php } ?>
193
  </td>
194
  </tr>
391
  );
392
  }
393
  if ( $use_cloud && isset( $cnb_cloud_domain ) && ! is_wp_error( $cnb_cloud_domain ) && $cnb_cloud_domain->type !== 'PRO' ) {
394
+ $coupon = ( new CnbAppRemotePromotionCodes() )->get_coupon();
395
+ $discount_illustration = plugins_url( '../../../resources/images/discount.png', __FILE__ );
396
+ if ( $coupon != null && ! is_wp_error( $coupon ) ) {
397
+ ( new CnbAdminFunctions() )->cnb_promobox(
398
+ 'green',
399
+ 'SPECIAL PRO OFFER!',
400
+ '<h4>Upgrade now with ' . esc_html( $coupon->get_discount() ) . ' extra discount!</h4>' .
401
+ '<p>Enter coupon code <code class="cnb-coupon-code">' . esc_html( $coupon->code ) . '</code> during checkout.</p>' .
402
+ '<div class="cnb-center" style="padding: 10px 30px"><img src="' . esc_url( $discount_illustration ) . '" alt="Upgrade your domain to PRO with an extra discount" style="max-width:300px; width:100%; height:auto;" /></div>',
403
+ 'flag',
404
+ 'Code: <code class="cnb-coupon-code">' . esc_html( $coupon->code ) . '</code>',
405
+ 'Upgrade',
406
+ ( new CnbUtils() )->get_cnb_domain_upgrade( $cnb_cloud_domain )
407
+ );
408
+ } else {
409
+ ( new CnbAdminFunctions() )->cnb_promobox(
410
+ 'green',
411
+ 'Remove Branding with PRO',
412
+ '<p>✨ Remove the <em>Powered by</em> notice</p>
413
+ <p><strong>Plus enable extra features:</strong><br>
414
+ 📷 Add custom images to your buttons<br>
415
+ ↕️ Buttons can appear after scrolling <br>
416
+ 🌍 Include and exclude countries</p>',
417
+ 'flag',
418
+ '<strong>From $<span class="usd-per-month"></span> monthly</strong>',
419
+ 'Upgrade now',
420
+ ( new CnbUtils() )->get_cnb_domain_upgrade( $cnb_cloud_domain )
421
+ );
422
+ }
423
  }
424
+
425
+ $support_illustration = plugins_url( '../../../resources/images/support.png', __FILE__ );
426
+ ( new CnbAdminFunctions() )->cnb_promobox(
427
+ 'blue',
428
+ 'Need help?',
429
+ '<p>Please head over to our <strong>Help Center</strong> for all your questions and support needs.</p>
430
+
431
+ <div class="cnb-right" style="padding: 10px 10px 10px 70px"><img src="' . esc_url( $support_illustration ) . '" alt="Our Help Center and support options" style="max-width:300px; width:100%; height:auto;" /></div>',
432
+ 'welcome-learn-more',
433
+ '',
434
+ 'Open Help Center',
435
+ ( new CnbUtils() )->get_support_url( '', 'promobox-need-help', 'Help Center' )
436
+ );
437
  echo '</div>';
438
  }
439
 
471
  <span data-cnb_toggle_state_label="cnb_cloud_enabled"
472
  class="cnb_toggle_state cnb_toggle_true">Active</span>
473
  <?php if ( $cnb_options['cloud_enabled'] == 0 ) { ?>
474
+ <p class="description"><a
475
+ href="<?php echo esc_url( ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page() ) ?>">Sign
476
+ up</a> (free) to enable cloud and enjoy extra functionality.
477
  <a href="<?php echo esc_url( ( new CnbAdminFunctions() )->cnb_legacy_upgrade_page() ) ?>">Learn
478
  more</a>
479
  </p>
src/autoload.php CHANGED
@@ -7,6 +7,14 @@ spl_autoload_register(
7
  static $classes = null;
8
  if ($classes === null) {
9
  $classes = array(
 
 
 
 
 
 
 
 
10
  'cnb\\admin\\action\\cnb_action_list_table' => '/admin/action/Cnb_Action_List_Table.php',
11
  'cnb\\admin\\action\\cnbaction' => '/admin/action/CnbAction.php',
12
  'cnb\\admin\\action\\cnbactioncontroller' => '/admin/action/CnbActionController.php',
@@ -18,6 +26,7 @@ spl_autoload_register(
18
  'cnb\\admin\\api\\cnbadmincloud' => '/admin/api/CnbAdminCloud.php',
19
  'cnb\\admin\\api\\cnbappremote' => '/admin/api/CnbAppRemote.php',
20
  'cnb\\admin\\api\\cnbappremotepayment' => '/admin/api/CnbAppRemotePayment.php',
 
21
  'cnb\\admin\\api\\cnbdeleteresult' => '/admin/api/CnbDeleteResult.php',
22
  'cnb\\admin\\api\\cnbget' => '/admin/api/CnbGet.php',
23
  'cnb\\admin\\api\\cnbmigration' => '/admin/api/CnbMigration.php',
@@ -89,6 +98,8 @@ spl_autoload_register(
89
  'cnb\\cnbfooter' => '/admin/partials/CnbFooter.php',
90
  'cnb\\cnbheader' => '/admin/partials/CnbHeader.php',
91
  'cnb\\cnbheadernotices' => '/admin/partials/CnbHeaderNotices.php',
 
 
92
  'cnb\\notices\\cnbadminnotices' => '/notices/CnbAdminNotices.php',
93
  'cnb\\notices\\cnbnotice' => '/notices/CnbNotice.php',
94
  'cnb\\notices\\cnbnotices' => '/notices/CnbNotices.php',
7
  static $classes = null;
8
  if ($classes === null) {
9
  $classes = array(
10
+ 'cnb\\admin\\action\\actionemailsettings' => '/admin/action/partials/class-action-email-settings.php',
11
+ 'cnb\\admin\\action\\actioniframesettings' => '/admin/action/partials/class-action-iframe-settings.php',
12
+ 'cnb\\admin\\action\\actionintercomsettings' => '/admin/action/partials/class-action-intercom-settings.php',
13
+ 'cnb\\admin\\action\\actionlinksettings' => '/admin/action/partials/class-action-link-settings.php',
14
+ 'cnb\\admin\\action\\actionmapsettings' => '/admin/action/partials/class-action-map-settings.php',
15
+ 'cnb\\admin\\action\\actionsmssettings' => '/admin/action/partials/class-action-sms-settings.php',
16
+ 'cnb\\admin\\action\\actiontallysettings' => '/admin/action/partials/class-action-tally-settings.php',
17
+ 'cnb\\admin\\action\\actionwhatsappsettings' => '/admin/action/partials/class-action-whatsapp-settings.php',
18
  'cnb\\admin\\action\\cnb_action_list_table' => '/admin/action/Cnb_Action_List_Table.php',
19
  'cnb\\admin\\action\\cnbaction' => '/admin/action/CnbAction.php',
20
  'cnb\\admin\\action\\cnbactioncontroller' => '/admin/action/CnbActionController.php',
26
  'cnb\\admin\\api\\cnbadmincloud' => '/admin/api/CnbAdminCloud.php',
27
  'cnb\\admin\\api\\cnbappremote' => '/admin/api/CnbAppRemote.php',
28
  'cnb\\admin\\api\\cnbappremotepayment' => '/admin/api/CnbAppRemotePayment.php',
29
+ 'cnb\\admin\\api\\cnbappremotepromotioncodes' => '/admin/api/CnbAppRemoteCoupons.php',
30
  'cnb\\admin\\api\\cnbdeleteresult' => '/admin/api/CnbDeleteResult.php',
31
  'cnb\\admin\\api\\cnbget' => '/admin/api/CnbGet.php',
32
  'cnb\\admin\\api\\cnbmigration' => '/admin/api/CnbMigration.php',
98
  'cnb\\cnbfooter' => '/admin/partials/CnbFooter.php',
99
  'cnb\\cnbheader' => '/admin/partials/CnbHeader.php',
100
  'cnb\\cnbheadernotices' => '/admin/partials/CnbHeaderNotices.php',
101
+ 'cnb\\coupons\\cnbpromotioncode' => '/coupons/class-cnb-promotion-code.php',
102
+ 'cnb\\coupons\\cnbpromotioncoderestrictions' => '/coupons/class-cnb-promotion-code-restrictions.php',
103
  'cnb\\notices\\cnbadminnotices' => '/notices/CnbAdminNotices.php',
104
  'cnb\\notices\\cnbnotice' => '/notices/CnbNotice.php',
105
  'cnb\\notices\\cnbnotices' => '/notices/CnbNotices.php',
src/coupons/class-cnb-promotion-code-restrictions.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cnb\coupons;
4
+
5
+ // don't load directly
6
+ defined( 'ABSPATH' ) || die( '-1' );
7
+
8
+ use cnb\utils\CnbUtils;
9
+ use stdClass;
10
+ use WP_Error;
11
+
12
+ class CnbPromotionCodeRestrictions {
13
+ /**
14
+ * @var boolean
15
+ */
16
+ public $firstTimeTransaction;
17
+ /**
18
+ * @var float
19
+ */
20
+ public $minimumAmount;
21
+
22
+ /**
23
+ * If a stdClass is passed, it is transformed into a CnbPromotionCodeRestrictions.
24
+ * a WP_Error is ignored and returned immediately
25
+ * a null is converted into an (empty) CnbPromotionCodeRestrictions
26
+ *
27
+ * @param $object stdClass|array|WP_Error|null
28
+ *
29
+ * @return CnbPromotionCodeRestrictions|WP_Error
30
+ */
31
+ public static function fromObject( $object ) {
32
+ if ( is_wp_error( $object ) ) {
33
+ return $object;
34
+ }
35
+
36
+ $restrictions = new CnbPromotionCodeRestrictions();
37
+ $restrictions->firstTimeTransaction = CnbUtils::getPropertyOrNull( $object, 'firstTimeTransaction' );
38
+ $restrictions->minimumAmount = CnbUtils::getPropertyOrNull( $object, 'minimumAmount' );
39
+
40
+ return $restrictions;
41
+ }
42
+ }
src/coupons/class-cnb-promotion-code.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace cnb\coupons;
4
+
5
+ // don't load directly
6
+ defined( 'ABSPATH' ) || die( '-1' );
7
+
8
+ use cnb\utils\CnbUtils;
9
+ use stdClass;
10
+ use WP_Error;
11
+
12
+ class CnbPromotionCode {
13
+
14
+ /**
15
+ * @var string
16
+ */
17
+ public $code;
18
+ /**
19
+ * @var string
20
+ */
21
+ public $name;
22
+ /**
23
+ * @var float
24
+ */
25
+ public $amountOff;
26
+ /**
27
+ * @var float
28
+ */
29
+ public $percentOff;
30
+ /**
31
+ * @var int (date in epoch?)
32
+ */
33
+ public $redeemBy;
34
+ /**
35
+ * @var int (date in epoch?)
36
+ */
37
+ public $redeemByDate;
38
+ /**
39
+ * @var string (repeating, once, forever)
40
+ */
41
+ public $duration;
42
+ /**
43
+ * @var int
44
+ */
45
+ public $durationInMonths;
46
+ /**
47
+ * @var CnbPromotionCodeRestrictions
48
+ */
49
+ public $restrictions;
50
+
51
+ public function get_discount() {
52
+ if ( $this->percentOff ) {
53
+ return $this->percentOff . '%';
54
+ }
55
+ // Since this is returned as an int in cents (1000 == 10 EUR/USD)
56
+ // we convert it into full EUR/USD amounts, rounded down to be sure
57
+ return floor( $this->amountOff / 100 ) . '&euro;/$';
58
+ }
59
+
60
+ public function get_restrictions() {
61
+ $restrictions = '';
62
+ if ( $this->restrictions->firstTimeTransaction ) {
63
+ $restrictions .= 'The discount only applies to first-time orders only.';
64
+ }
65
+
66
+ if ( $this->duration === 'forever' ) {
67
+ $restrictions .= 'This discount applies to all your future invoices.';
68
+ }
69
+ if ( $this->duration === 'once' ) {
70
+ $restrictions .= 'This discount applies to your first invoice.';
71
+ }
72
+ if ( $this->duration === 'repeating' ) {
73
+ if ( $this->durationInMonths == 12 ) {
74
+ $restrictions .= 'This discount applies for 1 year.';
75
+ } else {
76
+ $restrictions .= 'This discount applies for ' . $this->durationInMonths . ' months.';
77
+ }
78
+ }
79
+ if ( $this->redeemByDate ) {
80
+ $restrictions .= 'Redeem before ' . $this->redeemByDate . '.';
81
+ }
82
+
83
+ return $restrictions;
84
+ }
85
+
86
+ /**
87
+ * @return string
88
+ */
89
+ public function get_plan() {
90
+ return $this->restrictions->minimumAmount > 1000 ? 'the annual plan' : 'all plans';
91
+ }
92
+
93
+ /**
94
+ * @return string
95
+ */
96
+ public function get_period() {
97
+ $output = '';
98
+ if ( $this->duration == 'forever' ) {
99
+ $output .= 'for the entire length of your subscription';
100
+ } elseif ( $this->duration == 'once' ) {
101
+ $output .= 'on your first bill';
102
+ } elseif ( $this->restrictions->minimumAmount > 1000 && ceil( $this->durationInMonths / 12 ) > 1 ) {
103
+ $output .= 'for the first ' . ceil( $this->durationInMonths / 12 ) . ' years';
104
+ } elseif ( $this->restrictions->minimumAmount > 1000 && ceil( $this->durationInMonths / 12 ) == 1 ) {
105
+ $output .= 'for the first year';
106
+ } else {
107
+ $output .= 'for the first ' . $this->durationInMonths . ' months';
108
+ }
109
+
110
+ return $output;
111
+ }
112
+
113
+ /**
114
+ * Returns 0d 00h 00m 00s
115
+ *
116
+ * In case DateTime does not exist (PHP < 5.2.0), we return nothing and let Javascript handle it.
117
+ * @return string
118
+ */
119
+ /** @noinspection PhpFullyQualifiedNameUsageInspection */
120
+ public function get_redeem_by() {
121
+ if ( version_compare( PHP_VERSION, '5.2.0', '<' ) ) {
122
+ return '0d 00h 00m 00s';
123
+ }
124
+
125
+ $output = '';
126
+ if ( $this->redeemBy > 0 && $this->redeemBy < PHP_INT_MAX ) {
127
+ $now = new \DateTime( 'now' );
128
+ $redeem_by = ( new \DateTime() )->setTimestamp( $this->redeemBy );
129
+ $diff = $now->diff( $redeem_by );
130
+
131
+ $output .= sprintf( '%dd ', $diff->d );
132
+ $output .= sprintf( '%02dh ', $diff->h );
133
+ $output .= sprintf( '%02dm ', $diff->m );
134
+ $output .= sprintf( '%02ds', $diff->s );
135
+ }
136
+
137
+ return $output;
138
+ }
139
+
140
+ /**
141
+ * If a stdClass is passed, it is transformed into a CnbPromotionCode.
142
+ * a WP_Error is ignored and returned immediately
143
+ * a null is converted into an (empty) CnbPromotionCode
144
+ *
145
+ * @param $object stdClass|array|WP_Error|null
146
+ *
147
+ * @return CnbPromotionCode|WP_Error
148
+ */
149
+ public static function fromObject( $object ) {
150
+ if ( is_wp_error( $object ) ) {
151
+ return $object;
152
+ }
153
+
154
+ $promo_code = new CnbPromotionCode();
155
+ $promo_code->code = CnbUtils::getPropertyOrNull( $object, 'code' );
156
+ $promo_code->name = CnbUtils::getPropertyOrNull( $object, 'name' );
157
+ $promo_code->amountOff = CnbUtils::getPropertyOrNull( $object, 'amountOff' );
158
+ $promo_code->percentOff = CnbUtils::getPropertyOrNull( $object, 'percentOff' );
159
+ $promo_code->redeemBy = CnbUtils::getPropertyOrNull( $object, 'redeemBy' );
160
+ $promo_code->duration = CnbUtils::getPropertyOrNull( $object, 'duration' );
161
+ $promo_code->durationInMonths = CnbUtils::getPropertyOrNull( $object, 'durationInMonths' );
162
+ $promo_code->restrictions = CnbPromotionCodeRestrictions::fromObject( CnbUtils::getPropertyOrNull( $object, 'restrictions' ) );
163
+
164
+ // Convert date
165
+ if ( $promo_code->redeemBy > 0 && $promo_code->redeemBy < PHP_INT_MAX ) {
166
+ // That is a date we can parse
167
+ $promo_code->redeemByDate = date( 'F d, Y', $promo_code->redeemBy );
168
+ }
169
+
170
+ return $promo_code;
171
+ }
172
+ }
src/utils/CnbAdminFunctions.php CHANGED
@@ -55,19 +55,19 @@ class CnbAdminFunctions {
55
  */
56
  function cnb_get_action_types() {
57
  return array(
58
- 'PHONE' => 'Phone',
59
- 'EMAIL' => 'Email',
60
- 'ANCHOR' => 'Anchor (smooth scroll)',
61
- 'LINK' => 'Link',
62
- 'MAP' => 'Google Maps',
63
- 'WHATSAPP' => 'WhatsApp',
64
- 'SMS' => 'SMS/Text',
65
- 'FACEBOOK' => 'Facebook Messenger',
66
- 'SIGNAL' => 'Signal',
67
- 'TELEGRAM' => 'Telegram',
68
- // 'IFRAME' => 'Iframe',
69
- // 'TALLY' => 'Tally (integration)',
70
- // 'INTERCOM' => 'Intercom (integration)'
71
  );
72
  }
73
 
@@ -157,7 +157,7 @@ class CnbAdminFunctions {
157
  */
158
  function cnb_promobox( $color, $headline, $body, $icon = 'flag', $cta_pretext = null, $cta_button_text = 'Let\'s go', $cta_button_link = null, $cta_footer_notice = null ) {
159
  echo '
160
- <div id="cnb_upgrade_box" class="cnb-promobox">
161
  <div class="cnb-promobox-header cnb-promobox-header-' . esc_attr( $color ) . '">
162
  <span class="dashicons dashicons-' . esc_attr( $icon ) . '"></span>
163
  <h2 class="hndle">' .
@@ -182,7 +182,7 @@ class CnbAdminFunctions {
182
  if ( $cta_button_text != 'none' && $cta_button_link != 'disabled' ) {
183
  echo '
184
  <div class="cnb-promobox-action-right">
185
- <a class="button button-primary button-large" href="' . esc_url( $cta_button_link ) . '">' . esc_html( $cta_button_text ) . '</a>
186
  </div>';
187
  } elseif ( $cta_button_link == 'disabled' ) {
188
  echo '
55
  */
56
  function cnb_get_action_types() {
57
  return array(
58
+ 'PHONE' => '💬 Phone',
59
+ 'EMAIL' => '💬 Email',
60
+ 'SMS' => '💬 SMS/Text',
61
+ 'WHATSAPP' => '💬 WhatsApp',
62
+ 'FACEBOOK' => '💬 Messenger',
63
+ 'SIGNAL' => '💬 Signal',
64
+ 'TELEGRAM' => '💬 Telegram',
65
+ 'ANCHOR' => '🔗 Anchor (smooth scroll)',
66
+ 'LINK' => '🔗 Link',
67
+ 'MAP' => '📍 Location',
68
+ 'IFRAME' => '🔌 Iframe pop-up',
69
+ 'TALLY' => '🔌 Tally form pop-up',
70
+ 'INTERCOM' => '🔌 Intercom chat'
71
  );
72
  }
73
 
157
  */
158
  function cnb_promobox( $color, $headline, $body, $icon = 'flag', $cta_pretext = null, $cta_button_text = 'Let\'s go', $cta_button_link = null, $cta_footer_notice = null ) {
159
  echo '
160
+ <div id="cnb_upgrade_box" class="cnb-promobox cnb-promobox-' . esc_attr( $color ) . '">
161
  <div class="cnb-promobox-header cnb-promobox-header-' . esc_attr( $color ) . '">
162
  <span class="dashicons dashicons-' . esc_attr( $icon ) . '"></span>
163
  <h2 class="hndle">' .
182
  if ( $cta_button_text != 'none' && $cta_button_link != 'disabled' ) {
183
  echo '
184
  <div class="cnb-promobox-action-right">
185
+ <a class="button button-primary button-large" style="user-select: none;" href="' . esc_url( $cta_button_link ) . '">' . esc_html( $cta_button_text ) . '</a>
186
  </div>';
187
  } elseif ( $cta_button_link == 'disabled' ) {
188
  echo '
src/utils/CnbUtils.php CHANGED
@@ -80,32 +80,19 @@ class CnbUtils {
80
  */
81
  function cnb_actiontype_to_icontext( $actionType ) {
82
  switch ( $actionType ) {
83
- case 'ANCHOR':
84
- return 'anchor';
85
- case 'EMAIL':
86
- return 'email';
87
- case 'HOURS':
88
- return 'access_time';
89
- case 'LINK':
90
- return 'link';
91
- case 'MAP':
92
- return 'directions';
93
- case 'SMS':
94
- return 'chat';
95
- case 'WHATSAPP':
96
- return 'whatsapp';
97
- case 'FACEBOOK':
98
- return 'facebook_messenger';
99
- case 'SIGNAL':
100
- return 'signal';
101
- case 'TELEGRAM':
102
- return 'telegram';
103
- case 'IFRAME':
104
- return 'link4';
105
- case 'TALLY':
106
- return 'support';
107
- case 'INTERCOM':
108
- return 'call3';
109
  case 'PHONE':
110
  default:
111
  return 'call';
80
  */
81
  function cnb_actiontype_to_icontext( $actionType ) {
82
  switch ( $actionType ) {
83
+ case 'ANCHOR': return 'anchor';
84
+ case 'EMAIL': return 'email';
85
+ case 'HOURS': return 'access_time';
86
+ case 'LINK': return 'link';
87
+ case 'MAP': return 'directions';
88
+ case 'SMS': return 'chat';
89
+ case 'WHATSAPP': return 'whatsapp';
90
+ case 'FACEBOOK': return 'facebook_messenger';
91
+ case 'SIGNAL': return 'signal';
92
+ case 'TELEGRAM': return 'telegram';
93
+ case 'IFRAME': return 'open_modal';
94
+ case 'TALLY': return 'call3';
95
+ case 'INTERCOM': return 'intercom';
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  case 'PHONE':
97
  default:
98
  return 'call';
src/utils/cnb-backwards-compatible.php CHANGED
@@ -53,3 +53,27 @@ if ( ! function_exists( 'wp_generate_uuid4' ) ) {
53
  );
54
  }
55
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  );
54
  }
55
  }
56
+
57
+ /**
58
+ * For WordPress < 5.3.0
59
+ */
60
+ if ( ! function_exists( 'wp_timezone_string' ) ) {
61
+ function wp_timezone_string() {
62
+ $timezone_string = get_option( 'timezone_string' );
63
+
64
+ if ( $timezone_string ) {
65
+ return $timezone_string;
66
+ }
67
+
68
+ $offset = (float) get_option( 'gmt_offset' );
69
+ $hours = (int) $offset;
70
+ $minutes = ( $offset - $hours );
71
+
72
+ $sign = ( $offset < 0 ) ? '-' : '+';
73
+ $abs_hour = abs( $hours );
74
+ $abs_mins = abs( $minutes * 60 );
75
+ $tz_offset = sprintf( '%s%02d:%02d', $sign, $abs_hour, $abs_mins );
76
+
77
+ return $tz_offset;
78
+ }
79
+ }