From 959a6cd0577da0282e7f26e03566f5496674714c Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Mon, 2 Nov 2020 14:14:01 +0000 Subject: [PATCH 1/2] Rename Cloudinary constant --- js/src/deactivate.js | 6 +++--- php/class-deactivation.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/src/deactivate.js b/js/src/deactivate.js index b2687f915..3f1163bcb 100644 --- a/js/src/deactivate.js +++ b/js/src/deactivate.js @@ -1,4 +1,4 @@ -/* global window wp cloudinaryApi */ +/* global window wp CLD_Deactivate */ const Deactivate = { // The link that triggers the ThickBox @@ -58,13 +58,13 @@ const Deactivate = { // Add event listener to submit the feedback. context.submitButton.addEventListener( 'click', function() { wp.ajax.send( { - url: cloudinaryApi.endpoint, + url: CLD_Deactivate.endpoint, data: { reason: context.reason, more: context.more?.value, }, beforeSend: function( request ) { - request.setRequestHeader( 'X-WP-Nonce', cloudinaryApi.nonce ); + request.setRequestHeader( 'X-WP-Nonce', CLD_Deactivate.nonce ); }, } ).always( function() { window.location.href = context.deactivationUrl; diff --git a/php/class-deactivation.php b/php/class-deactivation.php index cce130846..8388d1e3a 100644 --- a/php/class-deactivation.php +++ b/php/class-deactivation.php @@ -177,7 +177,7 @@ public function enqueue_scripts() { wp_enqueue_script( 'cloudinary-deactivation', $this->plugin->dir_url . 'js/deactivate.js', array(), $this->plugin->version, true ); wp_localize_script( 'cloudinary-deactivation', - 'cloudinaryApi', + 'CLD_Deactivate', array( 'endpoint' => rest_url( REST_API::BASE . '/' . self::$internal_endpoint ), 'nonce' => wp_create_nonce( 'wp_rest' ), From afa9d5169c6b8210b8eb2a911d80aff704d05fa4 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Mon, 2 Nov 2020 14:14:34 +0000 Subject: [PATCH 2/2] Update compiled asset --- js/deactivate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/deactivate.js b/js/deactivate.js index 65a8a8c2c..efd838d12 100644 --- a/js/deactivate.js +++ b/js/deactivate.js @@ -1 +1 @@ -!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){var r=n(3),o=n(4),i=n(5),a=n(6);t.exports=function(t){return r(t)||o(t)||i(t)||a()}},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n