Changeset 3840376
- Timestamp:
- 12/02/2026 03:17:04 PM (less than one hour ago)
- Location:
- dropui
- Files:
-
- 16 added
- 34 edited
- 1 copied
-
tags/1.0.7 (copied) (copied from dropui/trunk )
-
tags/1.0.7/assets/css/admin.css (modified) (2 diffs)
-
tags/1.0.7/assets/images/dropui-logo.svg (added)
-
tags/1.0.7/assets/images/kornel-szwaja.png (added)
-
tags/1.0.7/assets/images/panel-icons.svg (added)
-
tags/1.0.7/assets/js/admin.js (modified) (1 diff)
-
tags/1.0.7/assets/js/exchange-callback.js (modified) (1 diff)
-
tags/1.0.7/config/dropui.php (modified) (1 diff)
-
tags/1.0.7/dropui-wordpress-app.php (modified) (7 diffs)
-
tags/1.0.7/languages/dropui-pl_PL.mo (added)
-
tags/1.0.7/languages/dropui-pl_PL.po (added)
-
tags/1.0.7/languages/dropui.pot (modified) (2 diffs)
-
tags/1.0.7/readme.txt (modified) (4 diffs)
-
tags/1.0.7/src/Admin/AdminPage.php (modified) (9 diffs)
-
tags/1.0.7/src/Admin/ExchangeCallbackHandler.php (modified) (3 diffs)
-
tags/1.0.7/src/Frontend/MasterScriptLoader.php (modified) (1 diff)
-
tags/1.0.7/src/Service/DropuiService.php (modified) (5 diffs)
-
tags/1.0.7/src/Service/MailPoetConsent.php (added)
-
tags/1.0.7/src/Service/StoreService.php (modified) (4 diffs)
-
tags/1.0.7/src/Service/WooCommerceBridge.php (added)
-
tags/1.0.7/src/Service/WooCommerceSmsConsent.php (added)
-
tags/1.0.7/vendor/autoload.php (modified) (1 diff)
-
tags/1.0.7/vendor/composer/LICENSE (modified) (2 diffs)
-
tags/1.0.7/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
tags/1.0.7/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/1.0.7/vendor/composer/autoload_static.php (modified) (4 diffs)
-
trunk/assets/css/admin.css (modified) (2 diffs)
-
trunk/assets/images/dropui-logo.svg (added)
-
trunk/assets/images/kornel-szwaja.png (added)
-
trunk/assets/images/panel-icons.svg (added)
-
trunk/assets/js/admin.js (modified) (1 diff)
-
trunk/assets/js/exchange-callback.js (modified) (1 diff)
-
trunk/config/dropui.php (modified) (1 diff)
-
trunk/dropui-wordpress-app.php (modified) (7 diffs)
-
trunk/languages/dropui-pl_PL.mo (added)
-
trunk/languages/dropui-pl_PL.po (added)
-
trunk/languages/dropui.pot (modified) (2 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/src/Admin/AdminPage.php (modified) (9 diffs)
-
trunk/src/Admin/ExchangeCallbackHandler.php (modified) (3 diffs)
-
trunk/src/Frontend/MasterScriptLoader.php (modified) (1 diff)
-
trunk/src/Service/DropuiService.php (modified) (5 diffs)
-
trunk/src/Service/MailPoetConsent.php (added)
-
trunk/src/Service/StoreService.php (modified) (4 diffs)
-
trunk/src/Service/WooCommerceBridge.php (added)
-
trunk/src/Service/WooCommerceSmsConsent.php (added)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/LICENSE (modified) (2 diffs)
-
trunk/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dropui/tags/1.0.7/assets/css/admin.css
r3689562 r3840376 1 body.toplevel_page_dropui { 2 --dropui-account-manager-width: 320px; 3 background: #fff; 4 } 5 1 6 .dropui-admin { 2 max-width: 1080px; 3 color: #1d2327; 4 letter-spacing: 0; 5 } 6 7 .dropui-admin:lang(ko) { 8 word-break: keep-all; 7 --dropui-ink: #202124; 8 --dropui-muted: #62666d; 9 --dropui-surface: #fff; 10 --dropui-hover: #f0f1f3; 11 --dropui-border: #e2e4e8; 12 --dropui-control-border: #d4d7dc; 13 --dropui-control-hover: #b5bac3; 14 --dropui-primary-hover: #383b40; 15 --dropui-focus: #2463b3; 16 --dropui-focus-ring: rgb(36 99 179 / 12%); 17 --dropui-error: #b42332; 18 --dropui-whatsapp-brand: #25d366; 19 --dropui-shadow: 0 12px 36px rgb(24 30 40 / 14%); 20 max-width: 960px; 21 margin: 0 auto; 22 padding: 76px 32px 64px; 23 color: var(--dropui-ink); 24 font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; 25 overflow-wrap: anywhere; 9 26 } 10 27 … … 15 32 } 16 33 34 .dropui-admin:lang(ko) { 35 word-break: keep-all; 36 } 37 38 .dropui-admin h1, 39 .dropui-admin h2, 40 .dropui-admin h3, 41 .dropui-admin p { 42 margin: 0; 43 padding: 0; 44 color: inherit; 45 line-height: inherit; 46 } 47 48 .dropui-admin h1 { 49 max-width: 720px; 50 font-size: 32px; 51 font-weight: 500; 52 line-height: 1.25; 53 letter-spacing: -.025em; 54 text-wrap: balance; 55 } 56 57 .dropui-admin h2 { 58 font-size: 18px; 59 font-weight: 600; 60 line-height: 1.4; 61 letter-spacing: -.015em; 62 } 63 64 .dropui-admin h3 { 65 font-size: 14px; 66 font-weight: 600; 67 } 68 69 .dropui-admin p + p { 70 margin-top: 8px; 71 } 72 73 .dropui-admin .dropui-help { 74 color: var(--dropui-muted); 75 font-size: 12px; 76 } 77 78 .dropui-admin a:not(.dropui-button) { 79 color: var(--dropui-ink); 80 font-weight: 500; 81 text-underline-offset: 3px; 82 text-decoration-color: var(--dropui-control-border); 83 } 84 85 .dropui-admin a:not(.dropui-button):hover { 86 text-decoration-color: currentColor; 87 } 88 89 .dropui-admin :is(a, button, input, summary):focus-visible { 90 outline: 2px solid var(--dropui-focus); 91 outline-offset: 2px; 92 box-shadow: 0 0 0 2px var(--dropui-focus-ring); 93 } 94 17 95 .dropui-intro { 18 padding: 16px 0 24px; 19 } 20 21 .dropui-admin .dropui-brand { 96 display: grid; 97 justify-items: center; 98 gap: 12px; 99 margin-bottom: 40px; 100 text-align: center; 101 } 102 103 .dropui-brand { 104 display: block; 105 object-fit: contain; 106 } 107 108 .dropui-admin .dropui-intro-summary { 109 max-width: 62ch; 110 color: var(--dropui-muted); 111 line-height: 1.65; 112 text-wrap: pretty; 113 } 114 115 .dropui-page-flow { 116 display: grid; 117 gap: 32px; 118 } 119 120 .dropui-section { 121 display: grid; 122 align-content: start; 123 min-width: 0; 124 gap: 16px; 125 } 126 127 .dropui-sync-help { 128 max-width: 70ch; 129 } 130 131 .dropui-woo-summary { 132 padding: 16px 18px; 133 border-radius: 8px; 134 color: #0b2230; 135 background-color: #e6f4f9; 136 background-image: linear-gradient(90deg, #c1e7f9, #d0edf9 14%, #e1f3f9 36%, #e6f4f9 65%, #e4f3f9 78%, #dbeef9 90%, #c5e9f8); 137 box-shadow: inset 0 0 0 1px rgb(68 131 205 / 32%); 138 } 139 140 .dropui-admin .dropui-woo-summary p { 141 font-size: 14px; 142 line-height: 1.5; 143 } 144 145 .dropui-woo-summary strong { 146 font-weight: 600; 147 } 148 149 @media (max-width: 600px) { 150 .dropui-woo-summary { 151 padding: 16px; 152 } 153 } 154 155 .dropui-columns { 156 display: grid; 157 grid-template-columns: repeat(2, minmax(0, 1fr)); 158 gap: 20px 24px; 159 } 160 161 .dropui-data-fields { 162 margin: 0; 163 } 164 165 .dropui-data-fields > div { 166 display: grid; 167 align-content: start; 168 gap: 6px; 169 } 170 171 .dropui-data-fields dt { 172 color: var(--dropui-muted); 173 font-size: 12px; 174 } 175 176 .dropui-data-fields dd { 177 margin: 0; 178 line-height: 1.6; 179 } 180 181 .dropui-connection-actions { 182 display: flex; 183 flex-wrap: wrap; 184 align-items: center; 185 gap: 8px; 186 } 187 188 .dropui-admin:has(.dropui-account-manager) { 189 padding-bottom: 92px; 190 } 191 192 .dropui-account-manager { 193 position: fixed; 194 right: max(16px, env(safe-area-inset-right)); 195 bottom: max(16px, env(safe-area-inset-bottom)); 196 left: max(16px, env(safe-area-inset-left)); 197 z-index: 110; 198 max-width: var(--dropui-account-manager-width); 199 margin-left: auto; 200 pointer-events: none; 201 } 202 203 #wpwrap.wp-responsive-open .dropui-account-manager { 204 display: none; 205 } 206 207 .dropui-admin .dropui-button.dropui-account-manager__trigger { 208 display: flex; 209 width: fit-content; 210 min-height: 64px; 211 gap: 12px; 212 margin-left: auto; 213 padding: 9px 20px 9px 9px; 214 border-color: transparent; 215 border-radius: 999px; 216 background: var(--dropui-whatsapp-brand); 217 box-shadow: var(--dropui-shadow); 218 list-style: none; 219 pointer-events: auto; 220 } 221 222 .dropui-admin .dropui-button.dropui-account-manager__trigger:hover { 223 border-color: transparent; 224 background: color-mix(in srgb, var(--dropui-whatsapp-brand) 92%, var(--dropui-ink)); 225 } 226 227 .dropui-account-manager__trigger::-webkit-details-marker { 228 display: none; 229 } 230 231 .dropui-account-manager img { 232 flex: none; 233 border-radius: 50%; 234 object-fit: cover; 235 } 236 237 .dropui-account-manager__identity { 238 display: grid; 239 gap: 1px; 240 font-size: 13px; 241 line-height: 1.25; 242 text-align: left; 243 } 244 245 .dropui-account-manager__identity strong { 246 font-size: 15px; 247 font-weight: 600; 248 } 249 250 .dropui-account-manager__card { 251 position: absolute; 252 right: 0; 253 bottom: calc(100% + 12px); 254 width: 100%; 255 max-height: calc(100dvh - 104px - env(safe-area-inset-bottom)); 256 overflow-y: auto; 257 padding: 16px; 258 border: 1px solid var(--dropui-border); 259 border-radius: 12px; 260 background: var(--dropui-surface); 261 box-shadow: var(--dropui-shadow); 262 pointer-events: auto; 263 } 264 265 .dropui-account-manager__header { 22 266 display: flex; 23 267 align-items: center; 24 268 gap: 12px; 25 margin: 0; 26 padding: 0; 27 font-size: 22px; 28 font-weight: 600; 29 line-height: 1.4; 30 overflow-wrap: anywhere; 31 } 32 33 .dropui-brand > span { 34 min-width: 0; 35 } 36 37 .dropui-admin .dropui-intro-summary { 38 max-width: 80ch; 39 margin: 14px 0 0; 40 color: #50575e; 41 font-size: 14px; 42 line-height: 1.7; 43 } 44 45 .dropui-brand img { 46 flex: 0 0 40px; 47 border-radius: 8px; 48 } 49 50 .dropui-admin h2 { 51 margin: 0 0 12px; 52 font-size: 20px; 53 line-height: 1.4; 54 } 55 56 .dropui-admin h3 { 57 margin: 0 0 12px; 58 font-size: 15px; 59 line-height: 1.5; 60 } 61 62 .dropui-admin p, 63 .dropui-admin dd, 64 .dropui-admin a, 65 .dropui-admin h2, 66 .dropui-admin h3 { 67 overflow-wrap: anywhere; 68 } 69 70 .dropui-connection { 71 display: grid; 72 grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); 73 gap: 40px; 74 padding: 28px 0 32px; 75 border-block: 1px solid #c3c4c7; 76 } 77 78 .dropui-admin .dropui-status { 79 display: flex; 269 } 270 271 .dropui-admin .dropui-account-manager__header h2 { 272 font-size: 16px; 273 letter-spacing: 0; 274 } 275 276 .dropui-admin .dropui-account-manager__card p { 277 margin: 12px 0 8px; 278 color: var(--dropui-muted); 279 font-size: 13px; 280 line-height: 1.55; 281 } 282 283 .dropui-account-manager__links { 284 display: grid; 285 justify-items: start; 286 } 287 288 .dropui-account-manager__links a { 289 display: inline-flex; 80 290 align-items: center; 81 gap: 6px; 82 margin: 0 0 12px; 83 font-size: 13px; 84 font-weight: 600; 85 } 86 87 .dropui-status--connected, 88 .dropui-free { 89 color: #12633b; 90 } 91 92 .dropui-status--incomplete { 93 color: #8a4b00; 94 } 95 96 .dropui-summary { 97 max-width: 56ch; 98 margin: 0 0 22px; 99 font-size: 15px; 100 line-height: 1.6; 101 } 102 103 .dropui-site { 104 margin: 0 0 22px; 105 padding-inline-start: 12px; 106 border-inline-start: 3px solid #c3c4c7; 107 } 108 109 .dropui-site dt { 110 margin-bottom: 4px; 111 color: #50575e; 112 font-size: 12px; 113 } 114 115 .dropui-site dd { 116 margin: 0; 117 font-size: 14px; 118 font-weight: 600; 119 line-height: 1.6; 120 } 121 122 .dropui-site .dropui-site-url { 123 color: #50575e; 124 font-size: 13px; 125 font-weight: 400; 126 } 127 128 .dropui-admin .dropui-connect-button { 291 gap: 8px; 292 min-height: 38px; 293 } 294 295 .dropui-icon { 296 flex: none; 297 } 298 299 .dropui-admin .dropui-button { 129 300 display: inline-flex; 130 301 align-items: center; 131 302 justify-content: center; 132 gap: 10px; 133 min-height: 44px; 303 gap: 6px; 134 304 max-width: 100%; 135 padding: 8px 18px; 136 font-size: 14px; 137 line-height: 1.5; 138 white-space: normal; 139 } 140 141 .dropui-admin .dashicons { 142 flex: 0 0 20px; 143 } 144 145 .dropui-admin .description { 146 margin-top: 10px; 147 color: #50575e; 148 font-style: normal; 149 line-height: 1.6; 150 } 151 152 .dropui-account { 153 padding-inline-start: 32px; 154 border-inline-start: 1px solid #c3c4c7; 155 } 156 157 .dropui-account p { 158 line-height: 1.7; 159 } 160 161 .dropui-free, 162 .dropui-checklist li { 305 min-height: 38px; 306 padding: 8px 14px; 307 border: 1px solid var(--dropui-control-border); 308 border-radius: 8px; 309 background: var(--dropui-surface); 310 color: var(--dropui-ink); 311 font: inherit; 312 font-size: 13px; 313 font-weight: 500; 314 line-height: 1.4; 315 text-align: center; 316 text-decoration: none; 317 cursor: pointer; 318 transition: background-color 120ms ease, border-color 120ms ease; 319 } 320 321 .dropui-admin .dropui-button:hover { 322 border-color: var(--dropui-control-hover); 323 background: var(--dropui-hover); 324 } 325 326 .dropui-admin .dropui-button--primary { 327 border-color: var(--dropui-ink); 328 background: var(--dropui-ink); 329 color: var(--dropui-surface); 330 } 331 332 .dropui-admin .dropui-button--primary:hover { 333 border-color: var(--dropui-primary-hover); 334 background: var(--dropui-primary-hover); 335 color: var(--dropui-surface); 336 } 337 338 .dropui-admin .dropui-button--disconnect { 339 color: var(--dropui-error); 340 } 341 342 .dropui-feedback { 343 margin-bottom: 16px; 344 padding: 12px 16px; 345 border-radius: 8px; 346 } 347 348 .dropui-feedback--success { 349 background: #ecf7f1; 350 color: #176b4d; 351 } 352 353 .dropui-feedback--warning { 354 background: #fff8e8; 355 color: #85530b; 356 } 357 358 .dropui-feedback--error { 359 background: #fff0f1; 360 color: var(--dropui-error); 361 } 362 363 .dropui-settings form { 364 display: grid; 365 align-content: start; 366 justify-items: start; 367 gap: 12px; 368 } 369 370 .dropui-settings .dropui-help { 371 margin: 0; 372 } 373 374 .dropui-check { 163 375 display: flex; 164 376 align-items: flex-start; 165 377 gap: 8px; 166 } 167 168 .dropui-admin .dropui-free { 169 margin: 12px 0 0; 170 line-height: 1.6; 171 } 172 173 .dropui-checklist { 174 margin: 20px 0; 175 } 176 177 .dropui-checklist li { 178 margin-bottom: 16px; 179 line-height: 1.6; 180 } 181 182 .dropui-guidance { 183 display: grid; 184 grid-template-columns: repeat(2, minmax(0, 1fr)); 185 gap: 32px; 186 padding: 28px 0; 187 } 188 189 .dropui-guidance h2 { 190 font-size: 18px; 191 } 192 193 .dropui-guidance p { 194 margin: 0; 195 color: #50575e; 196 font-size: 14px; 197 line-height: 1.7; 198 } 199 200 .dropui-guidance p + p { 201 margin-top: 10px; 202 } 203 204 .dropui-support { 205 display: flex; 206 align-items: center; 207 justify-content: space-between; 208 gap: 24px; 209 padding: 24px 0; 210 border-top: 1px solid #c3c4c7; 211 } 212 213 .dropui-support h2 { 214 font-size: 15px; 215 } 216 217 .dropui-support .button { 218 max-width: 100%; 219 white-space: normal; 220 } 221 222 @media (max-width: 960px) { 223 .dropui-connection { 224 gap: 24px; 225 } 226 227 .dropui-account { 228 padding-inline-start: 24px; 229 } 230 } 231 232 @media (max-width: 600px) { 233 .dropui-connection, 234 .dropui-guidance { 378 cursor: pointer; 379 } 380 381 .dropui-check input[type="checkbox"] { 382 display: inline-grid; 383 flex: none; 384 place-content: center; 385 width: 16px; 386 height: 16px; 387 margin: 2px 0 0; 388 border-color: var(--dropui-control-border); 389 border-radius: 4px; 390 } 391 392 .dropui-check input[type="checkbox"]:checked { 393 border-color: var(--dropui-ink); 394 background: var(--dropui-ink); 395 } 396 397 .dropui-check input[type="checkbox"]:checked::before { 398 float: none; 399 width: 5px; 400 height: 8px; 401 margin: -1px 0 0; 402 border: solid var(--dropui-surface); 403 border-width: 0 2px 2px 0; 404 transform: rotate(45deg); 405 content: ""; 406 } 407 408 @media (forced-colors: active) { 409 .dropui-check input[type="checkbox"]:checked { 410 border-color: Highlight; 411 background: Highlight; 412 forced-color-adjust: none; 413 } 414 415 .dropui-check input[type="checkbox"]:checked::before { 416 border-color: HighlightText; 417 } 418 } 419 420 @media (min-width: 783px) { 421 body.toplevel_page_dropui:has(.dropui-account-manager) #wpfooter { 422 padding-inline-end: calc(var(--dropui-account-manager-width) + 28px); 423 } 424 } 425 426 @media (max-width: 782px) { 427 .dropui-admin { 428 padding: 72px 16px 40px; 429 } 430 431 .dropui-intro { 432 margin-bottom: 32px; 433 } 434 435 .dropui-admin h1 { 436 font-size: 26px; 437 } 438 439 .dropui-admin .dropui-button, 440 .dropui-account-manager__links a { 441 min-height: 44px; 442 } 443 444 .dropui-columns { 235 445 grid-template-columns: minmax(0, 1fr); 236 446 } 237 238 .dropui-account { 239 padding: 24px 0 0; 240 border-inline-start: 0; 241 border-top: 1px solid #c3c4c7; 242 } 243 244 .dropui-support { 245 align-items: flex-start; 246 flex-direction: column; 247 } 248 } 447 } -
dropui/tags/1.0.7/assets/js/admin.js
r3664245 r3840376 20 20 } 21 21 22 const accountManager = adminPage.querySelector('[data-dropui-account-manager]'); 23 if (accountManager) { 24 const closeOutside = function (event) { 25 if (accountManager.open && !accountManager.contains(event.target)) { 26 accountManager.open = false; 27 } 28 }; 29 document.addEventListener('pointerdown', closeOutside); 30 document.addEventListener('focusin', closeOutside); 31 accountManager.addEventListener('keydown', function (event) { 32 if (event.key !== 'Escape' || !accountManager.open) { 33 return; 34 } 35 event.preventDefault(); 36 event.stopPropagation(); 37 accountManager.open = false; 38 accountManager.querySelector('summary').focus({ preventScroll: true }); 39 }); 40 } 41 22 42 const disconnectButton = adminPage.querySelector( 23 43 '[data-dropui-disconnect-confirm]' -
dropui/tags/1.0.7/assets/js/exchange-callback.js
r3664245 r3840376 4 4 5 5 if (callbackPage) { 6 try { 7 localStorage.setItem( 8 'dropui_connection_updated', 9 String(Date.now()) 10 ); 11 } catch (error) { 12 // Ignore localStorage errors. 13 } 6 if (callbackPage.dataset.dropuiRefreshTabs !== '0') { 7 try { 8 localStorage.setItem( 9 'dropui_connection_updated', 10 String(Date.now()) 11 ); 12 } catch (error) { 13 // Ignore localStorage errors. 14 } 14 15 15 if (window.opener && !window.opener.closed) { 16 window.opener.location.reload(); 16 if (window.opener && !window.opener.closed) { 17 window.opener.location.reload(); 18 } 17 19 } 18 20 -
dropui/tags/1.0.7/config/dropui.php
r3664245 r3840376 1 1 <?php 2 2 3 return [ 4 'base_url' => 'https://app.dropui.com/', 5 ]; 3 return ['base_url' => 'https://app.dropui.com/']; -
dropui/tags/1.0.7/dropui-wordpress-app.php
r3689562 r3840376 5 5 Plugin URI: https://dropui.com/integrations/wordpress 6 6 Description: Connect your WordPress site to DropUI and manage your campaigns from your DropUI account. 7 Version: 1.0. 67 Version: 1.0.7 8 8 Requires at least: 6.3 9 9 Requires PHP: 7.4 … … 21 21 22 22 if (!defined('DROPUI_VERSION')) { 23 define('DROPUI_VERSION', '1.0. 6');23 define('DROPUI_VERSION', '1.0.7'); 24 24 } 25 25 … … 29 29 use DropUI\Admin\ExchangeCallbackHandler; 30 30 use DropUI\Frontend\MasterScriptLoader; 31 use DropUI\Service\WooCommerceBridge; 32 use DropUI\Service\WooCommerceSmsConsent; 31 33 32 34 (new MasterScriptLoader())->register(); 35 36 add_action('admin_post_nopriv_dropui_commerce_read', [new WooCommerceBridge(), 'handle']); 37 add_action('admin_post_dropui_commerce_read', [new WooCommerceBridge(), 'handle']); 38 add_action('woocommerce_checkout_create_order', [new WooCommerceBridge(), 'captureCartToken']); 39 add_action('woocommerce_store_api_checkout_update_order_meta', [new WooCommerceBridge(), 'captureCartToken']); 40 $dropuiSmsConsent = new WooCommerceSmsConsent(); 41 add_action('woocommerce_init', [$dropuiSmsConsent, 'registerBlockField']); 42 add_action('woocommerce_after_order_notes', [$dropuiSmsConsent, 'renderClassicField']); 43 add_action('woocommerce_checkout_create_order', [$dropuiSmsConsent, 'captureClassic']); 44 add_action('woocommerce_store_api_checkout_update_order_from_request', [$dropuiSmsConsent, 'readBlockSubmission'], 10, 2); 45 add_action('woocommerce_store_api_checkout_order_processed', [$dropuiSmsConsent, 'captureBlock']); 46 add_filter('wp_consent_api_registered_' . plugin_basename(__FILE__), '__return_true'); 47 add_action('before_woocommerce_init', function () { 48 if (class_exists('Automattic\\WooCommerce\\Utilities\\FeaturesUtil')) { 49 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 50 'custom_order_tables', __FILE__, true 51 ); 52 } 53 }); 54 55 // WooCommerce registers checkout fields at init priority 0. 56 add_action('init', function () { 57 load_plugin_textdomain('dropui', false, dirname(plugin_basename(__FILE__)) . '/languages'); 58 59 if (determine_locale() === 'pl_PL') { 60 // Keep WordPress.org translations and supplement them with bundled Polish strings. 61 get_translations_for_domain('dropui'); 62 load_textdomain('dropui', __DIR__ . '/languages/dropui-pl_PL.mo', 'pl_PL'); 63 } 64 }, -1); 33 65 34 66 add_action('admin_enqueue_scripts', function ($hook) { … … 40 72 'dropui-admin', 41 73 plugin_dir_url(__FILE__) . 'assets/css/admin.css', 42 [ 'dashicons'],74 [], 43 75 DROPUI_VERSION 44 76 ); … … 74 106 // run, so this happens once and never again. 75 107 add_action('admin_init', function () { 76 if (!get_option('dropui_activation_redirect')) { 108 if ((defined('WP_CLI') && WP_CLI) || wp_doing_ajax() || is_network_admin() || 109 !current_user_can('manage_options') || !get_option('dropui_activation_redirect')) { 77 110 return; 78 111 } … … 86 119 } 87 120 88 if (wp_doing_ajax() || is_network_admin()) {89 return;90 }91 92 if (!current_user_can('manage_options')) {93 return;94 }95 96 121 wp_safe_redirect(admin_url('admin.php?page=dropui')); 97 122 exit; … … 99 124 100 125 add_action('admin_post_dropui_exchange_callback', function () { 101 wp_enqueue_script(102 'dropui-exchange-callback',103 plugin_dir_url(__FILE__) . 'assets/js/exchange-callback.js',104 [],105 DROPUI_VERSION,106 true107 );108 109 126 (new ExchangeCallbackHandler())->handle(); 110 127 }); -
dropui/tags/1.0.7/languages/dropui.pot
r3689562 r3840376 174 174 175 175 #: src/Admin/AdminPage.php 176 msgid "Start with one campaign"177 msgstr ""178 179 #: src/Admin/AdminPage.php180 176 msgid "After connecting your website, you will create and publish campaigns in the DropUI dashboard." 181 177 msgstr "" … … 285 281 msgid "Unable to encode DropUI auth secret." 286 282 msgstr "" 283 284 #: src/Admin/AdminPage.php 285 msgid "Open DropUI and start synchronization" 286 msgstr "" 287 288 #: src/Admin/AdminPage.php 289 msgid "Connecting synchronizes products, orders and customer contact details with DropUI. Existing marketing consents are not imported automatically." 290 msgstr "" 291 292 #: src/Admin/AdminPage.php 293 msgid "Cart tracking requires an explicit marketing decision from a consent manager compatible with WP Consent API or a configured consent integration." 294 msgstr "" 295 296 #: src/Admin/AdminPage.php 297 msgid "Synchronize MailPoet newsletter subscriptions" 298 msgstr "" 299 300 #: src/Admin/AdminPage.php 301 msgid "I confirm that these lists contain permission to send this store’s marketing emails." 302 msgstr "" 303 304 #: src/Admin/AdminPage.php 305 msgid "Save settings" 306 msgstr "" 307 308 #: src/Admin/AdminPage.php 309 msgid "Settings saved." 310 msgstr "" 311 312 #: src/Admin/AdminPage.php 313 msgid "Confirm the marketing permission before enabling synchronization." 314 msgstr "" 315 316 #: src/Admin/AdminPage.php 317 msgid "Ask for SMS marketing consent at checkout" 318 msgstr "" 319 320 #: src/Admin/AdminPage.php 321 msgid "SMS marketing in DropUI supports Polish phone numbers." 322 msgstr "" 323 324 #: src/Admin/AdminPage.php 325 msgid "Update WooCommerce to collect SMS consent in the Checkout block." 326 msgstr "" 327 328 #: src/Service/WooCommerceSmsConsent.php 329 msgid "I agree to receive marketing text messages from this store at the phone number provided." 330 msgstr "" 331 332 #: src/Admin/AdminPage.php 333 msgid "Your WooCommerce store is connected" 334 msgstr "" 335 336 #: src/Admin/AdminPage.php 337 msgid "Your WordPress site is connected" 338 msgstr "" 339 340 #: src/Admin/AdminPage.php 341 msgid "WooCommerce detected." 342 msgstr "" 343 344 #: src/Admin/AdminPage.php 345 msgid "Start synchronization to import products, orders and customer contact details." 346 msgstr "" 347 348 #: src/Admin/AdminPage.php 349 msgid "Marketing consents" 350 msgstr "" 351 352 #: src/Admin/AdminPage.php 353 msgid "SMS at checkout" 354 msgstr "" 355 356 #: src/Admin/AdminPage.php 357 msgid "Customers decide whether to subscribe. DropUI supports Polish phone numbers for SMS marketing." 358 msgstr "" 359 360 #: src/Admin/AdminPage.php 361 msgid "Save SMS settings" 362 msgstr "" 363 364 #: src/Admin/AdminPage.php 365 msgid "Email from MailPoet" 366 msgstr "" 367 368 #: src/Admin/AdminPage.php 369 msgid "Save MailPoet settings" 370 msgstr "" 371 372 #: src/Admin/AdminPage.php 373 msgid "Connect your store" 374 msgstr "" 375 376 #: src/Admin/AdminPage.php 377 msgid "Your store" 378 msgstr "" 379 380 #: src/Admin/AdminPage.php 381 msgid "Grow sales in your WooCommerce store" 382 msgstr "" 383 384 #: src/Admin/AdminPage.php 385 msgid "Collect contacts on your WordPress site" 386 msgstr "" 387 388 #: src/Admin/AdminPage.php 389 msgid "Connect your store to DropUI to recommend products based on purchase history and encourage repeat orders." 390 msgstr "" 391 392 #: src/Admin/AdminPage.php 393 msgid "Add a newsletter signup form. You will see new signups in DropUI." 394 msgstr "" 395 396 #: src/Admin/AdminPage.php 397 msgid "After you connect, DropUI imports products, orders and customer contact details." 398 msgstr "" 399 400 #: src/Admin/AdminPage.php 401 msgid "Site name" 402 msgstr "" 403 404 #: src/Admin/AdminPage.php 405 msgid "Site address" 406 msgstr "" 407 408 #: src/Admin/AdminPage.php 409 msgid "Your account manager" 410 msgstr "" 411 412 #: src/Admin/AdminPage.php 413 msgid "I can help you connect your store, choose a plan or launch a campaign. Email me." 414 msgstr "" 415 416 msgid "This domain already has a WooCommerce store connected to DropUI. Use a separate domain or subdomain for this store." 417 msgstr "" 418 419 msgid "WooCommerce synchronization could not start. Try again or contact your account manager." 420 msgstr "" -
dropui/tags/1.0.7/readme.txt
r3689562 r3840376 3 3 Tags: popup, lead generation, abandoned cart, marketing automation, woocommerce 4 4 Requires at least: 6.3 5 Tested up to: 7. 05 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 67 Stable tag: 1.0.7 8 8 License: GPL v2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 74 74 The plugin requires WordPress 6.3 or newer and PHP 7.4 or newer. 75 75 76 The plugin has been tested up to WordPress 7.0.76 The plugin has been tested with WordPress 7.1.5. 77 77 78 78 In a WordPress Multisite network, each site connects to DropUI independently and has its own configuration and campaigns. … … 143 143 144 144 If the website uses WooCommerce, the processed context may also include product, category, variation, coupon, cart contents, cart value, and checkout stage. 145 146 When an administrator connects a WooCommerce site or starts synchronization from the plugin, DropUI also reads product data, order details and customer contact details from the store. Disconnecting the plugin stops further synchronization. 147 148 Commerce tracking requires an explicit marketing decision through WP Consent API or an explicitly configured consent integration. Without it, cart tracking and personalized recommendations based on browsing remain inactive. 145 149 146 150 The exact scope of processed information depends on the website configuration, enabled features, and active campaigns. … … 174 178 == Changelog == 175 179 180 = 1.0.7 = 181 182 * Added synchronization of WooCommerce products, orders and customer contact details. 183 * Simplified the connection screen for WordPress sites and WooCommerce stores. 184 176 185 = 1.0.6 = 177 186 -
dropui/tags/1.0.7/src/Admin/AdminPage.php
r3689562 r3840376 5 5 use DropUI\Service\DropuiService; 6 6 use DropUI\Service\StoreService; 7 use DropUI\Service\WooCommerceSmsConsent; 7 8 8 9 class AdminPage … … 20 21 21 22 $isConnected = $storeService->hasCompleteConnection(); 23 $isWooCommerce = $storeService->getPlatform() === 'woocommerce'; 24 $wasCommerceSyncEnabled = $isConnected && $storeService->hasCommerceSync(); 25 $wasConnected = $isConnected; 22 26 23 27 if ( … … 47 51 ); 48 52 49 $submitButtonLabel = __('Connect to DropUI', 'dropui'); 53 $connectButtonLabel = $isWooCommerce ? __('Connect your store', 'dropui') : __('Connect to DropUI', 'dropui'); 54 $submitButtonLabel = $connectButtonLabel; 55 56 if (StoreService::WOO_MARKETING_CONSENTS_ENABLED && isset($_POST['dropui_save_woo_sms'])) { 57 $nonce = isset($_POST['dropui_woo_sms_nonce']) ? sanitize_text_field(wp_unslash($_POST['dropui_woo_sms_nonce'])) : ''; 58 if (!current_user_can('manage_options') || !wp_verify_nonce($nonce, 'dropui_save_woo_sms') || 59 !$isConnected || !$storeService->hasCommerceSync()) { 60 $result = ['status' => 'error', 'message' => __('Form security check failed.', 'dropui')]; 61 } else { 62 update_option(WooCommerceSmsConsent::OPTION, isset($_POST['dropui_woo_sms_checkout']) ? '1' : '0', false); 63 $result = ['status' => 'success', 'message' => __('Settings saved.', 'dropui')]; 64 } 65 } 66 67 if (StoreService::WOO_MARKETING_CONSENTS_ENABLED && isset($_POST['dropui_save_mailpoet'])) { 68 $nonce = isset($_POST['dropui_mailpoet_nonce']) ? sanitize_text_field(wp_unslash($_POST['dropui_mailpoet_nonce'])) : ''; 69 if (!current_user_can('manage_options') || !wp_verify_nonce($nonce, 'dropui_save_mailpoet') || 70 !$isConnected || !$storeService->hasCommerceSync() || !class_exists('MailPoet\\API\\API')) { 71 $result = ['status' => 'error', 'message' => __('Form security check failed.', 'dropui')]; 72 } elseif (isset($_POST['dropui_mailpoet_sync']) && !isset($_POST['dropui_mailpoet_confirm'])) { 73 $result = ['status' => 'error', 'message' => __('Confirm the marketing permission before enabling synchronization.', 'dropui')]; 74 } else { 75 $enabled = isset($_POST['dropui_mailpoet_sync']); 76 update_option('dropui_mailpoet_sync_enabled', $enabled ? '1' : '0', false); 77 $result = ['status' => 'success', 'message' => __('Settings saved.', 'dropui')]; 78 } 79 } 50 80 51 81 if ($isConnected) { 52 82 $submitButtonLabel = __('Open DropUI dashboard', 'dropui'); 83 if ($isWooCommerce && !$storeService->hasCommerceSync()) { 84 $submitButtonLabel = __('Open DropUI and start synchronization', 'dropui'); 85 } 53 86 } elseif ($isConnectionIncomplete) { 54 87 $submitButtonLabel = __('Reconnect to DropUI', 'dropui'); … … 83 116 $isConnected = false; 84 117 $isConnectionIncomplete = false; 85 $submitButtonLabel = __('Connect to DropUI', 'dropui');118 $submitButtonLabel = $connectButtonLabel; 86 119 } 87 120 } … … 119 152 120 153 if (($result['status'] ?? '') === 'redirect' && !empty($result['redirect_url'])) { 121 wp_add_inline_script( 122 'dropui-admin', 123 'window.location.href = ' . wp_json_encode($result['redirect_url']) . ';' 124 ); 154 $commerceSyncEnabled = $isConnected && $storeService->hasCommerceSync(); 155 ExchangeCallbackHandler::enqueueCompletionScript(); 125 156 126 157 ?> 127 <div class="wrap dropui-admin" data-dropui-admin> 128 <h1>DropUI</h1> 129 <div class="dropui-connection"> 130 <h2><?php esc_html_e('Redirecting to DropUI...', 'dropui'); ?></h2> 131 <p> 132 <a class="button button-primary" href="<?php echo esc_url($result['redirect_url']); ?>"> 133 <?php esc_html_e('Open DropUI', 'dropui'); ?> 134 </a> 135 </p> 136 </div> 158 <div 159 class="wrap dropui-admin" 160 data-dropui-exchange-callback 161 data-dropui-redirect-url="<?php echo esc_url($result['redirect_url']); ?>" 162 data-dropui-refresh-tabs="<?php echo esc_attr($wasCommerceSyncEnabled !== $commerceSyncEnabled ? '1' : '0'); ?>" 163 > 164 <h1><?php esc_html_e('Redirecting to DropUI...', 'dropui'); ?></h1> 165 <p> 166 <a class="dropui-button dropui-button--primary" href="<?php echo esc_url($result['redirect_url']); ?>"> 167 <?php esc_html_e('Open DropUI', 'dropui'); ?> 168 </a> 169 </p> 137 170 </div> 138 171 <?php … … 145 178 ? sanitize_text_field(wp_unslash($_GET['dropui_status'])) 146 179 : ''; 180 if (!empty($result['notice'])) { 181 $dropuiStatus = $result['notice']; 182 $submitButtonLabel = __('Open DropUI and start synchronization', 'dropui'); 183 } 147 184 148 185 $dropuiStatusMessages = [ 149 186 'connected' => [ 150 ' class' => 'notice-success',187 'tone' => 'success', 151 188 'message' => __('The WordPress site has been connected to DropUI.', 'dropui'), 152 189 ], 153 190 'connected_login_failed' => [ 154 ' class' => 'notice-warning',191 'tone' => 'warning', 155 192 'message' => __('The WordPress site has been connected to DropUI, but automatic login failed. Try going to DropUI again.', 'dropui'), 156 193 ], 194 DropuiService::WOOCOMMERCE_SCOPE_CONFLICT => [ 195 'tone' => 'error', 196 'message' => __('This domain already has a WooCommerce store connected to DropUI. Use a separate domain or subdomain for this store.', 'dropui'), 197 ], 198 DropuiService::WOOCOMMERCE_BRIDGE_UNAVAILABLE => [ 199 'tone' => 'error', 200 'message' => __('WooCommerce synchronization could not start. Try again or contact your account manager.', 'dropui'), 201 ], 157 202 'missing_exchange_params' => [ 158 ' class' => 'notice-error',203 'tone' => 'error', 159 204 'message' => __('The callback data from DropUI is missing.', 'dropui'), 160 205 ], 161 206 'store_mismatch' => [ 162 ' class' => 'notice-error',207 'tone' => 'error', 163 208 'message' => __('The site identifier does not match this WordPress site.', 'dropui'), 164 209 ], 165 210 'exchange_failed' => [ 166 ' class' => 'notice-error',211 'tone' => 'error', 167 212 'message' => __('Could not retrieve complete connection data from DropUI.', 'dropui'), 168 213 ], … … 170 215 171 216 $dropuiStatusNotice = $dropuiStatusMessages[$dropuiStatus] ?? null; 172 $isPolish = substr(determine_locale(), 0, 2) === 'pl';173 $pricingUrl = $isPolish ? 'https://dropui.com/pl/cennik' : 'https://dropui.com/en/pricing';174 $scenariosUrl = $isPolish ? 'https://dropui.com/pl/scenariusze' : 'https://dropui.com/en/scenarios';175 217 $formUrl = admin_url('admin.php?page=dropui'); 176 $iconUrl = plugins_url('assets/images/dropui-icon.png', dirname(__DIR__, 2) . '/dropui-wordpress-app.php'); 218 $pluginFile = dirname(__DIR__, 2) . '/dropui-wordpress-app.php'; 219 $logoUrl = plugins_url('assets/images/dropui-logo.svg', $pluginFile); 220 $panelIconsUrl = plugins_url('assets/images/panel-icons.svg', $pluginFile); 221 $accountManagerName = 'Kornel Szwaja'; 222 $accountManagerPhotoUrl = plugins_url('assets/images/kornel-szwaja.png', $pluginFile); 223 $commerceSyncEnabled = $isConnected && $storeService->hasCommerceSync(); 224 $connectionChanged = $wasConnected !== $isConnected || $wasCommerceSyncEnabled !== $commerceSyncEnabled; 225 if ($connectionChanged) { 226 ExchangeCallbackHandler::enqueueCompletionScript(); 227 } 177 228 178 229 if ($isConnected) { 179 230 $connectionState = 'connected'; 180 $statusLabel = __('Connected', 'dropui'); 181 $heading = __('Your website is connected', 'dropui'); 182 $summary = __('Open the DropUI dashboard to create and publish campaigns.', 'dropui'); 231 $heading = $isWooCommerce && $commerceSyncEnabled 232 ? __('Your WooCommerce store is connected', 'dropui') 233 : __('Your WordPress site is connected', 'dropui'); 234 $summary = ''; 183 235 } elseif ($isConnectionIncomplete) { 184 236 $connectionState = 'incomplete'; 185 $statusLabel = __('Connection incomplete', 'dropui');186 237 $heading = __('Complete your connection', 'dropui'); 187 238 $summary = __('Some connection details are missing. Your website is not fully connected to DropUI yet.', 'dropui'); 188 239 } else { 189 240 $connectionState = 'disconnected'; 190 $statusLabel = __('Not connected', 'dropui'); 191 $heading = __('Connect your website', 'dropui'); 192 $summary = __('Sign in or create a free DropUI account to connect your website.', 'dropui'); 241 $heading = $isWooCommerce 242 ? __('Grow sales in your WooCommerce store', 'dropui') 243 : __('Collect contacts on your WordPress site', 'dropui'); 244 $summary = $isWooCommerce 245 ? __('Connect your store to DropUI to recommend products based on purchase history and encourage repeat orders.', 'dropui') 246 : __('Add a newsletter signup form. You will see new signups in DropUI.', 'dropui'); 193 247 } 194 248 … … 197 251 class="wrap dropui-admin" 198 252 data-dropui-admin 253 <?php if ($connectionChanged): ?>data-dropui-exchange-callback<?php endif; ?> 199 254 data-connection-state="<?php echo esc_attr($connectionState); ?>" 200 255 data-refresh-opener="<?php echo esc_attr(in_array($dropuiStatus, ['connected', 'connected_login_failed'], true) ? '1' : '0'); ?>" 201 256 > 202 257 <header class="dropui-intro"> 203 < h1 class="dropui-brand">204 <img src="<?php echo esc_url($iconUrl); ?>" width="40" height="40" alt="">205 <span><?php esc_html_e('DropUI - More Sales from the Traffic You Already Have', 'dropui'); ?></span>206 </h1>207 < p class="dropui-intro-summary"><?php esc_html_e('Capture leads, recover abandoned carts and grow sales. Reach visitors with relevant offers while they browse your site and after they leave.', 'dropui'); ?></p>258 <img class="dropui-brand" src="<?php echo esc_url($logoUrl); ?>" width="100" height="30" alt="DropUI"> 259 <h1><?php echo esc_html($heading); ?></h1> 260 <?php if ($summary !== ''): ?> 261 <p class="dropui-intro-summary"><?php echo esc_html($summary); ?></p> 262 <?php endif; ?> 208 263 </header> 209 264 210 265 <?php if ($dropuiStatusNotice): ?> 211 <div class=" notice <?php echo esc_attr($dropuiStatusNotice['class']); ?> is-dismissible">266 <div class="dropui-feedback dropui-feedback--<?php echo esc_attr($dropuiStatusNotice['tone']); ?>" role="status"> 212 267 <p><?php echo esc_html($dropuiStatusNotice['message']); ?></p> 213 268 </div> … … 215 270 216 271 <?php if ($hasAdminEmailChanged): ?> 217 <div class="notice notice-warning"> 272 <div class="dropui-feedback dropui-feedback--warning" role="status"> 273 <p><?php esc_html_e('The WordPress administrator email address has changed since the site was connected to DropUI.', 'dropui'); ?></p> 218 274 <p> 219 < strong><?php esc_html_e('Warning:', 'dropui'); ?></strong>220 < ?php esc_html_e('The WordPress administrator email address has changed since the site was connected to DropUI.', 'dropui'); ?>275 <?php esc_html_e('Email used when connecting:', 'dropui'); ?> 276 <strong><?php echo esc_html($connectedAdminEmail); ?></strong> 221 277 </p> 222 278 <p> 223 <?php esc_html_e('Email used when connecting:', 'dropui'); ?>224 <strong><?php echo esc_html($connectedAdminEmail); ?></strong><br>225 279 <?php esc_html_e('Current WordPress email:', 'dropui'); ?> 226 280 <strong><?php echo esc_html($currentAdminEmail); ?></strong> 227 281 </p> 228 <p> 229 <?php esc_html_e('If this change was intentional, disconnect the integration and reconnect the WordPress site.', 'dropui'); ?> 230 </p> 282 <p><?php esc_html_e('If this change was intentional, disconnect the integration and reconnect the WordPress site.', 'dropui'); ?></p> 231 283 </div> 232 284 <?php endif; ?> 233 285 234 286 <?php if ($result && !empty($result['message'])): ?> 235 <div class="notice <?php echo esc_attr(($result['status'] ?? '') === 'error' ? 'notice-error' : 'notice-success'); ?> is-dismissible"> 287 <?php $resultIsError = ($result['status'] ?? '') === 'error'; ?> 288 <div class="dropui-feedback dropui-feedback--<?php echo esc_attr($resultIsError ? 'error' : 'success'); ?>" role="<?php echo esc_attr($resultIsError ? 'alert' : 'status'); ?>"> 236 289 <p><?php echo esc_html($result['message']); ?></p> 237 290 </div> 238 291 <?php endif; ?> 239 292 240 <section class="dropui-connection" aria-labelledby="dropui-heading"> 241 <div class="dropui-connection-main"> 242 <p class="dropui-status dropui-status--<?php echo esc_attr($connectionState); ?>"> 243 <span class="dashicons <?php echo esc_attr($isConnected ? 'dashicons-yes-alt' : 'dashicons-admin-links'); ?>" aria-hidden="true"></span> 244 <?php echo esc_html($statusLabel); ?> 245 </p> 246 <h2 id="dropui-heading"><?php echo esc_html($heading); ?></h2> 247 <?php if ($summary): ?> 248 <p class="dropui-summary"><?php echo esc_html($summary); ?></p> 293 <div class="dropui-page-flow"> 294 <section class="dropui-section" aria-labelledby="dropui-site-heading"> 295 <h2 id="dropui-site-heading"><?php echo esc_html($isWooCommerce ? __('Your store', 'dropui') : __('Website', 'dropui')); ?></h2> 296 <dl class="dropui-columns dropui-data-fields"> 297 <div> 298 <dt><?php esc_html_e('Site name', 'dropui'); ?></dt> 299 <dd><?php echo esc_html(get_bloginfo('name')); ?></dd> 300 </div> 301 <div> 302 <dt><?php esc_html_e('Site address', 'dropui'); ?></dt> 303 <dd><?php echo esc_html(home_url('/')); ?></dd> 304 </div> 305 </dl> 306 307 <?php if ($isWooCommerce && !$commerceSyncEnabled): ?> 308 <?php if ($isConnected): ?> 309 <p class="dropui-sync-help"><?php esc_html_e('Start synchronization to import products, orders and customer contact details.', 'dropui'); ?></p> 310 <?php else: ?> 311 <div class="dropui-woo-summary"> 312 <p> 313 <strong><?php esc_html_e('WooCommerce detected.', 'dropui'); ?></strong> 314 <?php esc_html_e('After you connect, DropUI imports products, orders and customer contact details.', 'dropui'); ?> 315 </p> 316 </div> 317 <?php endif; ?> 249 318 <?php endif; ?> 250 319 251 <dl class="dropui-site"> 252 <dt><?php esc_html_e('Website', 'dropui'); ?></dt> 253 <dd><?php echo esc_html(get_bloginfo('name')); ?></dd> 254 <dd class="dropui-site-url"><?php echo esc_html(home_url('/')); ?></dd> 255 </dl> 256 257 <form action="<?php echo esc_url($formUrl); ?>" method="post" target="_blank"> 258 <?php wp_nonce_field('dropui_connect_store', 'dropui_nonce'); ?> 259 <input type="hidden" name="connect_store" value="1"> 260 <button class="button button-primary dropui-connect-button" type="submit" aria-describedby="<?php echo esc_attr($isConnected ? 'dropui-connection-note' : 'dropui-free-note dropui-connection-note'); ?>"> 261 <?php echo esc_html($submitButtonLabel); ?> 262 <span class="dashicons dashicons-external" aria-hidden="true"></span> 263 </button> 264 <?php if (!$isConnected): ?> 265 <p class="dropui-free" id="dropui-free-note"><span class="dashicons dashicons-yes" aria-hidden="true"></span><?php esc_html_e('No credit card required', 'dropui'); ?></p> 320 <div class="dropui-connection-actions"> 321 <form action="<?php echo esc_url($formUrl); ?>" method="post" target="_blank"> 322 <?php wp_nonce_field('dropui_connect_store', 'dropui_nonce'); ?> 323 <input type="hidden" name="connect_store" value="1"> 324 <button class="dropui-button dropui-button--primary dropui-connect-button" type="submit" aria-describedby="dropui-connection-note"> 325 <?php echo esc_html($submitButtonLabel); ?> 326 </button> 327 <span class="screen-reader-text" id="dropui-connection-note"> 328 <?php esc_html_e('Opens in a new tab. Your WordPress panel stays open.', 'dropui'); ?> 329 </span> 330 </form> 331 <?php if ($isConnected): ?> 332 <form action="<?php echo esc_url($formUrl); ?>" method="post"> 333 <?php wp_nonce_field('dropui_disconnect_store', 'dropui_disconnect_nonce'); ?> 334 <button type="submit" name="disconnect_store" value="1" class="dropui-button dropui-button--disconnect" 335 data-dropui-disconnect-confirm="<?php esc_attr_e('Are you sure you want to disconnect this WordPress site from your DropUI account?', 'dropui'); ?>"> 336 <?php esc_html_e('Disconnect DropUI integration', 'dropui'); ?> 337 </button> 338 </form> 266 339 <?php endif; ?> 267 <p class="description" id="dropui-connection-note"> 268 <?php esc_html_e('Opens in a new tab. Your WordPress panel stays open.', 'dropui'); ?> 269 </p> 270 </form> 271 </div> 272 273 <aside class="dropui-account" aria-labelledby="dropui-account-heading"> 274 <?php if ($isConnected): ?> 275 <h3 id="dropui-account-heading"><?php esc_html_e('Campaigns and results', 'dropui'); ?></h3> 276 <ul class="dropui-checklist"> 277 <li><span class="dashicons dashicons-layout" aria-hidden="true"></span><?php esc_html_e('Campaign editor and AI Assistant', 'dropui'); ?></li> 278 <li><span class="dashicons dashicons-filter" aria-hidden="true"></span><?php esc_html_e('Audiences and display rules', 'dropui'); ?></li> 279 <li><span class="dashicons dashicons-chart-bar" aria-hidden="true"></span><?php esc_html_e('Statistics and A/B tests', 'dropui'); ?></li> 280 </ul> 281 <?php else: ?> 282 <h3 id="dropui-account-heading"><?php esc_html_e('Start with the Free plan', 'dropui'); ?></h3> 283 <p class="description"><?php esc_html_e('Free plan limits apply. WhatsApp is billed separately.', 'dropui'); ?></p> 284 <?php endif; ?> 285 <a href="<?php echo esc_url($pricingUrl); ?>" target="_blank" rel="noopener noreferrer"> 286 <?php esc_html_e('Plans and limits', 'dropui'); ?> 287 <span class="screen-reader-text"><?php esc_html_e('(opens in a new tab)', 'dropui'); ?></span> 288 </a> 289 </aside> 290 </section> 291 292 <div class="dropui-guidance"> 293 <section aria-labelledby="dropui-first-campaign-heading"> 294 <h2 id="dropui-first-campaign-heading"><?php esc_html_e('Start with one campaign', 'dropui'); ?></h2> 295 <?php if (!$isConnected): ?> 296 <p><?php esc_html_e('After connecting your website, you will create and publish campaigns in the DropUI dashboard.', 'dropui'); ?></p> 297 <?php endif; ?> 298 <p> 299 <?php 300 /* translators: %s: link to the ready-made campaign scenarios. */ 301 printf( 302 esc_html__('Choose a %s, use the AI Assistant or create your own campaign. Based on your description, the Assistant suggests copy, a layout and calls to action.', 'dropui'), 303 '<a href="' . esc_url($scenariosUrl) . '" target="_blank" rel="noopener noreferrer">' 304 . esc_html__('ready-made scenario', 'dropui') 305 . '<span class="screen-reader-text"> ' . esc_html__('(opens in a new tab)', 'dropui') . '</span></a>' 306 ); 307 ?> 308 </p> 340 </div> 309 341 </section> 310 <section aria-labelledby="dropui-onboarding-heading"> 311 <h2 id="dropui-onboarding-heading"><?php esc_html_e('Help from an onboarding specialist', 'dropui'); ?></h2> 312 <p><?php esc_html_e('On the Start plan and above, a specialist helps you set up DropUI, create and launch campaigns, and review results. You also get advice on improvements and next steps.', 'dropui'); ?></p> 342 343 <?php if (StoreService::WOO_MARKETING_CONSENTS_ENABLED && $commerceSyncEnabled): ?> 344 <section class="dropui-section" aria-labelledby="dropui-consents-heading"> 345 <h2 id="dropui-consents-heading"><?php esc_html_e('Marketing consents', 'dropui'); ?></h2> 346 <div class="dropui-columns dropui-settings"> 347 <form method="post" aria-labelledby="dropui-sms-heading"> 348 <h3 id="dropui-sms-heading"><?php esc_html_e('SMS at checkout', 'dropui'); ?></h3> 349 <?php wp_nonce_field('dropui_save_woo_sms', 'dropui_woo_sms_nonce'); ?> 350 <label class="dropui-check"> 351 <input type="checkbox" name="dropui_woo_sms_checkout" value="1" <?php checked(get_option(WooCommerceSmsConsent::OPTION), '1'); ?>> 352 <span><?php esc_html_e('Ask for SMS marketing consent at checkout', 'dropui'); ?></span> 353 </label> 354 <p class="dropui-help"><?php esc_html_e('Customers decide whether to subscribe. DropUI supports Polish phone numbers for SMS marketing.', 'dropui'); ?></p> 355 <?php if (!function_exists('woocommerce_register_additional_checkout_field')): ?> 356 <p class="dropui-help"><?php esc_html_e('Update WooCommerce to collect SMS consent in the Checkout block.', 'dropui'); ?></p> 357 <?php endif; ?> 358 <button type="submit" name="dropui_save_woo_sms" value="1" class="dropui-button"><?php esc_html_e('Save SMS settings', 'dropui'); ?></button> 359 </form> 360 361 <?php if (class_exists('MailPoet\\API\\API')): ?> 362 <form method="post" aria-labelledby="dropui-mailpoet-heading"> 363 <h3 id="dropui-mailpoet-heading"><?php esc_html_e('Email from MailPoet', 'dropui'); ?></h3> 364 <?php wp_nonce_field('dropui_save_mailpoet', 'dropui_mailpoet_nonce'); ?> 365 <label class="dropui-check"> 366 <input type="checkbox" name="dropui_mailpoet_sync" value="1" <?php checked(get_option('dropui_mailpoet_sync_enabled'), '1'); ?>> 367 <span><?php esc_html_e('Synchronize MailPoet newsletter subscriptions', 'dropui'); ?></span> 368 </label> 369 <label class="dropui-check"> 370 <input type="checkbox" name="dropui_mailpoet_confirm" value="1"> 371 <span><?php esc_html_e('I confirm that these lists contain permission to send this store’s marketing emails.', 'dropui'); ?></span> 372 </label> 373 <button type="submit" name="dropui_save_mailpoet" value="1" class="dropui-button"><?php esc_html_e('Save MailPoet settings', 'dropui'); ?></button> 374 </form> 375 <?php endif; ?> 376 </div> 377 </section> 378 <?php endif; ?> 379 </div> 380 381 <details class="dropui-account-manager" data-dropui-account-manager> 382 <summary class="dropui-button dropui-account-manager__trigger" aria-controls="dropui-account-manager-card"> 383 <img src="<?php echo esc_url($accountManagerPhotoUrl); ?>" alt="" width="44" height="44"> 384 <span class="dropui-account-manager__identity"> 385 <strong><?php echo esc_html($accountManagerName); ?></strong> 386 <span><?php esc_html_e('Your account manager', 'dropui'); ?></span> 387 </span> 388 </summary> 389 <section class="dropui-account-manager__card" id="dropui-account-manager-card" aria-labelledby="dropui-account-manager-name"> 390 <header class="dropui-account-manager__header"> 391 <img src="<?php echo esc_url($accountManagerPhotoUrl); ?>" alt="" width="48" height="48"> 392 <h2 id="dropui-account-manager-name"><?php echo esc_html($accountManagerName); ?></h2> 393 </header> 394 <p><?php esc_html_e('I can help you connect your store, choose a plan or launch a campaign. Email me.', 'dropui'); ?></p> 395 <div class="dropui-account-manager__links"> 396 <a href="mailto:kornel@dropui.com"> 397 <svg class="dropui-icon" width="20" height="20" aria-hidden="true" focusable="false"> 398 <use href="<?php echo esc_url($panelIconsUrl . '#email'); ?>"></use> 399 </svg> 400 <span>kornel@dropui.com</span> 401 </a> 402 </div> 313 403 </section> 314 </div> 315 316 <footer class="dropui-support"> 317 <div> 318 <h2><?php esc_html_e('Support', 'dropui'); ?></h2> 319 <a href="mailto:support@dropui.com">support@dropui.com</a> 320 </div> 321 <?php if ($isConnected): ?> 322 <form action="<?php echo esc_url($formUrl); ?>" method="post"> 323 <?php wp_nonce_field('dropui_disconnect_store', 'dropui_disconnect_nonce'); ?> 324 <?php submit_button( 325 __('Disconnect DropUI integration', 'dropui'), 326 'secondary', 327 'disconnect_store', 328 false, 329 [ 330 'data-dropui-disconnect-confirm' => __('Are you sure you want to disconnect this WordPress site from your DropUI account?', 'dropui'), 331 ] 332 ); ?> 333 </form> 334 <?php endif; ?> 335 </footer> 404 </details> 336 405 </div> 337 406 <?php -
dropui/tags/1.0.7/src/Admin/ExchangeCallbackHandler.php
r3664245 r3840376 8 8 class ExchangeCallbackHandler 9 9 { 10 public static function enqueueCompletionScript(): void 11 { 12 wp_enqueue_script( 13 'dropui-exchange-callback', 14 plugins_url('assets/js/exchange-callback.js', dirname(__DIR__, 2) . '/dropui-wordpress-app.php'), 15 [], 16 DROPUI_VERSION, 17 true 18 ); 19 } 20 10 21 public function handle(): void 11 22 { … … 74 85 } 75 86 76 $this->redirectWithStatus( 'connected_login_failed');87 $this->redirectWithStatus($loginResult['notice'] ?? 'connected_login_failed'); 77 88 } 78 89 … … 80 91 { 81 92 $safeRedirectUrl = esc_url_raw($redirectUrl); 93 self::enqueueCompletionScript(); 82 94 83 95 header('Content-Type: text/html; charset=' . get_option('blog_charset')); -
dropui/tags/1.0.7/src/Frontend/MasterScriptLoader.php
r3664245 r3840376 37 37 ] 38 38 ); 39 if ($storeService->hasCommerceSync()) { 40 $path = wp_parse_url(get_site_url(), PHP_URL_PATH); 41 $cookiePath = '/' . trim((string) $path, '/'); 42 $config = [ 43 'storeId' => $storeService->getConnectedStoreId(), 44 'cart' => rest_url('wc/store/v1/cart'), 45 'add' => rest_url('wc/store/v1/cart/add-item'), 46 'cartPage' => wc_get_cart_url(), 47 'cookiePath' => $cookiePath === '/' ? '/' : $cookiePath . '/', 48 'consentApiAvailable' => function_exists('wp_has_consent'), 49 'orderId' => is_order_received_page() ? absint(get_query_var('order-received')) : 0, 50 'productId' => is_product() ? get_queried_object_id() : 0, 51 ]; 52 wp_add_inline_script( 53 self::SCRIPT_HANDLE, 54 'window.__dropuiWooCommerce = ' . wp_json_encode($config) . ';', 55 'before' 56 ); 57 } 39 58 } 40 59 } -
dropui/tags/1.0.7/src/Service/DropuiService.php
r3687292 r3840376 5 5 class DropuiService 6 6 { 7 public const WOOCOMMERCE_SCOPE_CONFLICT = 'woocommerce_scope_conflict'; 8 public const WOOCOMMERCE_BRIDGE_UNAVAILABLE = 'woocommerce_bridge_unavailable'; 9 7 10 private function getConfig(): array 8 11 { … … 315 318 // The backend verifies it with a second signature over the same 316 319 // message extended by a version marker and the platform value. 317 $platform = (new StoreService())->getPlatform(); 320 $storeService = new StoreService(); 321 $platform = $storeService->getPlatform(); 318 322 $platformSignature = hash_hmac( 319 323 'sha256', … … 331 335 'platform_signature' => $platformSignature, 332 336 ]; 337 if ($platform === 'woocommerce') { 338 $payload['commerce_bridge'] = '1'; 339 $payload['commerce_bridge_signature'] = hash_hmac( 340 'sha256', 341 $message . "\n2\n" . $platform . "\ncommerce_bridge:1", 342 $authSecret 343 ); 344 } 333 345 334 346 $response = wp_remote_post( … … 362 374 'login_url' => $loginUrl, 363 375 'raw_body' => $body, 376 ]; 377 } 378 379 $code = $data['code'] ?? ''; 380 if ($httpCode === 409 && in_array($code, [self::WOOCOMMERCE_SCOPE_CONFLICT, self::WOOCOMMERCE_BRIDGE_UNAVAILABLE], true)) { 381 $storeService->disableCommerceSync(); 382 return [ 383 'status' => 'error', 384 'notice' => $code, 364 385 ]; 365 386 } … … 383 404 } 384 405 406 if ($platform === 'woocommerce') { 407 if (($data['commerce_bridge_ready'] ?? null) === true) { 408 $storeService->enableCommerceSync(); 409 } elseif (array_key_exists('commerce_bridge_ready', $data) || !$storeService->hasCommerceSync()) { 410 $storeService->disableCommerceSync(); 411 return [ 412 'status' => 'error', 413 'notice' => self::WOOCOMMERCE_BRIDGE_UNAVAILABLE, 414 ]; 415 } 416 } else { 417 $storeService->disableCommerceSync(); 418 } 419 385 420 return [ 386 421 'status' => 'redirect', -
dropui/tags/1.0.7/src/Service/StoreService.php
r3687292 r3840376 5 5 class StoreService 6 6 { 7 // The base WooCommerce integration synchronizes store data only. 8 public const WOO_MARKETING_CONSENTS_ENABLED = false; 9 7 10 private const AUTH_SECRET_PREFIX = 'dropui_encrypted_v1:'; 8 11 private const AUTH_SECRET_CIPHER = 'aes-256-cbc'; … … 38 41 } 39 42 43 public function hasCommerceSync(): bool 44 { 45 return class_exists('WooCommerce') && get_option('dropui_commerce_sync_enabled') === '1'; 46 } 47 48 public function enableCommerceSync(): void 49 { 50 if (class_exists('WooCommerce')) { 51 update_option('dropui_commerce_sync_enabled', '1', false); 52 } 53 } 54 55 public function disableCommerceSync(): void 56 { 57 delete_option('dropui_commerce_sync_enabled'); 58 } 59 40 60 public function getStoreId(): ?string 41 61 { … … 112 132 public function clearConnection(): void 113 133 { 134 delete_option('dropui_mailpoet_sync_enabled'); 135 delete_option(WooCommerceSmsConsent::OPTION); 136 $this->disableCommerceSync(); 114 137 delete_option('dropui_auth_secret'); 115 138 delete_option('dropui_connected_store_id'); … … 123 146 124 147 delete_option('dropui_store_id'); 148 149 global $wpdb; 150 $wpdb->query($wpdb->prepare( 151 "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", 152 $wpdb->esc_like(WooCommerceBridge::REQUEST_NONCE_PREFIX) . '%' 153 )); 125 154 } 126 155 -
dropui/tags/1.0.7/vendor/autoload.php
r3670371 r3840376 15 15 } 16 16 } 17 throw new RuntimeException($err); 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 18 21 } 19 22 20 23 require_once __DIR__ . '/composer/autoload_real.php'; 21 24 22 return ComposerAutoloaderInit 9cf46fb4a3420468178145ec79ef6d1a::getLoader();25 return ComposerAutoloaderInit7b0e39a6d42788a3e8fd4fca5668bebf::getLoader(); -
dropui/tags/1.0.7/vendor/composer/LICENSE
r3664245 r3840376 1 2 1 Copyright (c) Nils Adermann, Jordi Boggiano 3 2 … … 19 18 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 19 THE SOFTWARE. 21 -
dropui/tags/1.0.7/vendor/composer/autoload_classmap.php
r3664245 r3840376 12 12 'DropUI\\Frontend\\MasterScriptLoader' => $baseDir . '/src/Frontend/MasterScriptLoader.php', 13 13 'DropUI\\Service\\DropuiService' => $baseDir . '/src/Service/DropuiService.php', 14 'DropUI\\Service\\MailPoetConsent' => $baseDir . '/src/Service/MailPoetConsent.php', 14 15 'DropUI\\Service\\StoreService' => $baseDir . '/src/Service/StoreService.php', 16 'DropUI\\Service\\WooCommerceBridge' => $baseDir . '/src/Service/WooCommerceBridge.php', 17 'DropUI\\Service\\WooCommerceSmsConsent' => $baseDir . '/src/Service/WooCommerceSmsConsent.php', 15 18 ); -
dropui/tags/1.0.7/vendor/composer/autoload_real.php
r3670371 r3840376 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 9cf46fb4a3420468178145ec79ef6d1a5 class ComposerAutoloaderInit7b0e39a6d42788a3e8fd4fca5668bebf 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit 9cf46fb4a3420468178145ec79ef6d1a', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInit7b0e39a6d42788a3e8fd4fca5668bebf', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 spl_autoload_unregister(array('ComposerAutoloaderInit 9cf46fb4a3420468178145ec79ef6d1a', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInit7b0e39a6d42788a3e8fd4fca5668bebf', 'loadClassLoader')); 28 28 29 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInit 9cf46fb4a3420468178145ec79ef6d1a::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit7b0e39a6d42788a3e8fd4fca5668bebf::getInitializer($loader)); 31 31 32 32 $loader->setClassMapAuthoritative(true); -
dropui/tags/1.0.7/vendor/composer/autoload_static.php
r3670371 r3840376 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 9cf46fb4a3420468178145ec79ef6d1a7 class ComposerStaticInit7b0e39a6d42788a3e8fd4fca5668bebf 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( 10 'D' => 10 'D' => 11 11 array ( 12 12 'DropUI\\' => 7, … … 15 15 16 16 public static $prefixDirsPsr4 = array ( 17 'DropUI\\' => 17 'DropUI\\' => 18 18 array ( 19 19 0 => __DIR__ . '/../..' . '/src', … … 27 27 'DropUI\\Frontend\\MasterScriptLoader' => __DIR__ . '/../..' . '/src/Frontend/MasterScriptLoader.php', 28 28 'DropUI\\Service\\DropuiService' => __DIR__ . '/../..' . '/src/Service/DropuiService.php', 29 'DropUI\\Service\\MailPoetConsent' => __DIR__ . '/../..' . '/src/Service/MailPoetConsent.php', 29 30 'DropUI\\Service\\StoreService' => __DIR__ . '/../..' . '/src/Service/StoreService.php', 31 'DropUI\\Service\\WooCommerceBridge' => __DIR__ . '/../..' . '/src/Service/WooCommerceBridge.php', 32 'DropUI\\Service\\WooCommerceSmsConsent' => __DIR__ . '/../..' . '/src/Service/WooCommerceSmsConsent.php', 30 33 ); 31 34 … … 33 36 { 34 37 return \Closure::bind(function () use ($loader) { 35 $loader->prefixLengthsPsr4 = ComposerStaticInit 9cf46fb4a3420468178145ec79ef6d1a::$prefixLengthsPsr4;36 $loader->prefixDirsPsr4 = ComposerStaticInit 9cf46fb4a3420468178145ec79ef6d1a::$prefixDirsPsr4;37 $loader->classMap = ComposerStaticInit 9cf46fb4a3420468178145ec79ef6d1a::$classMap;38 $loader->prefixLengthsPsr4 = ComposerStaticInit7b0e39a6d42788a3e8fd4fca5668bebf::$prefixLengthsPsr4; 39 $loader->prefixDirsPsr4 = ComposerStaticInit7b0e39a6d42788a3e8fd4fca5668bebf::$prefixDirsPsr4; 40 $loader->classMap = ComposerStaticInit7b0e39a6d42788a3e8fd4fca5668bebf::$classMap; 38 41 39 42 }, null, ClassLoader::class); -
dropui/trunk/assets/css/admin.css
r3689562 r3840376 1 body.toplevel_page_dropui { 2 --dropui-account-manager-width: 320px; 3 background: #fff; 4 } 5 1 6 .dropui-admin { 2 max-width: 1080px; 3 color: #1d2327; 4 letter-spacing: 0; 5 } 6 7 .dropui-admin:lang(ko) { 8 word-break: keep-all; 7 --dropui-ink: #202124; 8 --dropui-muted: #62666d; 9 --dropui-surface: #fff; 10 --dropui-hover: #f0f1f3; 11 --dropui-border: #e2e4e8; 12 --dropui-control-border: #d4d7dc; 13 --dropui-control-hover: #b5bac3; 14 --dropui-primary-hover: #383b40; 15 --dropui-focus: #2463b3; 16 --dropui-focus-ring: rgb(36 99 179 / 12%); 17 --dropui-error: #b42332; 18 --dropui-whatsapp-brand: #25d366; 19 --dropui-shadow: 0 12px 36px rgb(24 30 40 / 14%); 20 max-width: 960px; 21 margin: 0 auto; 22 padding: 76px 32px 64px; 23 color: var(--dropui-ink); 24 font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; 25 overflow-wrap: anywhere; 9 26 } 10 27 … … 15 32 } 16 33 34 .dropui-admin:lang(ko) { 35 word-break: keep-all; 36 } 37 38 .dropui-admin h1, 39 .dropui-admin h2, 40 .dropui-admin h3, 41 .dropui-admin p { 42 margin: 0; 43 padding: 0; 44 color: inherit; 45 line-height: inherit; 46 } 47 48 .dropui-admin h1 { 49 max-width: 720px; 50 font-size: 32px; 51 font-weight: 500; 52 line-height: 1.25; 53 letter-spacing: -.025em; 54 text-wrap: balance; 55 } 56 57 .dropui-admin h2 { 58 font-size: 18px; 59 font-weight: 600; 60 line-height: 1.4; 61 letter-spacing: -.015em; 62 } 63 64 .dropui-admin h3 { 65 font-size: 14px; 66 font-weight: 600; 67 } 68 69 .dropui-admin p + p { 70 margin-top: 8px; 71 } 72 73 .dropui-admin .dropui-help { 74 color: var(--dropui-muted); 75 font-size: 12px; 76 } 77 78 .dropui-admin a:not(.dropui-button) { 79 color: var(--dropui-ink); 80 font-weight: 500; 81 text-underline-offset: 3px; 82 text-decoration-color: var(--dropui-control-border); 83 } 84 85 .dropui-admin a:not(.dropui-button):hover { 86 text-decoration-color: currentColor; 87 } 88 89 .dropui-admin :is(a, button, input, summary):focus-visible { 90 outline: 2px solid var(--dropui-focus); 91 outline-offset: 2px; 92 box-shadow: 0 0 0 2px var(--dropui-focus-ring); 93 } 94 17 95 .dropui-intro { 18 padding: 16px 0 24px; 19 } 20 21 .dropui-admin .dropui-brand { 96 display: grid; 97 justify-items: center; 98 gap: 12px; 99 margin-bottom: 40px; 100 text-align: center; 101 } 102 103 .dropui-brand { 104 display: block; 105 object-fit: contain; 106 } 107 108 .dropui-admin .dropui-intro-summary { 109 max-width: 62ch; 110 color: var(--dropui-muted); 111 line-height: 1.65; 112 text-wrap: pretty; 113 } 114 115 .dropui-page-flow { 116 display: grid; 117 gap: 32px; 118 } 119 120 .dropui-section { 121 display: grid; 122 align-content: start; 123 min-width: 0; 124 gap: 16px; 125 } 126 127 .dropui-sync-help { 128 max-width: 70ch; 129 } 130 131 .dropui-woo-summary { 132 padding: 16px 18px; 133 border-radius: 8px; 134 color: #0b2230; 135 background-color: #e6f4f9; 136 background-image: linear-gradient(90deg, #c1e7f9, #d0edf9 14%, #e1f3f9 36%, #e6f4f9 65%, #e4f3f9 78%, #dbeef9 90%, #c5e9f8); 137 box-shadow: inset 0 0 0 1px rgb(68 131 205 / 32%); 138 } 139 140 .dropui-admin .dropui-woo-summary p { 141 font-size: 14px; 142 line-height: 1.5; 143 } 144 145 .dropui-woo-summary strong { 146 font-weight: 600; 147 } 148 149 @media (max-width: 600px) { 150 .dropui-woo-summary { 151 padding: 16px; 152 } 153 } 154 155 .dropui-columns { 156 display: grid; 157 grid-template-columns: repeat(2, minmax(0, 1fr)); 158 gap: 20px 24px; 159 } 160 161 .dropui-data-fields { 162 margin: 0; 163 } 164 165 .dropui-data-fields > div { 166 display: grid; 167 align-content: start; 168 gap: 6px; 169 } 170 171 .dropui-data-fields dt { 172 color: var(--dropui-muted); 173 font-size: 12px; 174 } 175 176 .dropui-data-fields dd { 177 margin: 0; 178 line-height: 1.6; 179 } 180 181 .dropui-connection-actions { 182 display: flex; 183 flex-wrap: wrap; 184 align-items: center; 185 gap: 8px; 186 } 187 188 .dropui-admin:has(.dropui-account-manager) { 189 padding-bottom: 92px; 190 } 191 192 .dropui-account-manager { 193 position: fixed; 194 right: max(16px, env(safe-area-inset-right)); 195 bottom: max(16px, env(safe-area-inset-bottom)); 196 left: max(16px, env(safe-area-inset-left)); 197 z-index: 110; 198 max-width: var(--dropui-account-manager-width); 199 margin-left: auto; 200 pointer-events: none; 201 } 202 203 #wpwrap.wp-responsive-open .dropui-account-manager { 204 display: none; 205 } 206 207 .dropui-admin .dropui-button.dropui-account-manager__trigger { 208 display: flex; 209 width: fit-content; 210 min-height: 64px; 211 gap: 12px; 212 margin-left: auto; 213 padding: 9px 20px 9px 9px; 214 border-color: transparent; 215 border-radius: 999px; 216 background: var(--dropui-whatsapp-brand); 217 box-shadow: var(--dropui-shadow); 218 list-style: none; 219 pointer-events: auto; 220 } 221 222 .dropui-admin .dropui-button.dropui-account-manager__trigger:hover { 223 border-color: transparent; 224 background: color-mix(in srgb, var(--dropui-whatsapp-brand) 92%, var(--dropui-ink)); 225 } 226 227 .dropui-account-manager__trigger::-webkit-details-marker { 228 display: none; 229 } 230 231 .dropui-account-manager img { 232 flex: none; 233 border-radius: 50%; 234 object-fit: cover; 235 } 236 237 .dropui-account-manager__identity { 238 display: grid; 239 gap: 1px; 240 font-size: 13px; 241 line-height: 1.25; 242 text-align: left; 243 } 244 245 .dropui-account-manager__identity strong { 246 font-size: 15px; 247 font-weight: 600; 248 } 249 250 .dropui-account-manager__card { 251 position: absolute; 252 right: 0; 253 bottom: calc(100% + 12px); 254 width: 100%; 255 max-height: calc(100dvh - 104px - env(safe-area-inset-bottom)); 256 overflow-y: auto; 257 padding: 16px; 258 border: 1px solid var(--dropui-border); 259 border-radius: 12px; 260 background: var(--dropui-surface); 261 box-shadow: var(--dropui-shadow); 262 pointer-events: auto; 263 } 264 265 .dropui-account-manager__header { 22 266 display: flex; 23 267 align-items: center; 24 268 gap: 12px; 25 margin: 0; 26 padding: 0; 27 font-size: 22px; 28 font-weight: 600; 29 line-height: 1.4; 30 overflow-wrap: anywhere; 31 } 32 33 .dropui-brand > span { 34 min-width: 0; 35 } 36 37 .dropui-admin .dropui-intro-summary { 38 max-width: 80ch; 39 margin: 14px 0 0; 40 color: #50575e; 41 font-size: 14px; 42 line-height: 1.7; 43 } 44 45 .dropui-brand img { 46 flex: 0 0 40px; 47 border-radius: 8px; 48 } 49 50 .dropui-admin h2 { 51 margin: 0 0 12px; 52 font-size: 20px; 53 line-height: 1.4; 54 } 55 56 .dropui-admin h3 { 57 margin: 0 0 12px; 58 font-size: 15px; 59 line-height: 1.5; 60 } 61 62 .dropui-admin p, 63 .dropui-admin dd, 64 .dropui-admin a, 65 .dropui-admin h2, 66 .dropui-admin h3 { 67 overflow-wrap: anywhere; 68 } 69 70 .dropui-connection { 71 display: grid; 72 grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); 73 gap: 40px; 74 padding: 28px 0 32px; 75 border-block: 1px solid #c3c4c7; 76 } 77 78 .dropui-admin .dropui-status { 79 display: flex; 269 } 270 271 .dropui-admin .dropui-account-manager__header h2 { 272 font-size: 16px; 273 letter-spacing: 0; 274 } 275 276 .dropui-admin .dropui-account-manager__card p { 277 margin: 12px 0 8px; 278 color: var(--dropui-muted); 279 font-size: 13px; 280 line-height: 1.55; 281 } 282 283 .dropui-account-manager__links { 284 display: grid; 285 justify-items: start; 286 } 287 288 .dropui-account-manager__links a { 289 display: inline-flex; 80 290 align-items: center; 81 gap: 6px; 82 margin: 0 0 12px; 83 font-size: 13px; 84 font-weight: 600; 85 } 86 87 .dropui-status--connected, 88 .dropui-free { 89 color: #12633b; 90 } 91 92 .dropui-status--incomplete { 93 color: #8a4b00; 94 } 95 96 .dropui-summary { 97 max-width: 56ch; 98 margin: 0 0 22px; 99 font-size: 15px; 100 line-height: 1.6; 101 } 102 103 .dropui-site { 104 margin: 0 0 22px; 105 padding-inline-start: 12px; 106 border-inline-start: 3px solid #c3c4c7; 107 } 108 109 .dropui-site dt { 110 margin-bottom: 4px; 111 color: #50575e; 112 font-size: 12px; 113 } 114 115 .dropui-site dd { 116 margin: 0; 117 font-size: 14px; 118 font-weight: 600; 119 line-height: 1.6; 120 } 121 122 .dropui-site .dropui-site-url { 123 color: #50575e; 124 font-size: 13px; 125 font-weight: 400; 126 } 127 128 .dropui-admin .dropui-connect-button { 291 gap: 8px; 292 min-height: 38px; 293 } 294 295 .dropui-icon { 296 flex: none; 297 } 298 299 .dropui-admin .dropui-button { 129 300 display: inline-flex; 130 301 align-items: center; 131 302 justify-content: center; 132 gap: 10px; 133 min-height: 44px; 303 gap: 6px; 134 304 max-width: 100%; 135 padding: 8px 18px; 136 font-size: 14px; 137 line-height: 1.5; 138 white-space: normal; 139 } 140 141 .dropui-admin .dashicons { 142 flex: 0 0 20px; 143 } 144 145 .dropui-admin .description { 146 margin-top: 10px; 147 color: #50575e; 148 font-style: normal; 149 line-height: 1.6; 150 } 151 152 .dropui-account { 153 padding-inline-start: 32px; 154 border-inline-start: 1px solid #c3c4c7; 155 } 156 157 .dropui-account p { 158 line-height: 1.7; 159 } 160 161 .dropui-free, 162 .dropui-checklist li { 305 min-height: 38px; 306 padding: 8px 14px; 307 border: 1px solid var(--dropui-control-border); 308 border-radius: 8px; 309 background: var(--dropui-surface); 310 color: var(--dropui-ink); 311 font: inherit; 312 font-size: 13px; 313 font-weight: 500; 314 line-height: 1.4; 315 text-align: center; 316 text-decoration: none; 317 cursor: pointer; 318 transition: background-color 120ms ease, border-color 120ms ease; 319 } 320 321 .dropui-admin .dropui-button:hover { 322 border-color: var(--dropui-control-hover); 323 background: var(--dropui-hover); 324 } 325 326 .dropui-admin .dropui-button--primary { 327 border-color: var(--dropui-ink); 328 background: var(--dropui-ink); 329 color: var(--dropui-surface); 330 } 331 332 .dropui-admin .dropui-button--primary:hover { 333 border-color: var(--dropui-primary-hover); 334 background: var(--dropui-primary-hover); 335 color: var(--dropui-surface); 336 } 337 338 .dropui-admin .dropui-button--disconnect { 339 color: var(--dropui-error); 340 } 341 342 .dropui-feedback { 343 margin-bottom: 16px; 344 padding: 12px 16px; 345 border-radius: 8px; 346 } 347 348 .dropui-feedback--success { 349 background: #ecf7f1; 350 color: #176b4d; 351 } 352 353 .dropui-feedback--warning { 354 background: #fff8e8; 355 color: #85530b; 356 } 357 358 .dropui-feedback--error { 359 background: #fff0f1; 360 color: var(--dropui-error); 361 } 362 363 .dropui-settings form { 364 display: grid; 365 align-content: start; 366 justify-items: start; 367 gap: 12px; 368 } 369 370 .dropui-settings .dropui-help { 371 margin: 0; 372 } 373 374 .dropui-check { 163 375 display: flex; 164 376 align-items: flex-start; 165 377 gap: 8px; 166 } 167 168 .dropui-admin .dropui-free { 169 margin: 12px 0 0; 170 line-height: 1.6; 171 } 172 173 .dropui-checklist { 174 margin: 20px 0; 175 } 176 177 .dropui-checklist li { 178 margin-bottom: 16px; 179 line-height: 1.6; 180 } 181 182 .dropui-guidance { 183 display: grid; 184 grid-template-columns: repeat(2, minmax(0, 1fr)); 185 gap: 32px; 186 padding: 28px 0; 187 } 188 189 .dropui-guidance h2 { 190 font-size: 18px; 191 } 192 193 .dropui-guidance p { 194 margin: 0; 195 color: #50575e; 196 font-size: 14px; 197 line-height: 1.7; 198 } 199 200 .dropui-guidance p + p { 201 margin-top: 10px; 202 } 203 204 .dropui-support { 205 display: flex; 206 align-items: center; 207 justify-content: space-between; 208 gap: 24px; 209 padding: 24px 0; 210 border-top: 1px solid #c3c4c7; 211 } 212 213 .dropui-support h2 { 214 font-size: 15px; 215 } 216 217 .dropui-support .button { 218 max-width: 100%; 219 white-space: normal; 220 } 221 222 @media (max-width: 960px) { 223 .dropui-connection { 224 gap: 24px; 225 } 226 227 .dropui-account { 228 padding-inline-start: 24px; 229 } 230 } 231 232 @media (max-width: 600px) { 233 .dropui-connection, 234 .dropui-guidance { 378 cursor: pointer; 379 } 380 381 .dropui-check input[type="checkbox"] { 382 display: inline-grid; 383 flex: none; 384 place-content: center; 385 width: 16px; 386 height: 16px; 387 margin: 2px 0 0; 388 border-color: var(--dropui-control-border); 389 border-radius: 4px; 390 } 391 392 .dropui-check input[type="checkbox"]:checked { 393 border-color: var(--dropui-ink); 394 background: var(--dropui-ink); 395 } 396 397 .dropui-check input[type="checkbox"]:checked::before { 398 float: none; 399 width: 5px; 400 height: 8px; 401 margin: -1px 0 0; 402 border: solid var(--dropui-surface); 403 border-width: 0 2px 2px 0; 404 transform: rotate(45deg); 405 content: ""; 406 } 407 408 @media (forced-colors: active) { 409 .dropui-check input[type="checkbox"]:checked { 410 border-color: Highlight; 411 background: Highlight; 412 forced-color-adjust: none; 413 } 414 415 .dropui-check input[type="checkbox"]:checked::before { 416 border-color: HighlightText; 417 } 418 } 419 420 @media (min-width: 783px) { 421 body.toplevel_page_dropui:has(.dropui-account-manager) #wpfooter { 422 padding-inline-end: calc(var(--dropui-account-manager-width) + 28px); 423 } 424 } 425 426 @media (max-width: 782px) { 427 .dropui-admin { 428 padding: 72px 16px 40px; 429 } 430 431 .dropui-intro { 432 margin-bottom: 32px; 433 } 434 435 .dropui-admin h1 { 436 font-size: 26px; 437 } 438 439 .dropui-admin .dropui-button, 440 .dropui-account-manager__links a { 441 min-height: 44px; 442 } 443 444 .dropui-columns { 235 445 grid-template-columns: minmax(0, 1fr); 236 446 } 237 238 .dropui-account { 239 padding: 24px 0 0; 240 border-inline-start: 0; 241 border-top: 1px solid #c3c4c7; 242 } 243 244 .dropui-support { 245 align-items: flex-start; 246 flex-direction: column; 247 } 248 } 447 } -
dropui/trunk/assets/js/admin.js
r3664245 r3840376 20 20 } 21 21 22 const accountManager = adminPage.querySelector('[data-dropui-account-manager]'); 23 if (accountManager) { 24 const closeOutside = function (event) { 25 if (accountManager.open && !accountManager.contains(event.target)) { 26 accountManager.open = false; 27 } 28 }; 29 document.addEventListener('pointerdown', closeOutside); 30 document.addEventListener('focusin', closeOutside); 31 accountManager.addEventListener('keydown', function (event) { 32 if (event.key !== 'Escape' || !accountManager.open) { 33 return; 34 } 35 event.preventDefault(); 36 event.stopPropagation(); 37 accountManager.open = false; 38 accountManager.querySelector('summary').focus({ preventScroll: true }); 39 }); 40 } 41 22 42 const disconnectButton = adminPage.querySelector( 23 43 '[data-dropui-disconnect-confirm]' -
dropui/trunk/assets/js/exchange-callback.js
r3664245 r3840376 4 4 5 5 if (callbackPage) { 6 try { 7 localStorage.setItem( 8 'dropui_connection_updated', 9 String(Date.now()) 10 ); 11 } catch (error) { 12 // Ignore localStorage errors. 13 } 6 if (callbackPage.dataset.dropuiRefreshTabs !== '0') { 7 try { 8 localStorage.setItem( 9 'dropui_connection_updated', 10 String(Date.now()) 11 ); 12 } catch (error) { 13 // Ignore localStorage errors. 14 } 14 15 15 if (window.opener && !window.opener.closed) { 16 window.opener.location.reload(); 16 if (window.opener && !window.opener.closed) { 17 window.opener.location.reload(); 18 } 17 19 } 18 20 -
dropui/trunk/config/dropui.php
r3664245 r3840376 1 1 <?php 2 2 3 return [ 4 'base_url' => 'https://app.dropui.com/', 5 ]; 3 return ['base_url' => 'https://app.dropui.com/']; -
dropui/trunk/dropui-wordpress-app.php
r3689562 r3840376 5 5 Plugin URI: https://dropui.com/integrations/wordpress 6 6 Description: Connect your WordPress site to DropUI and manage your campaigns from your DropUI account. 7 Version: 1.0. 67 Version: 1.0.7 8 8 Requires at least: 6.3 9 9 Requires PHP: 7.4 … … 21 21 22 22 if (!defined('DROPUI_VERSION')) { 23 define('DROPUI_VERSION', '1.0. 6');23 define('DROPUI_VERSION', '1.0.7'); 24 24 } 25 25 … … 29 29 use DropUI\Admin\ExchangeCallbackHandler; 30 30 use DropUI\Frontend\MasterScriptLoader; 31 use DropUI\Service\WooCommerceBridge; 32 use DropUI\Service\WooCommerceSmsConsent; 31 33 32 34 (new MasterScriptLoader())->register(); 35 36 add_action('admin_post_nopriv_dropui_commerce_read', [new WooCommerceBridge(), 'handle']); 37 add_action('admin_post_dropui_commerce_read', [new WooCommerceBridge(), 'handle']); 38 add_action('woocommerce_checkout_create_order', [new WooCommerceBridge(), 'captureCartToken']); 39 add_action('woocommerce_store_api_checkout_update_order_meta', [new WooCommerceBridge(), 'captureCartToken']); 40 $dropuiSmsConsent = new WooCommerceSmsConsent(); 41 add_action('woocommerce_init', [$dropuiSmsConsent, 'registerBlockField']); 42 add_action('woocommerce_after_order_notes', [$dropuiSmsConsent, 'renderClassicField']); 43 add_action('woocommerce_checkout_create_order', [$dropuiSmsConsent, 'captureClassic']); 44 add_action('woocommerce_store_api_checkout_update_order_from_request', [$dropuiSmsConsent, 'readBlockSubmission'], 10, 2); 45 add_action('woocommerce_store_api_checkout_order_processed', [$dropuiSmsConsent, 'captureBlock']); 46 add_filter('wp_consent_api_registered_' . plugin_basename(__FILE__), '__return_true'); 47 add_action('before_woocommerce_init', function () { 48 if (class_exists('Automattic\\WooCommerce\\Utilities\\FeaturesUtil')) { 49 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 50 'custom_order_tables', __FILE__, true 51 ); 52 } 53 }); 54 55 // WooCommerce registers checkout fields at init priority 0. 56 add_action('init', function () { 57 load_plugin_textdomain('dropui', false, dirname(plugin_basename(__FILE__)) . '/languages'); 58 59 if (determine_locale() === 'pl_PL') { 60 // Keep WordPress.org translations and supplement them with bundled Polish strings. 61 get_translations_for_domain('dropui'); 62 load_textdomain('dropui', __DIR__ . '/languages/dropui-pl_PL.mo', 'pl_PL'); 63 } 64 }, -1); 33 65 34 66 add_action('admin_enqueue_scripts', function ($hook) { … … 40 72 'dropui-admin', 41 73 plugin_dir_url(__FILE__) . 'assets/css/admin.css', 42 [ 'dashicons'],74 [], 43 75 DROPUI_VERSION 44 76 ); … … 74 106 // run, so this happens once and never again. 75 107 add_action('admin_init', function () { 76 if (!get_option('dropui_activation_redirect')) { 108 if ((defined('WP_CLI') && WP_CLI) || wp_doing_ajax() || is_network_admin() || 109 !current_user_can('manage_options') || !get_option('dropui_activation_redirect')) { 77 110 return; 78 111 } … … 86 119 } 87 120 88 if (wp_doing_ajax() || is_network_admin()) {89 return;90 }91 92 if (!current_user_can('manage_options')) {93 return;94 }95 96 121 wp_safe_redirect(admin_url('admin.php?page=dropui')); 97 122 exit; … … 99 124 100 125 add_action('admin_post_dropui_exchange_callback', function () { 101 wp_enqueue_script(102 'dropui-exchange-callback',103 plugin_dir_url(__FILE__) . 'assets/js/exchange-callback.js',104 [],105 DROPUI_VERSION,106 true107 );108 109 126 (new ExchangeCallbackHandler())->handle(); 110 127 }); -
dropui/trunk/languages/dropui.pot
r3689562 r3840376 174 174 175 175 #: src/Admin/AdminPage.php 176 msgid "Start with one campaign"177 msgstr ""178 179 #: src/Admin/AdminPage.php180 176 msgid "After connecting your website, you will create and publish campaigns in the DropUI dashboard." 181 177 msgstr "" … … 285 281 msgid "Unable to encode DropUI auth secret." 286 282 msgstr "" 283 284 #: src/Admin/AdminPage.php 285 msgid "Open DropUI and start synchronization" 286 msgstr "" 287 288 #: src/Admin/AdminPage.php 289 msgid "Connecting synchronizes products, orders and customer contact details with DropUI. Existing marketing consents are not imported automatically." 290 msgstr "" 291 292 #: src/Admin/AdminPage.php 293 msgid "Cart tracking requires an explicit marketing decision from a consent manager compatible with WP Consent API or a configured consent integration." 294 msgstr "" 295 296 #: src/Admin/AdminPage.php 297 msgid "Synchronize MailPoet newsletter subscriptions" 298 msgstr "" 299 300 #: src/Admin/AdminPage.php 301 msgid "I confirm that these lists contain permission to send this store’s marketing emails." 302 msgstr "" 303 304 #: src/Admin/AdminPage.php 305 msgid "Save settings" 306 msgstr "" 307 308 #: src/Admin/AdminPage.php 309 msgid "Settings saved." 310 msgstr "" 311 312 #: src/Admin/AdminPage.php 313 msgid "Confirm the marketing permission before enabling synchronization." 314 msgstr "" 315 316 #: src/Admin/AdminPage.php 317 msgid "Ask for SMS marketing consent at checkout" 318 msgstr "" 319 320 #: src/Admin/AdminPage.php 321 msgid "SMS marketing in DropUI supports Polish phone numbers." 322 msgstr "" 323 324 #: src/Admin/AdminPage.php 325 msgid "Update WooCommerce to collect SMS consent in the Checkout block." 326 msgstr "" 327 328 #: src/Service/WooCommerceSmsConsent.php 329 msgid "I agree to receive marketing text messages from this store at the phone number provided." 330 msgstr "" 331 332 #: src/Admin/AdminPage.php 333 msgid "Your WooCommerce store is connected" 334 msgstr "" 335 336 #: src/Admin/AdminPage.php 337 msgid "Your WordPress site is connected" 338 msgstr "" 339 340 #: src/Admin/AdminPage.php 341 msgid "WooCommerce detected." 342 msgstr "" 343 344 #: src/Admin/AdminPage.php 345 msgid "Start synchronization to import products, orders and customer contact details." 346 msgstr "" 347 348 #: src/Admin/AdminPage.php 349 msgid "Marketing consents" 350 msgstr "" 351 352 #: src/Admin/AdminPage.php 353 msgid "SMS at checkout" 354 msgstr "" 355 356 #: src/Admin/AdminPage.php 357 msgid "Customers decide whether to subscribe. DropUI supports Polish phone numbers for SMS marketing." 358 msgstr "" 359 360 #: src/Admin/AdminPage.php 361 msgid "Save SMS settings" 362 msgstr "" 363 364 #: src/Admin/AdminPage.php 365 msgid "Email from MailPoet" 366 msgstr "" 367 368 #: src/Admin/AdminPage.php 369 msgid "Save MailPoet settings" 370 msgstr "" 371 372 #: src/Admin/AdminPage.php 373 msgid "Connect your store" 374 msgstr "" 375 376 #: src/Admin/AdminPage.php 377 msgid "Your store" 378 msgstr "" 379 380 #: src/Admin/AdminPage.php 381 msgid "Grow sales in your WooCommerce store" 382 msgstr "" 383 384 #: src/Admin/AdminPage.php 385 msgid "Collect contacts on your WordPress site" 386 msgstr "" 387 388 #: src/Admin/AdminPage.php 389 msgid "Connect your store to DropUI to recommend products based on purchase history and encourage repeat orders." 390 msgstr "" 391 392 #: src/Admin/AdminPage.php 393 msgid "Add a newsletter signup form. You will see new signups in DropUI." 394 msgstr "" 395 396 #: src/Admin/AdminPage.php 397 msgid "After you connect, DropUI imports products, orders and customer contact details." 398 msgstr "" 399 400 #: src/Admin/AdminPage.php 401 msgid "Site name" 402 msgstr "" 403 404 #: src/Admin/AdminPage.php 405 msgid "Site address" 406 msgstr "" 407 408 #: src/Admin/AdminPage.php 409 msgid "Your account manager" 410 msgstr "" 411 412 #: src/Admin/AdminPage.php 413 msgid "I can help you connect your store, choose a plan or launch a campaign. Email me." 414 msgstr "" 415 416 msgid "This domain already has a WooCommerce store connected to DropUI. Use a separate domain or subdomain for this store." 417 msgstr "" 418 419 msgid "WooCommerce synchronization could not start. Try again or contact your account manager." 420 msgstr "" -
dropui/trunk/readme.txt
r3689562 r3840376 3 3 Tags: popup, lead generation, abandoned cart, marketing automation, woocommerce 4 4 Requires at least: 6.3 5 Tested up to: 7. 05 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 67 Stable tag: 1.0.7 8 8 License: GPL v2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 74 74 The plugin requires WordPress 6.3 or newer and PHP 7.4 or newer. 75 75 76 The plugin has been tested up to WordPress 7.0.76 The plugin has been tested with WordPress 7.1.5. 77 77 78 78 In a WordPress Multisite network, each site connects to DropUI independently and has its own configuration and campaigns. … … 143 143 144 144 If the website uses WooCommerce, the processed context may also include product, category, variation, coupon, cart contents, cart value, and checkout stage. 145 146 When an administrator connects a WooCommerce site or starts synchronization from the plugin, DropUI also reads product data, order details and customer contact details from the store. Disconnecting the plugin stops further synchronization. 147 148 Commerce tracking requires an explicit marketing decision through WP Consent API or an explicitly configured consent integration. Without it, cart tracking and personalized recommendations based on browsing remain inactive. 145 149 146 150 The exact scope of processed information depends on the website configuration, enabled features, and active campaigns. … … 174 178 == Changelog == 175 179 180 = 1.0.7 = 181 182 * Added synchronization of WooCommerce products, orders and customer contact details. 183 * Simplified the connection screen for WordPress sites and WooCommerce stores. 184 176 185 = 1.0.6 = 177 186 -
dropui/trunk/src/Admin/AdminPage.php
r3689562 r3840376 5 5 use DropUI\Service\DropuiService; 6 6 use DropUI\Service\StoreService; 7 use DropUI\Service\WooCommerceSmsConsent; 7 8 8 9 class AdminPage … … 20 21 21 22 $isConnected = $storeService->hasCompleteConnection(); 23 $isWooCommerce = $storeService->getPlatform() === 'woocommerce'; 24 $wasCommerceSyncEnabled = $isConnected && $storeService->hasCommerceSync(); 25 $wasConnected = $isConnected; 22 26 23 27 if ( … … 47 51 ); 48 52 49 $submitButtonLabel = __('Connect to DropUI', 'dropui'); 53 $connectButtonLabel = $isWooCommerce ? __('Connect your store', 'dropui') : __('Connect to DropUI', 'dropui'); 54 $submitButtonLabel = $connectButtonLabel; 55 56 if (StoreService::WOO_MARKETING_CONSENTS_ENABLED && isset($_POST['dropui_save_woo_sms'])) { 57 $nonce = isset($_POST['dropui_woo_sms_nonce']) ? sanitize_text_field(wp_unslash($_POST['dropui_woo_sms_nonce'])) : ''; 58 if (!current_user_can('manage_options') || !wp_verify_nonce($nonce, 'dropui_save_woo_sms') || 59 !$isConnected || !$storeService->hasCommerceSync()) { 60 $result = ['status' => 'error', 'message' => __('Form security check failed.', 'dropui')]; 61 } else { 62 update_option(WooCommerceSmsConsent::OPTION, isset($_POST['dropui_woo_sms_checkout']) ? '1' : '0', false); 63 $result = ['status' => 'success', 'message' => __('Settings saved.', 'dropui')]; 64 } 65 } 66 67 if (StoreService::WOO_MARKETING_CONSENTS_ENABLED && isset($_POST['dropui_save_mailpoet'])) { 68 $nonce = isset($_POST['dropui_mailpoet_nonce']) ? sanitize_text_field(wp_unslash($_POST['dropui_mailpoet_nonce'])) : ''; 69 if (!current_user_can('manage_options') || !wp_verify_nonce($nonce, 'dropui_save_mailpoet') || 70 !$isConnected || !$storeService->hasCommerceSync() || !class_exists('MailPoet\\API\\API')) { 71 $result = ['status' => 'error', 'message' => __('Form security check failed.', 'dropui')]; 72 } elseif (isset($_POST['dropui_mailpoet_sync']) && !isset($_POST['dropui_mailpoet_confirm'])) { 73 $result = ['status' => 'error', 'message' => __('Confirm the marketing permission before enabling synchronization.', 'dropui')]; 74 } else { 75 $enabled = isset($_POST['dropui_mailpoet_sync']); 76 update_option('dropui_mailpoet_sync_enabled', $enabled ? '1' : '0', false); 77 $result = ['status' => 'success', 'message' => __('Settings saved.', 'dropui')]; 78 } 79 } 50 80 51 81 if ($isConnected) { 52 82 $submitButtonLabel = __('Open DropUI dashboard', 'dropui'); 83 if ($isWooCommerce && !$storeService->hasCommerceSync()) { 84 $submitButtonLabel = __('Open DropUI and start synchronization', 'dropui'); 85 } 53 86 } elseif ($isConnectionIncomplete) { 54 87 $submitButtonLabel = __('Reconnect to DropUI', 'dropui'); … … 83 116 $isConnected = false; 84 117 $isConnectionIncomplete = false; 85 $submitButtonLabel = __('Connect to DropUI', 'dropui');118 $submitButtonLabel = $connectButtonLabel; 86 119 } 87 120 } … … 119 152 120 153 if (($result['status'] ?? '') === 'redirect' && !empty($result['redirect_url'])) { 121 wp_add_inline_script( 122 'dropui-admin', 123 'window.location.href = ' . wp_json_encode($result['redirect_url']) . ';' 124 ); 154 $commerceSyncEnabled = $isConnected && $storeService->hasCommerceSync(); 155 ExchangeCallbackHandler::enqueueCompletionScript(); 125 156 126 157 ?> 127 <div class="wrap dropui-admin" data-dropui-admin> 128 <h1>DropUI</h1> 129 <div class="dropui-connection"> 130 <h2><?php esc_html_e('Redirecting to DropUI...', 'dropui'); ?></h2> 131 <p> 132 <a class="button button-primary" href="<?php echo esc_url($result['redirect_url']); ?>"> 133 <?php esc_html_e('Open DropUI', 'dropui'); ?> 134 </a> 135 </p> 136 </div> 158 <div 159 class="wrap dropui-admin" 160 data-dropui-exchange-callback 161 data-dropui-redirect-url="<?php echo esc_url($result['redirect_url']); ?>" 162 data-dropui-refresh-tabs="<?php echo esc_attr($wasCommerceSyncEnabled !== $commerceSyncEnabled ? '1' : '0'); ?>" 163 > 164 <h1><?php esc_html_e('Redirecting to DropUI...', 'dropui'); ?></h1> 165 <p> 166 <a class="dropui-button dropui-button--primary" href="<?php echo esc_url($result['redirect_url']); ?>"> 167 <?php esc_html_e('Open DropUI', 'dropui'); ?> 168 </a> 169 </p> 137 170 </div> 138 171 <?php … … 145 178 ? sanitize_text_field(wp_unslash($_GET['dropui_status'])) 146 179 : ''; 180 if (!empty($result['notice'])) { 181 $dropuiStatus = $result['notice']; 182 $submitButtonLabel = __('Open DropUI and start synchronization', 'dropui'); 183 } 147 184 148 185 $dropuiStatusMessages = [ 149 186 'connected' => [ 150 ' class' => 'notice-success',187 'tone' => 'success', 151 188 'message' => __('The WordPress site has been connected to DropUI.', 'dropui'), 152 189 ], 153 190 'connected_login_failed' => [ 154 ' class' => 'notice-warning',191 'tone' => 'warning', 155 192 'message' => __('The WordPress site has been connected to DropUI, but automatic login failed. Try going to DropUI again.', 'dropui'), 156 193 ], 194 DropuiService::WOOCOMMERCE_SCOPE_CONFLICT => [ 195 'tone' => 'error', 196 'message' => __('This domain already has a WooCommerce store connected to DropUI. Use a separate domain or subdomain for this store.', 'dropui'), 197 ], 198 DropuiService::WOOCOMMERCE_BRIDGE_UNAVAILABLE => [ 199 'tone' => 'error', 200 'message' => __('WooCommerce synchronization could not start. Try again or contact your account manager.', 'dropui'), 201 ], 157 202 'missing_exchange_params' => [ 158 ' class' => 'notice-error',203 'tone' => 'error', 159 204 'message' => __('The callback data from DropUI is missing.', 'dropui'), 160 205 ], 161 206 'store_mismatch' => [ 162 ' class' => 'notice-error',207 'tone' => 'error', 163 208 'message' => __('The site identifier does not match this WordPress site.', 'dropui'), 164 209 ], 165 210 'exchange_failed' => [ 166 ' class' => 'notice-error',211 'tone' => 'error', 167 212 'message' => __('Could not retrieve complete connection data from DropUI.', 'dropui'), 168 213 ], … … 170 215 171 216 $dropuiStatusNotice = $dropuiStatusMessages[$dropuiStatus] ?? null; 172 $isPolish = substr(determine_locale(), 0, 2) === 'pl';173 $pricingUrl = $isPolish ? 'https://dropui.com/pl/cennik' : 'https://dropui.com/en/pricing';174 $scenariosUrl = $isPolish ? 'https://dropui.com/pl/scenariusze' : 'https://dropui.com/en/scenarios';175 217 $formUrl = admin_url('admin.php?page=dropui'); 176 $iconUrl = plugins_url('assets/images/dropui-icon.png', dirname(__DIR__, 2) . '/dropui-wordpress-app.php'); 218 $pluginFile = dirname(__DIR__, 2) . '/dropui-wordpress-app.php'; 219 $logoUrl = plugins_url('assets/images/dropui-logo.svg', $pluginFile); 220 $panelIconsUrl = plugins_url('assets/images/panel-icons.svg', $pluginFile); 221 $accountManagerName = 'Kornel Szwaja'; 222 $accountManagerPhotoUrl = plugins_url('assets/images/kornel-szwaja.png', $pluginFile); 223 $commerceSyncEnabled = $isConnected && $storeService->hasCommerceSync(); 224 $connectionChanged = $wasConnected !== $isConnected || $wasCommerceSyncEnabled !== $commerceSyncEnabled; 225 if ($connectionChanged) { 226 ExchangeCallbackHandler::enqueueCompletionScript(); 227 } 177 228 178 229 if ($isConnected) { 179 230 $connectionState = 'connected'; 180 $statusLabel = __('Connected', 'dropui'); 181 $heading = __('Your website is connected', 'dropui'); 182 $summary = __('Open the DropUI dashboard to create and publish campaigns.', 'dropui'); 231 $heading = $isWooCommerce && $commerceSyncEnabled 232 ? __('Your WooCommerce store is connected', 'dropui') 233 : __('Your WordPress site is connected', 'dropui'); 234 $summary = ''; 183 235 } elseif ($isConnectionIncomplete) { 184 236 $connectionState = 'incomplete'; 185 $statusLabel = __('Connection incomplete', 'dropui');186 237 $heading = __('Complete your connection', 'dropui'); 187 238 $summary = __('Some connection details are missing. Your website is not fully connected to DropUI yet.', 'dropui'); 188 239 } else { 189 240 $connectionState = 'disconnected'; 190 $statusLabel = __('Not connected', 'dropui'); 191 $heading = __('Connect your website', 'dropui'); 192 $summary = __('Sign in or create a free DropUI account to connect your website.', 'dropui'); 241 $heading = $isWooCommerce 242 ? __('Grow sales in your WooCommerce store', 'dropui') 243 : __('Collect contacts on your WordPress site', 'dropui'); 244 $summary = $isWooCommerce 245 ? __('Connect your store to DropUI to recommend products based on purchase history and encourage repeat orders.', 'dropui') 246 : __('Add a newsletter signup form. You will see new signups in DropUI.', 'dropui'); 193 247 } 194 248 … … 197 251 class="wrap dropui-admin" 198 252 data-dropui-admin 253 <?php if ($connectionChanged): ?>data-dropui-exchange-callback<?php endif; ?> 199 254 data-connection-state="<?php echo esc_attr($connectionState); ?>" 200 255 data-refresh-opener="<?php echo esc_attr(in_array($dropuiStatus, ['connected', 'connected_login_failed'], true) ? '1' : '0'); ?>" 201 256 > 202 257 <header class="dropui-intro"> 203 < h1 class="dropui-brand">204 <img src="<?php echo esc_url($iconUrl); ?>" width="40" height="40" alt="">205 <span><?php esc_html_e('DropUI - More Sales from the Traffic You Already Have', 'dropui'); ?></span>206 </h1>207 < p class="dropui-intro-summary"><?php esc_html_e('Capture leads, recover abandoned carts and grow sales. Reach visitors with relevant offers while they browse your site and after they leave.', 'dropui'); ?></p>258 <img class="dropui-brand" src="<?php echo esc_url($logoUrl); ?>" width="100" height="30" alt="DropUI"> 259 <h1><?php echo esc_html($heading); ?></h1> 260 <?php if ($summary !== ''): ?> 261 <p class="dropui-intro-summary"><?php echo esc_html($summary); ?></p> 262 <?php endif; ?> 208 263 </header> 209 264 210 265 <?php if ($dropuiStatusNotice): ?> 211 <div class=" notice <?php echo esc_attr($dropuiStatusNotice['class']); ?> is-dismissible">266 <div class="dropui-feedback dropui-feedback--<?php echo esc_attr($dropuiStatusNotice['tone']); ?>" role="status"> 212 267 <p><?php echo esc_html($dropuiStatusNotice['message']); ?></p> 213 268 </div> … … 215 270 216 271 <?php if ($hasAdminEmailChanged): ?> 217 <div class="notice notice-warning"> 272 <div class="dropui-feedback dropui-feedback--warning" role="status"> 273 <p><?php esc_html_e('The WordPress administrator email address has changed since the site was connected to DropUI.', 'dropui'); ?></p> 218 274 <p> 219 < strong><?php esc_html_e('Warning:', 'dropui'); ?></strong>220 < ?php esc_html_e('The WordPress administrator email address has changed since the site was connected to DropUI.', 'dropui'); ?>275 <?php esc_html_e('Email used when connecting:', 'dropui'); ?> 276 <strong><?php echo esc_html($connectedAdminEmail); ?></strong> 221 277 </p> 222 278 <p> 223 <?php esc_html_e('Email used when connecting:', 'dropui'); ?>224 <strong><?php echo esc_html($connectedAdminEmail); ?></strong><br>225 279 <?php esc_html_e('Current WordPress email:', 'dropui'); ?> 226 280 <strong><?php echo esc_html($currentAdminEmail); ?></strong> 227 281 </p> 228 <p> 229 <?php esc_html_e('If this change was intentional, disconnect the integration and reconnect the WordPress site.', 'dropui'); ?> 230 </p> 282 <p><?php esc_html_e('If this change was intentional, disconnect the integration and reconnect the WordPress site.', 'dropui'); ?></p> 231 283 </div> 232 284 <?php endif; ?> 233 285 234 286 <?php if ($result && !empty($result['message'])): ?> 235 <div class="notice <?php echo esc_attr(($result['status'] ?? '') === 'error' ? 'notice-error' : 'notice-success'); ?> is-dismissible"> 287 <?php $resultIsError = ($result['status'] ?? '') === 'error'; ?> 288 <div class="dropui-feedback dropui-feedback--<?php echo esc_attr($resultIsError ? 'error' : 'success'); ?>" role="<?php echo esc_attr($resultIsError ? 'alert' : 'status'); ?>"> 236 289 <p><?php echo esc_html($result['message']); ?></p> 237 290 </div> 238 291 <?php endif; ?> 239 292 240 <section class="dropui-connection" aria-labelledby="dropui-heading"> 241 <div class="dropui-connection-main"> 242 <p class="dropui-status dropui-status--<?php echo esc_attr($connectionState); ?>"> 243 <span class="dashicons <?php echo esc_attr($isConnected ? 'dashicons-yes-alt' : 'dashicons-admin-links'); ?>" aria-hidden="true"></span> 244 <?php echo esc_html($statusLabel); ?> 245 </p> 246 <h2 id="dropui-heading"><?php echo esc_html($heading); ?></h2> 247 <?php if ($summary): ?> 248 <p class="dropui-summary"><?php echo esc_html($summary); ?></p> 293 <div class="dropui-page-flow"> 294 <section class="dropui-section" aria-labelledby="dropui-site-heading"> 295 <h2 id="dropui-site-heading"><?php echo esc_html($isWooCommerce ? __('Your store', 'dropui') : __('Website', 'dropui')); ?></h2> 296 <dl class="dropui-columns dropui-data-fields"> 297 <div> 298 <dt><?php esc_html_e('Site name', 'dropui'); ?></dt> 299 <dd><?php echo esc_html(get_bloginfo('name')); ?></dd> 300 </div> 301 <div> 302 <dt><?php esc_html_e('Site address', 'dropui'); ?></dt> 303 <dd><?php echo esc_html(home_url('/')); ?></dd> 304 </div> 305 </dl> 306 307 <?php if ($isWooCommerce && !$commerceSyncEnabled): ?> 308 <?php if ($isConnected): ?> 309 <p class="dropui-sync-help"><?php esc_html_e('Start synchronization to import products, orders and customer contact details.', 'dropui'); ?></p> 310 <?php else: ?> 311 <div class="dropui-woo-summary"> 312 <p> 313 <strong><?php esc_html_e('WooCommerce detected.', 'dropui'); ?></strong> 314 <?php esc_html_e('After you connect, DropUI imports products, orders and customer contact details.', 'dropui'); ?> 315 </p> 316 </div> 317 <?php endif; ?> 249 318 <?php endif; ?> 250 319 251 <dl class="dropui-site"> 252 <dt><?php esc_html_e('Website', 'dropui'); ?></dt> 253 <dd><?php echo esc_html(get_bloginfo('name')); ?></dd> 254 <dd class="dropui-site-url"><?php echo esc_html(home_url('/')); ?></dd> 255 </dl> 256 257 <form action="<?php echo esc_url($formUrl); ?>" method="post" target="_blank"> 258 <?php wp_nonce_field('dropui_connect_store', 'dropui_nonce'); ?> 259 <input type="hidden" name="connect_store" value="1"> 260 <button class="button button-primary dropui-connect-button" type="submit" aria-describedby="<?php echo esc_attr($isConnected ? 'dropui-connection-note' : 'dropui-free-note dropui-connection-note'); ?>"> 261 <?php echo esc_html($submitButtonLabel); ?> 262 <span class="dashicons dashicons-external" aria-hidden="true"></span> 263 </button> 264 <?php if (!$isConnected): ?> 265 <p class="dropui-free" id="dropui-free-note"><span class="dashicons dashicons-yes" aria-hidden="true"></span><?php esc_html_e('No credit card required', 'dropui'); ?></p> 320 <div class="dropui-connection-actions"> 321 <form action="<?php echo esc_url($formUrl); ?>" method="post" target="_blank"> 322 <?php wp_nonce_field('dropui_connect_store', 'dropui_nonce'); ?> 323 <input type="hidden" name="connect_store" value="1"> 324 <button class="dropui-button dropui-button--primary dropui-connect-button" type="submit" aria-describedby="dropui-connection-note"> 325 <?php echo esc_html($submitButtonLabel); ?> 326 </button> 327 <span class="screen-reader-text" id="dropui-connection-note"> 328 <?php esc_html_e('Opens in a new tab. Your WordPress panel stays open.', 'dropui'); ?> 329 </span> 330 </form> 331 <?php if ($isConnected): ?> 332 <form action="<?php echo esc_url($formUrl); ?>" method="post"> 333 <?php wp_nonce_field('dropui_disconnect_store', 'dropui_disconnect_nonce'); ?> 334 <button type="submit" name="disconnect_store" value="1" class="dropui-button dropui-button--disconnect" 335 data-dropui-disconnect-confirm="<?php esc_attr_e('Are you sure you want to disconnect this WordPress site from your DropUI account?', 'dropui'); ?>"> 336 <?php esc_html_e('Disconnect DropUI integration', 'dropui'); ?> 337 </button> 338 </form> 266 339 <?php endif; ?> 267 <p class="description" id="dropui-connection-note"> 268 <?php esc_html_e('Opens in a new tab. Your WordPress panel stays open.', 'dropui'); ?> 269 </p> 270 </form> 271 </div> 272 273 <aside class="dropui-account" aria-labelledby="dropui-account-heading"> 274 <?php if ($isConnected): ?> 275 <h3 id="dropui-account-heading"><?php esc_html_e('Campaigns and results', 'dropui'); ?></h3> 276 <ul class="dropui-checklist"> 277 <li><span class="dashicons dashicons-layout" aria-hidden="true"></span><?php esc_html_e('Campaign editor and AI Assistant', 'dropui'); ?></li> 278 <li><span class="dashicons dashicons-filter" aria-hidden="true"></span><?php esc_html_e('Audiences and display rules', 'dropui'); ?></li> 279 <li><span class="dashicons dashicons-chart-bar" aria-hidden="true"></span><?php esc_html_e('Statistics and A/B tests', 'dropui'); ?></li> 280 </ul> 281 <?php else: ?> 282 <h3 id="dropui-account-heading"><?php esc_html_e('Start with the Free plan', 'dropui'); ?></h3> 283 <p class="description"><?php esc_html_e('Free plan limits apply. WhatsApp is billed separately.', 'dropui'); ?></p> 284 <?php endif; ?> 285 <a href="<?php echo esc_url($pricingUrl); ?>" target="_blank" rel="noopener noreferrer"> 286 <?php esc_html_e('Plans and limits', 'dropui'); ?> 287 <span class="screen-reader-text"><?php esc_html_e('(opens in a new tab)', 'dropui'); ?></span> 288 </a> 289 </aside> 290 </section> 291 292 <div class="dropui-guidance"> 293 <section aria-labelledby="dropui-first-campaign-heading"> 294 <h2 id="dropui-first-campaign-heading"><?php esc_html_e('Start with one campaign', 'dropui'); ?></h2> 295 <?php if (!$isConnected): ?> 296 <p><?php esc_html_e('After connecting your website, you will create and publish campaigns in the DropUI dashboard.', 'dropui'); ?></p> 297 <?php endif; ?> 298 <p> 299 <?php 300 /* translators: %s: link to the ready-made campaign scenarios. */ 301 printf( 302 esc_html__('Choose a %s, use the AI Assistant or create your own campaign. Based on your description, the Assistant suggests copy, a layout and calls to action.', 'dropui'), 303 '<a href="' . esc_url($scenariosUrl) . '" target="_blank" rel="noopener noreferrer">' 304 . esc_html__('ready-made scenario', 'dropui') 305 . '<span class="screen-reader-text"> ' . esc_html__('(opens in a new tab)', 'dropui') . '</span></a>' 306 ); 307 ?> 308 </p> 340 </div> 309 341 </section> 310 <section aria-labelledby="dropui-onboarding-heading"> 311 <h2 id="dropui-onboarding-heading"><?php esc_html_e('Help from an onboarding specialist', 'dropui'); ?></h2> 312 <p><?php esc_html_e('On the Start plan and above, a specialist helps you set up DropUI, create and launch campaigns, and review results. You also get advice on improvements and next steps.', 'dropui'); ?></p> 342 343 <?php if (StoreService::WOO_MARKETING_CONSENTS_ENABLED && $commerceSyncEnabled): ?> 344 <section class="dropui-section" aria-labelledby="dropui-consents-heading"> 345 <h2 id="dropui-consents-heading"><?php esc_html_e('Marketing consents', 'dropui'); ?></h2> 346 <div class="dropui-columns dropui-settings"> 347 <form method="post" aria-labelledby="dropui-sms-heading"> 348 <h3 id="dropui-sms-heading"><?php esc_html_e('SMS at checkout', 'dropui'); ?></h3> 349 <?php wp_nonce_field('dropui_save_woo_sms', 'dropui_woo_sms_nonce'); ?> 350 <label class="dropui-check"> 351 <input type="checkbox" name="dropui_woo_sms_checkout" value="1" <?php checked(get_option(WooCommerceSmsConsent::OPTION), '1'); ?>> 352 <span><?php esc_html_e('Ask for SMS marketing consent at checkout', 'dropui'); ?></span> 353 </label> 354 <p class="dropui-help"><?php esc_html_e('Customers decide whether to subscribe. DropUI supports Polish phone numbers for SMS marketing.', 'dropui'); ?></p> 355 <?php if (!function_exists('woocommerce_register_additional_checkout_field')): ?> 356 <p class="dropui-help"><?php esc_html_e('Update WooCommerce to collect SMS consent in the Checkout block.', 'dropui'); ?></p> 357 <?php endif; ?> 358 <button type="submit" name="dropui_save_woo_sms" value="1" class="dropui-button"><?php esc_html_e('Save SMS settings', 'dropui'); ?></button> 359 </form> 360 361 <?php if (class_exists('MailPoet\\API\\API')): ?> 362 <form method="post" aria-labelledby="dropui-mailpoet-heading"> 363 <h3 id="dropui-mailpoet-heading"><?php esc_html_e('Email from MailPoet', 'dropui'); ?></h3> 364 <?php wp_nonce_field('dropui_save_mailpoet', 'dropui_mailpoet_nonce'); ?> 365 <label class="dropui-check"> 366 <input type="checkbox" name="dropui_mailpoet_sync" value="1" <?php checked(get_option('dropui_mailpoet_sync_enabled'), '1'); ?>> 367 <span><?php esc_html_e('Synchronize MailPoet newsletter subscriptions', 'dropui'); ?></span> 368 </label> 369 <label class="dropui-check"> 370 <input type="checkbox" name="dropui_mailpoet_confirm" value="1"> 371 <span><?php esc_html_e('I confirm that these lists contain permission to send this store’s marketing emails.', 'dropui'); ?></span> 372 </label> 373 <button type="submit" name="dropui_save_mailpoet" value="1" class="dropui-button"><?php esc_html_e('Save MailPoet settings', 'dropui'); ?></button> 374 </form> 375 <?php endif; ?> 376 </div> 377 </section> 378 <?php endif; ?> 379 </div> 380 381 <details class="dropui-account-manager" data-dropui-account-manager> 382 <summary class="dropui-button dropui-account-manager__trigger" aria-controls="dropui-account-manager-card"> 383 <img src="<?php echo esc_url($accountManagerPhotoUrl); ?>" alt="" width="44" height="44"> 384 <span class="dropui-account-manager__identity"> 385 <strong><?php echo esc_html($accountManagerName); ?></strong> 386 <span><?php esc_html_e('Your account manager', 'dropui'); ?></span> 387 </span> 388 </summary> 389 <section class="dropui-account-manager__card" id="dropui-account-manager-card" aria-labelledby="dropui-account-manager-name"> 390 <header class="dropui-account-manager__header"> 391 <img src="<?php echo esc_url($accountManagerPhotoUrl); ?>" alt="" width="48" height="48"> 392 <h2 id="dropui-account-manager-name"><?php echo esc_html($accountManagerName); ?></h2> 393 </header> 394 <p><?php esc_html_e('I can help you connect your store, choose a plan or launch a campaign. Email me.', 'dropui'); ?></p> 395 <div class="dropui-account-manager__links"> 396 <a href="mailto:kornel@dropui.com"> 397 <svg class="dropui-icon" width="20" height="20" aria-hidden="true" focusable="false"> 398 <use href="<?php echo esc_url($panelIconsUrl . '#email'); ?>"></use> 399 </svg> 400 <span>kornel@dropui.com</span> 401 </a> 402 </div> 313 403 </section> 314 </div> 315 316 <footer class="dropui-support"> 317 <div> 318 <h2><?php esc_html_e('Support', 'dropui'); ?></h2> 319 <a href="mailto:support@dropui.com">support@dropui.com</a> 320 </div> 321 <?php if ($isConnected): ?> 322 <form action="<?php echo esc_url($formUrl); ?>" method="post"> 323 <?php wp_nonce_field('dropui_disconnect_store', 'dropui_disconnect_nonce'); ?> 324 <?php submit_button( 325 __('Disconnect DropUI integration', 'dropui'), 326 'secondary', 327 'disconnect_store', 328 false, 329 [ 330 'data-dropui-disconnect-confirm' => __('Are you sure you want to disconnect this WordPress site from your DropUI account?', 'dropui'), 331 ] 332 ); ?> 333 </form> 334 <?php endif; ?> 335 </footer> 404 </details> 336 405 </div> 337 406 <?php -
dropui/trunk/src/Admin/ExchangeCallbackHandler.php
r3664245 r3840376 8 8 class ExchangeCallbackHandler 9 9 { 10 public static function enqueueCompletionScript(): void 11 { 12 wp_enqueue_script( 13 'dropui-exchange-callback', 14 plugins_url('assets/js/exchange-callback.js', dirname(__DIR__, 2) . '/dropui-wordpress-app.php'), 15 [], 16 DROPUI_VERSION, 17 true 18 ); 19 } 20 10 21 public function handle(): void 11 22 { … … 74 85 } 75 86 76 $this->redirectWithStatus( 'connected_login_failed');87 $this->redirectWithStatus($loginResult['notice'] ?? 'connected_login_failed'); 77 88 } 78 89 … … 80 91 { 81 92 $safeRedirectUrl = esc_url_raw($redirectUrl); 93 self::enqueueCompletionScript(); 82 94 83 95 header('Content-Type: text/html; charset=' . get_option('blog_charset')); -
dropui/trunk/src/Frontend/MasterScriptLoader.php
r3664245 r3840376 37 37 ] 38 38 ); 39 if ($storeService->hasCommerceSync()) { 40 $path = wp_parse_url(get_site_url(), PHP_URL_PATH); 41 $cookiePath = '/' . trim((string) $path, '/'); 42 $config = [ 43 'storeId' => $storeService->getConnectedStoreId(), 44 'cart' => rest_url('wc/store/v1/cart'), 45 'add' => rest_url('wc/store/v1/cart/add-item'), 46 'cartPage' => wc_get_cart_url(), 47 'cookiePath' => $cookiePath === '/' ? '/' : $cookiePath . '/', 48 'consentApiAvailable' => function_exists('wp_has_consent'), 49 'orderId' => is_order_received_page() ? absint(get_query_var('order-received')) : 0, 50 'productId' => is_product() ? get_queried_object_id() : 0, 51 ]; 52 wp_add_inline_script( 53 self::SCRIPT_HANDLE, 54 'window.__dropuiWooCommerce = ' . wp_json_encode($config) . ';', 55 'before' 56 ); 57 } 39 58 } 40 59 } -
dropui/trunk/src/Service/DropuiService.php
r3687292 r3840376 5 5 class DropuiService 6 6 { 7 public const WOOCOMMERCE_SCOPE_CONFLICT = 'woocommerce_scope_conflict'; 8 public const WOOCOMMERCE_BRIDGE_UNAVAILABLE = 'woocommerce_bridge_unavailable'; 9 7 10 private function getConfig(): array 8 11 { … … 315 318 // The backend verifies it with a second signature over the same 316 319 // message extended by a version marker and the platform value. 317 $platform = (new StoreService())->getPlatform(); 320 $storeService = new StoreService(); 321 $platform = $storeService->getPlatform(); 318 322 $platformSignature = hash_hmac( 319 323 'sha256', … … 331 335 'platform_signature' => $platformSignature, 332 336 ]; 337 if ($platform === 'woocommerce') { 338 $payload['commerce_bridge'] = '1'; 339 $payload['commerce_bridge_signature'] = hash_hmac( 340 'sha256', 341 $message . "\n2\n" . $platform . "\ncommerce_bridge:1", 342 $authSecret 343 ); 344 } 333 345 334 346 $response = wp_remote_post( … … 362 374 'login_url' => $loginUrl, 363 375 'raw_body' => $body, 376 ]; 377 } 378 379 $code = $data['code'] ?? ''; 380 if ($httpCode === 409 && in_array($code, [self::WOOCOMMERCE_SCOPE_CONFLICT, self::WOOCOMMERCE_BRIDGE_UNAVAILABLE], true)) { 381 $storeService->disableCommerceSync(); 382 return [ 383 'status' => 'error', 384 'notice' => $code, 364 385 ]; 365 386 } … … 383 404 } 384 405 406 if ($platform === 'woocommerce') { 407 if (($data['commerce_bridge_ready'] ?? null) === true) { 408 $storeService->enableCommerceSync(); 409 } elseif (array_key_exists('commerce_bridge_ready', $data) || !$storeService->hasCommerceSync()) { 410 $storeService->disableCommerceSync(); 411 return [ 412 'status' => 'error', 413 'notice' => self::WOOCOMMERCE_BRIDGE_UNAVAILABLE, 414 ]; 415 } 416 } else { 417 $storeService->disableCommerceSync(); 418 } 419 385 420 return [ 386 421 'status' => 'redirect', -
dropui/trunk/src/Service/StoreService.php
r3687292 r3840376 5 5 class StoreService 6 6 { 7 // The base WooCommerce integration synchronizes store data only. 8 public const WOO_MARKETING_CONSENTS_ENABLED = false; 9 7 10 private const AUTH_SECRET_PREFIX = 'dropui_encrypted_v1:'; 8 11 private const AUTH_SECRET_CIPHER = 'aes-256-cbc'; … … 38 41 } 39 42 43 public function hasCommerceSync(): bool 44 { 45 return class_exists('WooCommerce') && get_option('dropui_commerce_sync_enabled') === '1'; 46 } 47 48 public function enableCommerceSync(): void 49 { 50 if (class_exists('WooCommerce')) { 51 update_option('dropui_commerce_sync_enabled', '1', false); 52 } 53 } 54 55 public function disableCommerceSync(): void 56 { 57 delete_option('dropui_commerce_sync_enabled'); 58 } 59 40 60 public function getStoreId(): ?string 41 61 { … … 112 132 public function clearConnection(): void 113 133 { 134 delete_option('dropui_mailpoet_sync_enabled'); 135 delete_option(WooCommerceSmsConsent::OPTION); 136 $this->disableCommerceSync(); 114 137 delete_option('dropui_auth_secret'); 115 138 delete_option('dropui_connected_store_id'); … … 123 146 124 147 delete_option('dropui_store_id'); 148 149 global $wpdb; 150 $wpdb->query($wpdb->prepare( 151 "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", 152 $wpdb->esc_like(WooCommerceBridge::REQUEST_NONCE_PREFIX) . '%' 153 )); 125 154 } 126 155 -
dropui/trunk/vendor/autoload.php
r3670371 r3840376 15 15 } 16 16 } 17 throw new RuntimeException($err); 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 18 21 } 19 22 20 23 require_once __DIR__ . '/composer/autoload_real.php'; 21 24 22 return ComposerAutoloaderInit 9cf46fb4a3420468178145ec79ef6d1a::getLoader();25 return ComposerAutoloaderInit7b0e39a6d42788a3e8fd4fca5668bebf::getLoader(); -
dropui/trunk/vendor/composer/LICENSE
r3664245 r3840376 1 2 1 Copyright (c) Nils Adermann, Jordi Boggiano 3 2 … … 19 18 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 19 THE SOFTWARE. 21 -
dropui/trunk/vendor/composer/autoload_classmap.php
r3664245 r3840376 12 12 'DropUI\\Frontend\\MasterScriptLoader' => $baseDir . '/src/Frontend/MasterScriptLoader.php', 13 13 'DropUI\\Service\\DropuiService' => $baseDir . '/src/Service/DropuiService.php', 14 'DropUI\\Service\\MailPoetConsent' => $baseDir . '/src/Service/MailPoetConsent.php', 14 15 'DropUI\\Service\\StoreService' => $baseDir . '/src/Service/StoreService.php', 16 'DropUI\\Service\\WooCommerceBridge' => $baseDir . '/src/Service/WooCommerceBridge.php', 17 'DropUI\\Service\\WooCommerceSmsConsent' => $baseDir . '/src/Service/WooCommerceSmsConsent.php', 15 18 ); -
dropui/trunk/vendor/composer/autoload_real.php
r3670371 r3840376 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 9cf46fb4a3420468178145ec79ef6d1a5 class ComposerAutoloaderInit7b0e39a6d42788a3e8fd4fca5668bebf 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit 9cf46fb4a3420468178145ec79ef6d1a', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInit7b0e39a6d42788a3e8fd4fca5668bebf', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 spl_autoload_unregister(array('ComposerAutoloaderInit 9cf46fb4a3420468178145ec79ef6d1a', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInit7b0e39a6d42788a3e8fd4fca5668bebf', 'loadClassLoader')); 28 28 29 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInit 9cf46fb4a3420468178145ec79ef6d1a::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit7b0e39a6d42788a3e8fd4fca5668bebf::getInitializer($loader)); 31 31 32 32 $loader->setClassMapAuthoritative(true); -
dropui/trunk/vendor/composer/autoload_static.php
r3670371 r3840376 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 9cf46fb4a3420468178145ec79ef6d1a7 class ComposerStaticInit7b0e39a6d42788a3e8fd4fca5668bebf 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( 10 'D' => 10 'D' => 11 11 array ( 12 12 'DropUI\\' => 7, … … 15 15 16 16 public static $prefixDirsPsr4 = array ( 17 'DropUI\\' => 17 'DropUI\\' => 18 18 array ( 19 19 0 => __DIR__ . '/../..' . '/src', … … 27 27 'DropUI\\Frontend\\MasterScriptLoader' => __DIR__ . '/../..' . '/src/Frontend/MasterScriptLoader.php', 28 28 'DropUI\\Service\\DropuiService' => __DIR__ . '/../..' . '/src/Service/DropuiService.php', 29 'DropUI\\Service\\MailPoetConsent' => __DIR__ . '/../..' . '/src/Service/MailPoetConsent.php', 29 30 'DropUI\\Service\\StoreService' => __DIR__ . '/../..' . '/src/Service/StoreService.php', 31 'DropUI\\Service\\WooCommerceBridge' => __DIR__ . '/../..' . '/src/Service/WooCommerceBridge.php', 32 'DropUI\\Service\\WooCommerceSmsConsent' => __DIR__ . '/../..' . '/src/Service/WooCommerceSmsConsent.php', 30 33 ); 31 34 … … 33 36 { 34 37 return \Closure::bind(function () use ($loader) { 35 $loader->prefixLengthsPsr4 = ComposerStaticInit 9cf46fb4a3420468178145ec79ef6d1a::$prefixLengthsPsr4;36 $loader->prefixDirsPsr4 = ComposerStaticInit 9cf46fb4a3420468178145ec79ef6d1a::$prefixDirsPsr4;37 $loader->classMap = ComposerStaticInit 9cf46fb4a3420468178145ec79ef6d1a::$classMap;38 $loader->prefixLengthsPsr4 = ComposerStaticInit7b0e39a6d42788a3e8fd4fca5668bebf::$prefixLengthsPsr4; 39 $loader->prefixDirsPsr4 = ComposerStaticInit7b0e39a6d42788a3e8fd4fca5668bebf::$prefixDirsPsr4; 40 $loader->classMap = ComposerStaticInit7b0e39a6d42788a3e8fd4fca5668bebf::$classMap; 38 41 39 42 }, null, ClassLoader::class);
Note:
See TracChangeset
for help on using the changeset viewer.