WooCommerce Checkout Manager - Version 5.3.9

Version Description

  • Fix: address fields trigger shipping total change
  • Fix: make sure guest users include their email in order to download products
Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 WooCommerce Checkout Manager
Version 5.3.9
Comparing to
See all releases

Code changes from version 5.3.7 to 5.3.9

assets/backend/css/admin.css CHANGED
@@ -1 +1,198 @@
1
- .select2-container{z-index:9999999}.select2-container .select2-selection--single,.select2-container .select2-selection--single .select2-selection__rendered,.select2-container .select2-selection--single .select2-selection__arrow{height:30px !important;line-height:30px !important}.wooccm-premium{opacity:0.5;pointer-events:none}.button.fileinput-button{position:relative;overflow:hidden !important}.button.fileinput-button input{position:absolute;top:0;right:0;margin:0;opacity:0;-ms-filter:'alpha(opacity=0)';font-size:200px;direction:ltr;cursor:pointer}table.wc_gateways>tbody>tr>td select{line-height:1 !important}table.wc_gateways>tbody>tr>td.label{font-weight:600}table.wooccm-enhanced-options{border:none;box-shadow:none}table.wooccm-enhanced-options>thead>th .woocommerce-help-tip{margin:-1px 0 0 0.25em}table.wooccm-enhanced-options>tbody>tr>td input.label{width:100%}table.wooccm-enhanced-options>tbody>tr>td select.add-price-type{margin:0 0 0 10px}table.wooccm-enhanced-options>tbody>tr>td input.check{margin:0 9px}table.wooccm-enhanced-options>tbody>tr>td.sort .wc-item-reorder-nav{width:auto}#wooccm_modal.processing{pointer-events:none}#wooccm_modal.processing:before{content:'';position:absolute;top:0;bottom:0;left:0;right:0;background-color:#ffffff;z-index:99999999;opacity:0.8}#wooccm_modal select{min-height:30px}#wooccm_modal .form-field .wrap{padding:0}#wooccm_modal .attachment-info .details,#wooccm_modal .attachment-info .settings{width:100%}#wooccm_modal .attachment-info .woocommerce_options_panel label,#wooccm_modal .attachment-info .woocommerce_options_panel legend{width:75px;margin:0 0 0 -90px;font-weight:600}#wooccm_modal .attachment-info .woocommerce_options_panel fieldset.form-field,#wooccm_modal .attachment-info .woocommerce_options_panel p.form-field{padding:0 20px 0 92px !important}#wooccm_modal .attachment-info .woocommerce_options_panel input[type=email],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=number],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=password],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=text],#wooccm_modal .attachment-info .woocommerce_options_panel select,#wooccm_modal .attachment-info .woocommerce_options_panel .select2-container{width:100% !important}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel{width:100%}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .premium{display:block;clear:both}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .woocommerce-help-tip{margin:0 0 0 0.5em}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container{width:50% !important;line-height:16px}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection{box-shadow:none;border-radius:3px;padding:0 24px 0 8px}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection--multiple{line-height:16px;min-height:30px}@media only screen and (max-width: 1280px){#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container{width:80% !important}}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default .select2-selection--multiple .select2-selection__rendered li{margin:3px 3px 0 0}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#5b9dd9 !important;box-shadow:0 0 2px rgba(30,140,190,0.8) !important;outline:2px solid transparent !important}#wooccm-order-files .inside{margin:0;padding:0;background:#fefefe;display:block !important}#wooccm-order-files .handlediv,#wooccm-order-files .hndle{display:none}#wooccm-order-files .wooccm_upload_results{display:inline-block;margin:0 10px}#wooccm-order-files .wooccm_order_attachments_wrapper{margin:0;overflow-x:auto}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments{width:100%;background:#fff}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th:first-child{padding-left:2em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th.sortable{cursor:pointer}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments .item{min-width:200px}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th{text-align:left;padding:1em;font-weight:400;color:#999;background:#f8f8f8;user-select:none}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody#order_line_items tr:first-child td{border-top:none}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody tr:last-child td{border-bottom:1px solid #dfdfdf}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb{text-align:left;width:38px;padding-bottom:1.5em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb .wc-order-item-thumbnail{width:38px;height:38px;border:2px solid #e8e8e8;background:#f8f8f8;color:#ccc;position:relative;font-size:21px;display:block;text-align:center}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th:first-child,#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td:first-child{padding-left:2em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th,#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td{padding:1.5em 1em 1em;text-align:left;line-height:1.5em;vertical-align:top;border-bottom:1px solid #f8f8f8}#wooccm-order-files .wc-order-data-row{border-bottom:1px solid #dfdfdf;padding:1.5em 2em;background:#f8f8f8;line-height:2em;text-align:left}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .select2-container {
2
+ z-index: 9999999; }
3
+ .select2-container .select2-selection--single,
4
+ .select2-container .select2-selection--single .select2-selection__rendered,
5
+ .select2-container .select2-selection--single .select2-selection__arrow {
6
+ height: 30px !important;
7
+ line-height: 30px !important; }
8
+
9
+ .wooccm-premium {
10
+ opacity: 0.5;
11
+ pointer-events: none;
12
+ /* .description {
13
+ &.premium {
14
+ //display: none;
15
+ }
16
+
17
+ &.hidden {
18
+ //display: none;
19
+ }
20
+ }*/ }
21
+
22
+ .button.fileinput-button {
23
+ position: relative;
24
+ overflow: hidden !important; }
25
+ .button.fileinput-button input {
26
+ position: absolute;
27
+ top: 0;
28
+ right: 0;
29
+ margin: 0;
30
+ opacity: 0;
31
+ -ms-filter: 'alpha(opacity=0)';
32
+ font-size: 200px;
33
+ direction: ltr;
34
+ cursor: pointer; }
35
+
36
+ table.wc_gateways > tbody > tr > td select {
37
+ line-height: 1 !important; }
38
+
39
+ table.wc_gateways > tbody > tr > td.label {
40
+ font-weight: 600; }
41
+
42
+ table.wooccm-enhanced-options {
43
+ border: none;
44
+ box-shadow: none; }
45
+ table.wooccm-enhanced-options > thead > th .woocommerce-help-tip {
46
+ margin: -1px 0 0 0.25em; }
47
+ table.wooccm-enhanced-options > tbody > tr > td input.label {
48
+ width: 100%; }
49
+ table.wooccm-enhanced-options > tbody > tr > td select.add-price-type {
50
+ margin: 0 0 0 10px; }
51
+ table.wooccm-enhanced-options > tbody > tr > td input.check {
52
+ margin: 0 9px; }
53
+ table.wooccm-enhanced-options > tbody > tr > td.sort .wc-item-reorder-nav {
54
+ width: auto; }
55
+
56
+ #wooccm_modal.processing {
57
+ pointer-events: none; }
58
+ #wooccm_modal.processing:before {
59
+ content: '';
60
+ position: absolute;
61
+ top: 0;
62
+ bottom: 0;
63
+ left: 0;
64
+ right: 0;
65
+ background-color: #ffffff;
66
+ z-index: 99999999;
67
+ opacity: 0.8; }
68
+
69
+ #wooccm_modal select {
70
+ min-height: 30px; }
71
+
72
+ #wooccm_modal .form-field .wrap {
73
+ padding: 0; }
74
+
75
+ #wooccm_modal .attachment-info .details,
76
+ #wooccm_modal .attachment-info .settings {
77
+ width: 100%; }
78
+
79
+ #wooccm_modal .attachment-info .woocommerce_options_panel label,
80
+ #wooccm_modal .attachment-info .woocommerce_options_panel legend {
81
+ width: 75px;
82
+ margin: 0 0 0 -90px;
83
+ font-weight: 600; }
84
+
85
+ #wooccm_modal .attachment-info .woocommerce_options_panel fieldset.form-field,
86
+ #wooccm_modal .attachment-info .woocommerce_options_panel p.form-field {
87
+ padding: 0 20px 0 92px !important; }
88
+
89
+ #wooccm_modal .attachment-info .woocommerce_options_panel input[type=email],
90
+ #wooccm_modal .attachment-info .woocommerce_options_panel input[type=number],
91
+ #wooccm_modal .attachment-info .woocommerce_options_panel input[type=password],
92
+ #wooccm_modal .attachment-info .woocommerce_options_panel input[type=text],
93
+ #wooccm_modal .attachment-info .woocommerce_options_panel select,
94
+ #wooccm_modal .attachment-info .woocommerce_options_panel .select2-container {
95
+ width: 100% !important; }
96
+
97
+ #wooccm_modal #woocommerce-product-data .woocommerce_options_panel {
98
+ width: 100%;
99
+ /* input,
100
+ select,
101
+ textarea {
102
+ margin: 0;
103
+ }*/ }
104
+ #wooccm_modal #woocommerce-product-data .woocommerce_options_panel .premium {
105
+ display: block;
106
+ clear: both; }
107
+ #wooccm_modal #woocommerce-product-data .woocommerce_options_panel .woocommerce-help-tip {
108
+ margin: 0 0 0 0.5em; }
109
+ #wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container {
110
+ width: 50% !important;
111
+ line-height: 16px; }
112
+ #wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection {
113
+ box-shadow: none;
114
+ border-radius: 3px;
115
+ padding: 0 24px 0 8px; }
116
+ #wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection--multiple {
117
+ line-height: 16px;
118
+ min-height: 30px; }
119
+ @media only screen and (max-width: 1280px) {
120
+ #wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container {
121
+ width: 80% !important; } }
122
+ #wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default .select2-selection--multiple .select2-selection__rendered li {
123
+ margin: 3px 3px 0 0; }
124
+ #wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default.select2-container--focus .select2-selection--multiple {
125
+ border-color: #5b9dd9 !important;
126
+ box-shadow: 0 0 2px rgba(30, 140, 190, 0.8) !important;
127
+ outline: 2px solid transparent !important; }
128
+
129
+ #wooccm-order-files .inside {
130
+ margin: 0;
131
+ padding: 0;
132
+ background: #fefefe;
133
+ display: block !important; }
134
+
135
+ #wooccm-order-files .handlediv,
136
+ #wooccm-order-files .hndle {
137
+ display: none; }
138
+
139
+ #wooccm-order-files .wooccm_upload_results {
140
+ display: inline-block;
141
+ margin: 0 10px; }
142
+
143
+ #wooccm-order-files .wooccm_order_attachments_wrapper {
144
+ margin: 0;
145
+ overflow-x: auto; }
146
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments {
147
+ width: 100%;
148
+ background: #fff; }
149
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th:first-child {
150
+ padding-left: 2em; }
151
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th.sortable {
152
+ cursor: pointer; }
153
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments .item {
154
+ min-width: 200px; }
155
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th {
156
+ text-align: left;
157
+ padding: 1em;
158
+ font-weight: 400;
159
+ color: #999;
160
+ background: #f8f8f8;
161
+ user-select: none; }
162
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody#order_line_items tr:first-child td {
163
+ border-top: none; }
164
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody tr:last-child td {
165
+ border-bottom: 1px solid #dfdfdf; }
166
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb {
167
+ text-align: left;
168
+ width: 38px;
169
+ padding-bottom: 1.5em; }
170
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb .wc-order-item-thumbnail {
171
+ width: 38px;
172
+ height: 38px;
173
+ border: 2px solid #e8e8e8;
174
+ background: #f8f8f8;
175
+ color: #ccc;
176
+ position: relative;
177
+ font-size: 21px;
178
+ display: block;
179
+ text-align: center; }
180
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th:first-child,
181
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td:first-child {
182
+ padding-left: 2em; }
183
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th,
184
+ #wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td {
185
+ padding: 1.5em 1em 1em;
186
+ text-align: left;
187
+ line-height: 1.5em;
188
+ vertical-align: top;
189
+ border-bottom: 1px solid #f8f8f8; }
190
+
191
+ #wooccm-order-files .wc-order-data-row {
192
+ border-bottom: 1px solid #dfdfdf;
193
+ padding: 1.5em 2em;
194
+ background: #f8f8f8;
195
+ line-height: 2em;
196
+ text-align: left; }
197
+
198
+ /*# sourceMappingURL=admin.css.map*/
assets/backend/js/admin-field.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('backbone', 'jquery', 'jquery-ui-datepicker', 'wp-util'), 'version' => '3b35ab2a74c16fe901f6d1895971b4b0');
1
+ <?php return array('dependencies' => array('backbone', 'jquery', 'jquery-ui-datepicker', 'wp-util'), 'version' => 'e3adc601cfa8dccf8153e6a574beb644');
assets/backend/js/admin-field.js CHANGED
@@ -1 +1,653 @@
1
- !function(e){var t={};function o(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,o),a.l=!0,a.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)o.d(n,a,function(t){return e[t]}.bind(null,a));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";o.r(t);o(1),o(2),o(3),o(4);!function(e){var t,o=0,n=function(){e("#wooccm_modal").removeClass("processing")};_.mixin({sortOptions:function(e){return _.sortBy(e,(function(e){return e.order}))},escapeHtml:function(e){return e.replace("&amp;",/&/g).replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&#039;/g,"'")},getFormData:function(e){var t=e.serializeJSON({checkboxUncheckedValue:"false",parseBooleans:!0,parseNulls:!0}),o=Object.assign({},wooccm_field.args);return Object.assign(o,t)}});var a=Backbone.Model.extend({defaults:Object.create(wooccm_field.args)}),i=Backbone.View.extend({initialize:function(t){var o=e(t.target).closest("[data-field_id]").data("field_id"),n=new a;n.set({id:o}),new l({model:n}).render()}}),l=Backbone.View.extend({events:{"change input":"enableSave","change textarea":"enableSave","change select":"enableSave","click .media-modal-backdrop":"close","click .media-modal-close":"close","click .media-modal-prev":"edit","click .media-modal-next":"edit","click .media-modal-tab":"tab","change .media-modal-parent":"parent","change .media-modal-render-tabs":"renderTabs","change .media-modal-render-panels":"renderPanels","change .media-modal-render-info":"renderInfo","submit .media-modal-form":"submit"},templates:{},initialize:function(){_.bindAll(this,"open","tab","edit","load","render","close","submit","parent"),this.init(),this.open()},init:function(){this.templates.window=wp.template("wooccm-modal-main")},assign:function(e,t){e.setElement(this.$(t)).render()},updateModel:function(e){e.preventDefault();var t=this.$el.find("#wooccm_modal").find("form"),o=_.getFormData(t);this.model.set(o)},reload:function(e){this.$el.find("#wooccm_modal").hasClass("reload")?location.reload():this.remove()},close:function(t){t.preventDefault(),this.undelegateEvents(),e(document).off("focusin"),e("body").removeClass("modal-open"),this.$el.find("#wooccm_modal").addClass("reload"),this.reload(t)},enableSave:function(t){e(".media-modal-submit").prop("disabled",!1),this.updateModel(t)},disableSave:function(t){e(".media-modal-submit").prop("disabled",!0)},tab:function(t){t.preventDefault();var o=this.$el.find("#wooccm_modal"),n=e(t.currentTarget),a=o.find("ul.wc-tabs"),i=n.find("a").attr("href").replace("#","");a.find(".active").removeClass("active"),n.addClass("active"),this.model.attributes.panel=i,this.model.changed.panel=i,this.renderPanels(t)},renderTabs:function(e){this.renderPanels(e),this.tabs.render()},renderPanels:function(e){this.updateModel(e),this.panels.render()},render:function(){this.$el.html(this.templates.window(this.model.attributes)),this.tabs=new c({model:this.model}),this.panels=new d({model:this.model}),this.info=new s({model:this.model}),this.assign(this.tabs,"#wooccm-modal-tabs"),this.assign(this.panels,"#wooccm-modal-panels"),this.assign(this.info,"#wooccm-modal-info")},open:function(t){e("body").addClass("modal-open").append(this.$el),null!=this.model.attributes.id?this.load():_.delay((function(){n()}),100)},load:function(){var t=this;null!=t.model.attributes.id?e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_load_field",nonce:wooccm_field.nonce,field_id:this.model.attributes.id},dataType:"json",type:"POST",complete:function(){n()},error:function(){alert("Error!")},success:function(e){console.log("response",e),e.success?(t.model.set(e.data),t.render()):alert(e.data)}}):t.render()},edit:function(n){n.preventDefault();var a=this,i=e(n.target),l=parseInt(e(".wc_gateways tr[data-field_id]").length),c=parseInt(a.model.get("order"));o++,t&&clearTimeout(t),t=setTimeout((function(){c=i.hasClass("media-modal-next")?Math.min(c+o,l):Math.max(c-o,1),a.model.set({id:parseInt(e(".wc_gateways tr[data-field_order="+c+"]").data("field_id"))}),o=0,a.load()}),300)},submit:function(t){t.preventDefault();var o=this,n=o.$el.find("#wooccm_modal"),a=n.find(".settings-save-status .spinner"),i=n.find(".settings-save-status .saved");return e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_save_field",nonce:wooccm_field.nonce,field_data:JSON.stringify(o.model.attributes)},dataType:"json",type:"POST",beforeSend:function(){e(".media-modal-submit").prop("disabled",!0),a.addClass("is-active")},complete:function(){i.addClass("is-active"),a.removeClass("is-active"),_.delay((function(){i.removeClass("is-active")}),1e3)},error:function(e){alert("Error!")},success:function(e){e.success?null==o.model.attributes.id&&(n.addClass("reload"),o.reload(t),o.close(t)):alert(e.data)}}),!1},renderInfo:function(){this.info.render()},parent:function(t){t.preventDefault();var o=this,n=o.$el.find("#wooccm_modal").find(".attachment-details");return this.updateModel(t),e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_load_parent",nonce:wooccm_field.nonce,conditional_parent_key:o.model.attributes.conditional_parent_key},dataType:"json",type:"POST",beforeSend:function(){o.disableSave(),n.addClass("save-waiting")},complete:function(){n.addClass("save-complete"),n.removeClass("save-waiting"),o.enableSave()},error:function(){alert("Error!")},success:function(e){e.success?(o.model.attributes.parent=e.data,o.model.changed.parent=e.data,o.renderInfo()):alert(e.data)}}),!1}}),c=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-tabs")},render:function(){this.model.attributes.panel="general",this.$el.html(this.templates.window(this.model.attributes))}}),d=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-panels")},render:function(){this.$el.html(this.templates.window(this.model.attributes)),this.$el.trigger("wooccm-enhanced-options"),this.$el.trigger("wooccm-enhanced-select"),this.$el.trigger("init_tooltips")}}),s=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-info")},render:function(){this.$el.html(this.templates.window(this.model.attributes)),this.$el.trigger("wooccm-enhanced-select"),this.$el.trigger("init_tooltips")}});e("#wooccm_billing_settings_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add").on("click",(function(e){e.preventDefault(),new i(e)})),e("#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset").on("click",(function(t){t.preventDefault();e(t.target);return!!confirm(wooccm_field.message.reset)&&(e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_reset_fields",nonce:wooccm_field.nonce},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(e){e.success?location.reload():alert(e.data)}}),!1)})),e(".wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit").on("click",(function(e){e.preventDefault(),new i(e)})),e(".wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete").on("click",(function(t){t.preventDefault();var o=e(t.target).closest("[data-field_id]"),n=o.data("field_id");return!!confirm(wooccm_field.message.remove)&&(e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_delete_field",nonce:wooccm_field.nonce,field_id:n},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(e){e.success?o.remove():alert(e.data)}}),!1)})),e(document).on("click",".wooccm-field-toggle-attribute",(function(t){t.preventDefault();var o=e(this),n=o.closest("tr"),a=o.find(".woocommerce-input-toggle");return e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_toggle_field_attribute",nonce:wooccm_field.nonce,field_attr:e(this).data("field_attr"),field_id:n.data("field_id")},dataType:"json",type:"POST",beforeSend:function(e){a.addClass("woocommerce-input-toggle--loading")},success:function(e){!0===e.data?(a.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled"),a.addClass("woocommerce-input-toggle--enabled"),a.removeClass("woocommerce-input-toggle--loading")):!0!==e.data&&(a.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled"),a.addClass("woocommerce-input-toggle--disabled"),a.removeClass("woocommerce-input-toggle--loading"))}}),!1})),e(document).on("change",".wooccm-field-change-attribute",(function(t){t.preventDefault();var o=e(this),n=o.closest("tr");return e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_change_field_attribute",nonce:wooccm_field.nonce,field_attr:o.data("field_attr"),field_value:o.val(),field_id:n.data("field_id")},dataType:"json",type:"POST",beforeSend:function(e){o.prop("disabled",!0)},success:function(e){console.log(e.data)},complete:function(e){o.prop("disabled",!1)}}),!1}))}(jQuery)},function(e,t){!function(){e.exports=this.jQuery}()},function(e,t){!function(){e.exports=this.wp.util}()},function(e,t){!function(){e.exports=this.window.Backbone}()},function(e,t){!function(){e.exports=this.window.uiDatepicker}()}]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = "./src/backend/admin-field.js");
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ({
88
+
89
+ /***/ "./src/backend/admin-field.js":
90
+ /*!************************************!*\
91
+ !*** ./src/backend/admin-field.js ***!
92
+ \************************************/
93
+ /*! no exports provided */
94
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
95
+
96
+ "use strict";
97
+ __webpack_require__.r(__webpack_exports__);
98
+ /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
99
+ /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
100
+ /* harmony import */ var wp_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! wp-util */ "wp-util");
101
+ /* harmony import */ var wp_util__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(wp_util__WEBPACK_IMPORTED_MODULE_1__);
102
+ /* harmony import */ var backbone__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! backbone */ "backbone");
103
+ /* harmony import */ var backbone__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(backbone__WEBPACK_IMPORTED_MODULE_2__);
104
+ /* harmony import */ var jquery_ui_datepicker__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! jquery-ui-datepicker */ "jquery-ui-datepicker");
105
+ /* harmony import */ var jquery_ui_datepicker__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(jquery_ui_datepicker__WEBPACK_IMPORTED_MODULE_3__);
106
+
107
+
108
+
109
+
110
+
111
+ (function ($) {
112
+ "use strict";
113
+
114
+ var count = 0,
115
+ timer;
116
+
117
+ var is_blocked = function is_blocked($node) {
118
+ return $node.is('.processing') || $node.parents('.processing').length;
119
+ };
120
+
121
+ var block = function block() {
122
+ $('#wooccm_modal').addClass('processing');
123
+ };
124
+
125
+ var unblock = function unblock() {
126
+ $('#wooccm_modal').removeClass('processing');
127
+ };
128
+
129
+ _.mixin({
130
+ sortOptions: function sortOptions(object) {
131
+ return _.sortBy(object, function (o) {
132
+ return o.order;
133
+ });
134
+ },
135
+ escapeHtml: function escapeHtml(attribute) {
136
+ return attribute.replace('&amp;', /&/g).replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&#039;/g, "'");
137
+ },
138
+ getFormData: function getFormData($form) {
139
+ var form = $form.serializeJSON({
140
+ checkboxUncheckedValue: 'false',
141
+ parseBooleans: true,
142
+ parseNulls: true
143
+ });
144
+ var defaults = Object.assign({}, wooccm_field.args);
145
+ var merged = Object.assign(defaults, form);
146
+ return merged;
147
+ }
148
+ });
149
+
150
+ var FieldModel = Backbone.Model.extend({
151
+ defaults: Object.create(wooccm_field.args)
152
+ });
153
+ var FieldModal = Backbone.View.extend({
154
+ initialize: function initialize(e) {
155
+ var $button = $(e.target),
156
+ field_id = $button.closest('[data-field_id]').data('field_id');
157
+ var model = new FieldModel();
158
+ model.set({
159
+ id: field_id
160
+ });
161
+ new FieldView({
162
+ model: model
163
+ }).render();
164
+ }
165
+ });
166
+ var FieldView = Backbone.View.extend({
167
+ events: {
168
+ 'change input': 'enableSave',
169
+ 'change textarea': 'enableSave',
170
+ 'change select': 'enableSave',
171
+ 'click .media-modal-backdrop': 'close',
172
+ 'click .media-modal-close': 'close',
173
+ 'click .media-modal-prev': 'edit',
174
+ 'click .media-modal-next': 'edit',
175
+ 'click .media-modal-tab': 'tab',
176
+ 'change .media-modal-parent': 'parent',
177
+ 'change .media-modal-render-tabs': 'renderTabs',
178
+ 'change .media-modal-render-panels': 'renderPanels',
179
+ 'change .media-modal-render-info': 'renderInfo',
180
+ 'submit .media-modal-form': 'submit'
181
+ },
182
+ templates: {},
183
+ initialize: function initialize() {
184
+ _.bindAll(this, 'open', 'tab', 'edit', 'load', 'render', 'close', 'submit', 'parent');
185
+
186
+ this.init();
187
+ this.open();
188
+ },
189
+ init: function init() {
190
+ this.templates.window = wp.template('wooccm-modal-main');
191
+ },
192
+ assign: function assign(view, selector) {
193
+ view.setElement(this.$(selector)).render();
194
+ },
195
+ updateModel: function updateModel(e) {
196
+ e.preventDefault();
197
+ var modal = this,
198
+ $form = modal.$el.find('#wooccm_modal').find('form');
199
+
200
+ var model = _.getFormData($form); // console.log('getFormData', model);
201
+
202
+
203
+ this.model.set(model);
204
+ },
205
+ reload: function reload(e) {
206
+ if (this.$el.find('#wooccm_modal').hasClass('reload')) {
207
+ location.reload();
208
+ return;
209
+ }
210
+
211
+ this.remove();
212
+ return;
213
+ },
214
+ close: function close(e) {
215
+ e.preventDefault();
216
+ this.undelegateEvents();
217
+ $(document).off('focusin');
218
+ $('body').removeClass('modal-open'); // if necesary reload...
219
+
220
+ this.$el.find('#wooccm_modal').addClass('reload');
221
+ this.reload(e);
222
+ return;
223
+ },
224
+ enableSave: function enableSave(e) {
225
+ $('.media-modal-submit').prop('disabled', false);
226
+ this.updateModel(e);
227
+ },
228
+ disableSave: function disableSave(e) {
229
+ $('.media-modal-submit').prop('disabled', true);
230
+ },
231
+ tab: function tab(e) {
232
+ e.preventDefault();
233
+ var modal = this,
234
+ $modal = modal.$el.find('#wooccm_modal'),
235
+ $tab = $(e.currentTarget),
236
+ $tabs = $modal.find('ul.wc-tabs'),
237
+ panel = $tab.find('a').attr('href').replace('#', '');
238
+ $tabs.find('.active').removeClass('active');
239
+ $tab.addClass('active');
240
+ this.model.attributes['panel'] = panel;
241
+ this.model.changed['panel'] = panel;
242
+ this.renderPanels(e);
243
+ },
244
+ renderTabs: function renderTabs(e) {
245
+ this.renderPanels(e);
246
+ this.tabs.render();
247
+ },
248
+ renderPanels: function renderPanels(e) {
249
+ this.updateModel(e);
250
+ this.panels.render();
251
+ },
252
+ render: function render() {
253
+ var modal = this;
254
+ modal.$el.html(modal.templates.window(modal.model.attributes));
255
+ this.tabs = new FieldViewTabs({
256
+ model: modal.model
257
+ });
258
+ this.panels = new FieldViewPanels({
259
+ model: modal.model
260
+ });
261
+ this.info = new FieldViewInfo({
262
+ model: modal.model
263
+ });
264
+ this.assign(this.tabs, '#wooccm-modal-tabs');
265
+ this.assign(this.panels, '#wooccm-modal-panels');
266
+ this.assign(this.info, '#wooccm-modal-info');
267
+ },
268
+ open: function open(e) {
269
+ $('body').addClass('modal-open').append(this.$el);
270
+
271
+ if (this.model.attributes.id == undefined) {
272
+ _.delay(function () {
273
+ unblock();
274
+ }, 100);
275
+
276
+ return;
277
+ }
278
+
279
+ this.load();
280
+ },
281
+ load: function load() {
282
+ var modal = this;
283
+
284
+ if (modal.model.attributes.id == undefined) {
285
+ modal.render();
286
+ return;
287
+ }
288
+
289
+ $.ajax({
290
+ url: wooccm_field.ajax_url,
291
+ data: {
292
+ action: 'wooccm_load_field',
293
+ nonce: wooccm_field.nonce,
294
+ field_id: this.model.attributes.id
295
+ },
296
+ dataType: 'json',
297
+ type: 'POST',
298
+ // beforeSend: function () {
299
+ // },
300
+ complete: function complete() {
301
+ unblock();
302
+ },
303
+ error: function error() {
304
+ alert('Error!');
305
+ },
306
+ success: function success(response) {
307
+ console.log('response', response);
308
+
309
+ if (response.success) {
310
+ modal.model.set(response.data);
311
+ modal.render();
312
+ } else {
313
+ alert(response.data);
314
+ }
315
+ }
316
+ });
317
+ },
318
+ edit: function edit(e) {
319
+ e.preventDefault();
320
+ var modal = this,
321
+ $button = $(e.target),
322
+ field_count = parseInt($('.wc_gateways tr[data-field_id]').length),
323
+ order = parseInt(modal.model.get('order'));
324
+ count++;
325
+
326
+ if (timer) {
327
+ clearTimeout(timer);
328
+ }
329
+
330
+ timer = setTimeout(function () {
331
+ if ($button.hasClass('media-modal-next')) {
332
+ order = Math.min(order + count, field_count);
333
+ } else {
334
+ order = Math.max(order - count, 1);
335
+ }
336
+
337
+ modal.model.set({
338
+ id: parseInt($('.wc_gateways tr[data-field_order=' + order + ']').data('field_id'))
339
+ });
340
+ count = 0;
341
+ modal.load();
342
+ }, 300);
343
+ },
344
+ submit: function submit(e) {
345
+ e.preventDefault();
346
+ var modal = this,
347
+ $modal = modal.$el.find('#wooccm_modal'),
348
+ $spinner = $modal.find('.settings-save-status .spinner'),
349
+ $saved = $modal.find('.settings-save-status .saved'); // console.log('modal.model.attributes', modal.model.attributes);
350
+
351
+ $.ajax({
352
+ url: wooccm_field.ajax_url,
353
+ data: {
354
+ action: 'wooccm_save_field',
355
+ nonce: wooccm_field.nonce,
356
+ field_data: JSON.stringify(modal.model.attributes)
357
+ },
358
+ dataType: 'json',
359
+ type: 'POST',
360
+ beforeSend: function beforeSend() {
361
+ $('.media-modal-submit').prop('disabled', true);
362
+ $spinner.addClass('is-active');
363
+ },
364
+ complete: function complete() {
365
+ $saved.addClass('is-active');
366
+ $spinner.removeClass('is-active');
367
+
368
+ _.delay(function () {
369
+ $saved.removeClass('is-active');
370
+ }, 1000);
371
+ },
372
+ error: function error(response) {
373
+ alert('Error!');
374
+ },
375
+ success: function success(response) {
376
+ if (response.success) {
377
+ if (modal.model.attributes.id == undefined) {
378
+ $modal.addClass('reload');
379
+ modal.reload(e);
380
+ modal.close(e);
381
+ }
382
+ } else {
383
+ alert(response.data);
384
+ }
385
+ }
386
+ });
387
+ return false;
388
+ },
389
+ renderInfo: function renderInfo() {
390
+ this.info.render();
391
+ },
392
+ parent: function parent(e) {
393
+ e.preventDefault();
394
+ var modal = this,
395
+ $modal = modal.$el.find('#wooccm_modal'),
396
+ $details = $modal.find('.attachment-details');
397
+ this.updateModel(e);
398
+ $.ajax({
399
+ url: wooccm_field.ajax_url,
400
+ data: {
401
+ action: 'wooccm_load_parent',
402
+ nonce: wooccm_field.nonce,
403
+ conditional_parent_key: modal.model.attributes.conditional_parent_key
404
+ },
405
+ dataType: 'json',
406
+ type: 'POST',
407
+ beforeSend: function beforeSend() {
408
+ modal.disableSave();
409
+ $details.addClass('save-waiting');
410
+ },
411
+ complete: function complete() {
412
+ $details.addClass('save-complete');
413
+ $details.removeClass('save-waiting');
414
+ modal.enableSave();
415
+ },
416
+ error: function error() {
417
+ alert('Error!');
418
+ },
419
+ success: function success(response) {
420
+ if (response.success) {
421
+ modal.model.attributes['parent'] = response.data;
422
+ modal.model.changed['parent'] = response.data;
423
+ modal.renderInfo();
424
+ } else {
425
+ alert(response.data);
426
+ }
427
+ }
428
+ });
429
+ return false;
430
+ }
431
+ }); // Parts
432
+ // -------------------------------------------------------------
433
+
434
+ var FieldViewTabs = Backbone.View.extend({
435
+ templates: {},
436
+ initialize: function initialize() {
437
+ this.templates.window = wp.template('wooccm-modal-tabs');
438
+ },
439
+ render: function render() {
440
+ this.model.attributes.panel = 'general';
441
+ this.$el.html(this.templates.window(this.model.attributes)); //this.$el.trigger('wooccm-tab-panels');
442
+ }
443
+ });
444
+ var FieldViewPanels = Backbone.View.extend({
445
+ templates: {},
446
+ initialize: function initialize() {
447
+ this.templates.window = wp.template('wooccm-modal-panels');
448
+ },
449
+ render: function render() {
450
+ this.$el.html(this.templates.window(this.model.attributes));
451
+ this.$el.trigger('wooccm-enhanced-options');
452
+ this.$el.trigger('wooccm-enhanced-select');
453
+ this.$el.trigger('init_tooltips');
454
+ }
455
+ });
456
+ var FieldViewInfo = Backbone.View.extend({
457
+ templates: {},
458
+ initialize: function initialize() {
459
+ this.templates.window = wp.template('wooccm-modal-info');
460
+ },
461
+ render: function render() {
462
+ this.$el.html(this.templates.window(this.model.attributes));
463
+ this.$el.trigger('wooccm-enhanced-select');
464
+ this.$el.trigger('init_tooltips');
465
+ }
466
+ });
467
+ $('#wooccm_billing_settings_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add').on('click', function (e) {
468
+ e.preventDefault();
469
+ new FieldModal(e);
470
+ });
471
+ $('#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset').on('click', function (e) {
472
+ e.preventDefault();
473
+ var $button = $(e.target);
474
+ var c = confirm(wooccm_field.message.reset);
475
+
476
+ if (!c) {
477
+ return false;
478
+ }
479
+
480
+ $.ajax({
481
+ url: wooccm_field.ajax_url,
482
+ data: {
483
+ action: 'wooccm_reset_fields',
484
+ nonce: wooccm_field.nonce
485
+ },
486
+ dataType: 'json',
487
+ type: 'POST',
488
+ beforeSend: function beforeSend() {},
489
+ complete: function complete() {},
490
+ error: function error() {
491
+ alert('Error!');
492
+ },
493
+ success: function success(response) {
494
+ if (response.success) {
495
+ location.reload();
496
+ } else {
497
+ alert(response.data);
498
+ }
499
+ }
500
+ });
501
+ return false;
502
+ });
503
+ $('.wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit').on('click', function (e) {
504
+ e.preventDefault();
505
+ new FieldModal(e);
506
+ });
507
+ $('.wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete').on('click', function (e) {
508
+ e.preventDefault();
509
+ var $button = $(e.target),
510
+ $field = $button.closest('[data-field_id]'),
511
+ field_id = $field.data('field_id');
512
+ var c = confirm(wooccm_field.message.remove);
513
+
514
+ if (!c) {
515
+ return false;
516
+ }
517
+
518
+ $.ajax({
519
+ url: wooccm_field.ajax_url,
520
+ data: {
521
+ action: 'wooccm_delete_field',
522
+ nonce: wooccm_field.nonce,
523
+ field_id: field_id
524
+ },
525
+ dataType: 'json',
526
+ type: 'POST',
527
+ beforeSend: function beforeSend() {},
528
+ complete: function complete() {},
529
+ error: function error() {
530
+ alert('Error!');
531
+ },
532
+ success: function success(response) {
533
+ if (response.success) {
534
+ $field.remove();
535
+ } else {
536
+ alert(response.data);
537
+ }
538
+ }
539
+ });
540
+ return false;
541
+ });
542
+ $(document).on('click', '.wooccm-field-toggle-attribute', function (e) {
543
+ e.preventDefault();
544
+ var $link = $(this),
545
+ $tr = $link.closest('tr'),
546
+ $toggle = $link.find('.woocommerce-input-toggle');
547
+ $.ajax({
548
+ url: wooccm_field.ajax_url,
549
+ data: {
550
+ action: 'wooccm_toggle_field_attribute',
551
+ nonce: wooccm_field.nonce,
552
+ field_attr: $(this).data('field_attr'),
553
+ field_id: $tr.data('field_id')
554
+ },
555
+ dataType: 'json',
556
+ type: 'POST',
557
+ beforeSend: function beforeSend(response) {
558
+ $toggle.addClass('woocommerce-input-toggle--loading');
559
+ },
560
+ success: function success(response) {
561
+ if (true === response.data) {
562
+ $toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
563
+ $toggle.addClass('woocommerce-input-toggle--enabled');
564
+ $toggle.removeClass('woocommerce-input-toggle--loading');
565
+ } else if (true !== response.data) {
566
+ $toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
567
+ $toggle.addClass('woocommerce-input-toggle--disabled');
568
+ $toggle.removeClass('woocommerce-input-toggle--loading');
569
+ } //else if ('needs_setup' === response.data) {
570
+ //window.location.href = $link.attr('href');
571
+ //}
572
+
573
+ }
574
+ });
575
+ return false;
576
+ });
577
+ $(document).on('change', '.wooccm-field-change-attribute', function (e) {
578
+ e.preventDefault();
579
+ var $change = $(this),
580
+ $tr = $change.closest('tr');
581
+ $.ajax({
582
+ url: wooccm_field.ajax_url,
583
+ data: {
584
+ action: 'wooccm_change_field_attribute',
585
+ nonce: wooccm_field.nonce,
586
+ field_attr: $change.data('field_attr'),
587
+ field_value: $change.val(),
588
+ field_id: $tr.data('field_id')
589
+ },
590
+ dataType: 'json',
591
+ type: 'POST',
592
+ beforeSend: function beforeSend(response) {
593
+ $change.prop('disabled', true);
594
+ },
595
+ success: function success(response) {
596
+ console.log(response.data);
597
+ },
598
+ complete: function complete(response) {
599
+ $change.prop('disabled', false);
600
+ }
601
+ });
602
+ return false;
603
+ });
604
+ })(jQuery);
605
+
606
+ /***/ }),
607
+
608
+ /***/ "backbone":
609
+ /*!***********************************************!*\
610
+ !*** external {"this":["window","Backbone"]} ***!
611
+ \***********************************************/
612
+ /*! no static exports found */
613
+ /***/ (function(module, exports) {
614
+
615
+ (function() { module.exports = this["window"]["Backbone"]; }());
616
+
617
+ /***/ }),
618
+
619
+ /***/ "jquery":
620
+ /*!**********************************!*\
621
+ !*** external {"this":"jQuery"} ***!
622
+ \**********************************/
623
+ /*! no static exports found */
624
+ /***/ (function(module, exports) {
625
+
626
+ (function() { module.exports = this["jQuery"]; }());
627
+
628
+ /***/ }),
629
+
630
+ /***/ "jquery-ui-datepicker":
631
+ /*!***************************************************!*\
632
+ !*** external {"this":["window","uiDatepicker"]} ***!
633
+ \***************************************************/
634
+ /*! no static exports found */
635
+ /***/ (function(module, exports) {
636
+
637
+ (function() { module.exports = this["window"]["uiDatepicker"]; }());
638
+
639
+ /***/ }),
640
+
641
+ /***/ "wp-util":
642
+ /*!***************************************!*\
643
+ !*** external {"this":["wp","util"]} ***!
644
+ \***************************************/
645
+ /*! no static exports found */
646
+ /***/ (function(module, exports) {
647
+
648
+ (function() { module.exports = this["wp"]["util"]; }());
649
+
650
+ /***/ })
651
+
652
+ /******/ });
653
+ //# sourceMappingURL=admin-field.js.map
assets/backend/js/admin.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('jquery', 'jquery-serializejson'), 'version' => 'f389cc2bea7176abd765911bfcb7c116');
1
+ <?php return array('dependencies' => array('jquery', 'jquery-serializejson'), 'version' => 'b6b4fccea7fc19d92a2bbb32d2ae1248');
assets/backend/js/admin.js CHANGED
@@ -1 +1,416 @@
1
- !function(e){var t={};function n(a){if(t[a])return t[a].exports;var c=t[a]={i:a,l:!1,exports:{}};return e[a].call(c.exports,c,c.exports,n),c.l=!0,c.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)n.d(a,c,function(t){return e[t]}.bind(null,c));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){!function(){e.exports=this.jQuery}()},function(e,t,n){"use strict";n.r(t);var a=n(0),c=n.n(a);n(3),n(2);function i(e){var t=c()(e).next().is(".hasDatepicker")?"minDate":"maxDate",n="minDate"===t?c()(e).next():c()(e).prev(),a=c()(e).datepicker("getDate");c()(n).datepicker("option",t,a),c()(e).change()}function o(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(e){var t=e.input.length-e.maximum;return 1===t?wc_enhanced_select_params.i18n_input_too_long_1:wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",t)},inputTooShort:function(e){var t=e.minimum-e.input.length;return 1===t?wc_enhanced_select_params.i18n_input_too_short_1:wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",t)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(e){return 1===e.maximum?wc_enhanced_select_params.i18n_selection_too_long_1:wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",e.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}c()(".wooccm-premium-field").closest("tr").addClass("wooccm-premium"),c()(document).on("wooccm-enhanced-between-dates",(function(e){c()(".wooccm-enhanced-between-dates").filter(":not(.enhanced)").each((function(){c()(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,onSelect:function(){i(c()(this))}}),c()(this).find("input").each((function(){i(c()(this))}))}))})),c()(document).on("wooccm-enhanced-options",(function(e){c()("table.wc_gateways tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,helper:function(e,t){return t.children().each((function(){c()(this).width(c()(this).width())})),t.css("left","0"),t},start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style"),t.item.trigger("updateMoveButtons")},update:function(e,t){c()(this).find("tr").each((function(e,t){c()(t).find("input.add-order").val(e).trigger("change")}))}}),c()(".wooccm-enhanced-options").each((function(){var e=c()(this),t=e.find(".add-option"),n=e.find(".remove-options");t.on("click",(function(t){var a=e.find("tbody > tr"),i=a.length,o=a.first().clone().html().replace(/options\[([0-9]+)\]/g,"options["+i+"]").replace('disabled="disabled"',"").replace('checked="checked"',"").replace('<input value="0"','<input value="'+i+'"').replace('<input value="0"','<input value="'+i+'"');a.last().after(c()("<tr>"+o+"</tr>")).find("input").trigger("change"),n.removeProp("disabled")})),n.on("click",(function(t){e.find("tr > td.check-column input:checked").closest("tr").remove();var n=e.find("tbody > tr");n.first().find("input").trigger("change"),n.length<2&&c()(this).prop("disabled",!0)}))}))})),c()(document).on("wooccm-enhanced-select",(function(e){c()(".wooccm-enhanced-select").filter(":not(.enhanced)").each((function(){var e=c.a.extend({minimumResultsForSearch:10,allowClear:!!c()(this).data("allow_clear"),placeholder:c()(this).data("placeholder")},o());c()(this).attr("name");c()(this).selectWoo(e).addClass("enhanced")})),c()(".wooccm-product-search").filter(":not(.enhanced)").each((function(){var e={allowClear:!!c()(this).data("allow_clear"),placeholder:c()(this).data("placeholder"),minimumInputLength:c()(this).data("minimum_input_length")?c()(this).data("minimum_input_length"):"3",escapeMarkup:function(e){return e},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(e){return{term:e.term,action:c()(this).data("action")||"wooccm_select_search_products",security:wc_enhanced_select_params.search_products_nonce,selected:c()(this).select2("val")||0,exclude:c()(this).data("exclude"),include:c()(this).data("include"),limit:c()(this).data("limit"),display_stock:c()(this).data("display_stock")}},processResults:function(e){var t=[];return e&&c.a.each(e,(function(e,n){t.push({id:e,text:n})})),{results:t}},cache:!0}};e=c.a.extend(e,o());c()(this).attr("name");if(c()(this).selectWoo(e).addClass("enhanced"),c()(this).data("sortable")){var t=c()(this),n=c()(this).next(".select2-container").find("ul.select2-selection__rendered");n.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){c()(n.find(".select2-selection__choice").get().reverse()).each((function(){var e=c()(this).data("data").id,n=t.find('option[value="'+e+'"]')[0];t.prepend(n)}))}})}else c()(this).prop("multiple")&&c()(this).on("change",(function(){var e=c()(this).children();e.filter("option").sort((function(e,t){var n=e.text.toLowerCase(),a=t.text.toLowerCase();return n>a?1:n<a?-1:0})),c()(this).html(e)}))}))})),c()(".wooccm-enhanced-search").filter(":not(.enhanced)").each((function(){var e={allowClear:!!c()(this).data("allow_clear"),placeholder:c()(this).data("placeholder"),minimumInputLength:c()(this).data("minimum_input_length")||"3",escapeMarkup:function(e){return e},ajax:{url:wooccm_admin.ajax_url,dataType:"json",cache:!0,delay:250,data:function(e){return{term:e.term,key:c()(this).data("key"),action:"wooccm_search_field",nonce:wooccm_admin.nonce}},processResults:function(e,t){var n=[];return e&&c.a.each(e,(function(e,t){n.push({id:e,text:t})})),{results:n}}}};e=c.a.extend(e,o()),c()(this).select2(e).addClass("enhanced")}))},function(e,t){!function(){e.exports=this.window.serializeJSON}()},function(e,t){}]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = "./src/backend/admin.js");
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ({
88
+
89
+ /***/ "./src/backend/admin.js":
90
+ /*!******************************!*\
91
+ !*** ./src/backend/admin.js ***!
92
+ \******************************/
93
+ /*! no exports provided */
94
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
95
+
96
+ "use strict";
97
+ __webpack_require__.r(__webpack_exports__);
98
+ /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
99
+ /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
100
+ /* harmony import */ var _scss_editor_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scss/editor.scss */ "./src/backend/scss/editor.scss");
101
+ /* harmony import */ var _scss_editor_scss__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_scss_editor_scss__WEBPACK_IMPORTED_MODULE_1__);
102
+ /* harmony import */ var jquery_serializejson__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! jquery-serializejson */ "jquery-serializejson");
103
+ /* harmony import */ var jquery_serializejson__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(jquery_serializejson__WEBPACK_IMPORTED_MODULE_2__);
104
+
105
+
106
+
107
+ /* (function ($) {*/
108
+
109
+ "use strict";
110
+
111
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()('.wooccm-premium-field').closest('tr').addClass('wooccm-premium');
112
+
113
+ function date_picker_select(datepicker) {
114
+ var option = jquery__WEBPACK_IMPORTED_MODULE_0___default()(datepicker).next().is('.hasDatepicker') ? 'minDate' : 'maxDate',
115
+ otherDateField = 'minDate' === option ? jquery__WEBPACK_IMPORTED_MODULE_0___default()(datepicker).next() : jquery__WEBPACK_IMPORTED_MODULE_0___default()(datepicker).prev(),
116
+ date = jquery__WEBPACK_IMPORTED_MODULE_0___default()(datepicker).datepicker('getDate');
117
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(otherDateField).datepicker('option', option, date);
118
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(datepicker).change();
119
+ }
120
+
121
+ function getEnhancedSelectFormatString() {
122
+ return {
123
+ 'language': {
124
+ errorLoading: function errorLoading() {
125
+ // Workaround for https://github.com/select2/select2/issues/4355 instead of i18n_ajax_error.
126
+ return wc_enhanced_select_params.i18n_searching;
127
+ },
128
+ inputTooLong: function inputTooLong(args) {
129
+ var overChars = args.input.length - args.maximum;
130
+
131
+ if (1 === overChars) {
132
+ return wc_enhanced_select_params.i18n_input_too_long_1;
133
+ }
134
+
135
+ return wc_enhanced_select_params.i18n_input_too_long_n.replace('%qty%', overChars);
136
+ },
137
+ inputTooShort: function inputTooShort(args) {
138
+ var remainingChars = args.minimum - args.input.length;
139
+
140
+ if (1 === remainingChars) {
141
+ return wc_enhanced_select_params.i18n_input_too_short_1;
142
+ }
143
+
144
+ return wc_enhanced_select_params.i18n_input_too_short_n.replace('%qty%', remainingChars);
145
+ },
146
+ loadingMore: function loadingMore() {
147
+ return wc_enhanced_select_params.i18n_load_more;
148
+ },
149
+ maximumSelected: function maximumSelected(args) {
150
+ if (args.maximum === 1) {
151
+ return wc_enhanced_select_params.i18n_selection_too_long_1;
152
+ }
153
+
154
+ return wc_enhanced_select_params.i18n_selection_too_long_n.replace('%qty%', args.maximum);
155
+ },
156
+ noResults: function noResults() {
157
+ return wc_enhanced_select_params.i18n_no_matches;
158
+ },
159
+ searching: function searching() {
160
+ return wc_enhanced_select_params.i18n_searching;
161
+ }
162
+ }
163
+ };
164
+ }
165
+
166
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).on('wooccm-enhanced-between-dates', function (e) {
167
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()('.wooccm-enhanced-between-dates').filter(':not(.enhanced)').each(function () {
168
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find('input').datepicker({
169
+ defaultDate: '',
170
+ dateFormat: 'yy-mm-dd',
171
+ numberOfMonths: 1,
172
+ showButtonPanel: true,
173
+ onSelect: function onSelect() {
174
+ date_picker_select(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this));
175
+ }
176
+ });
177
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find('input').each(function () {
178
+ date_picker_select(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this));
179
+ });
180
+ });
181
+ });
182
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).on('wooccm-enhanced-options', function (e) {
183
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()('table.wc_gateways tbody').sortable({
184
+ items: 'tr',
185
+ cursor: 'move',
186
+ axis: 'y',
187
+ handle: 'td.sort',
188
+ scrollSensitivity: 40,
189
+ helper: function helper(event, ui) {
190
+ ui.children().each(function () {
191
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).width(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).width());
192
+ });
193
+ ui.css('left', '0');
194
+ return ui;
195
+ },
196
+ start: function start(event, ui) {
197
+ ui.item.css('background-color', '#f6f6f6');
198
+ },
199
+ stop: function stop(event, ui) {
200
+ ui.item.removeAttr('style');
201
+ ui.item.trigger('updateMoveButtons');
202
+ },
203
+ update: function update(event, ui) {
204
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find('tr').each(function (i, tr) {
205
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(tr).find('input.add-order').val(i).trigger('change');
206
+ });
207
+ }
208
+ });
209
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()('.wooccm-enhanced-options').each(function () {
210
+ var $table = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
211
+ $add = $table.find('.add-option'),
212
+ $remove = $table.find('.remove-options');
213
+ $add.on('click', function (e) {
214
+ var $tr = $table.find('tbody > tr'),
215
+ id = $tr.length,
216
+ tr = $tr.first().clone().html().replace(/options\[([0-9]+)\]/g, 'options[' + id + ']').replace('disabled="disabled"', '').replace('checked="checked"', '').replace('<input value="0"', '<input value="' + id + '"').replace('<input value="0"', '<input value="' + id + '"');
217
+ $tr.last().after(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<tr>' + tr + '</tr>')).find('input').trigger('change');
218
+ $remove.removeProp('disabled');
219
+ });
220
+ $remove.on('click', function (e) {
221
+ $table.find('tr > td.check-column input:checked').closest('tr').remove();
222
+ var $tr = $table.find('tbody > tr');
223
+ $tr.first().find('input').trigger('change');
224
+
225
+ if ($tr.length < 2) {
226
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).prop('disabled', true);
227
+ }
228
+ });
229
+ });
230
+ });
231
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).on('wooccm-enhanced-select', function (e) {
232
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()('.wooccm-enhanced-select').filter(':not(.enhanced)').each(function () {
233
+ var select2_args = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({
234
+ minimumResultsForSearch: 10,
235
+ allowClear: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('allow_clear') ? true : false,
236
+ placeholder: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('placeholder')
237
+ }, getEnhancedSelectFormatString());
238
+ var name = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).attr('name'); // fix serializeJSON empty select and multiselect
239
+ //if (name.indexOf('[]') >= 0) {
240
+ // $(this).prepend('<input type="hidden" name="' + name + '" value="[]" />');
241
+ //}
242
+
243
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).selectWoo(select2_args).addClass('enhanced');
244
+ });
245
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()('.wooccm-product-search').filter(':not(.enhanced)').each(function () {
246
+ var select2_args = {
247
+ allowClear: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('allow_clear') ? true : false,
248
+ placeholder: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('placeholder'),
249
+ minimumInputLength: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('minimum_input_length') ? jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('minimum_input_length') : '3',
250
+ escapeMarkup: function escapeMarkup(m) {
251
+ return m;
252
+ },
253
+ ajax: {
254
+ url: wc_enhanced_select_params.ajax_url,
255
+ dataType: 'json',
256
+ delay: 250,
257
+ data: function data(params) {
258
+ return {
259
+ term: params.term,
260
+ action: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('action') || 'wooccm_select_search_products',
261
+ //nonce: wooccm_admin.nonce,
262
+ security: wc_enhanced_select_params.search_products_nonce,
263
+ selected: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).select2('val') || 0,
264
+ exclude: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('exclude'),
265
+ include: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('include'),
266
+ limit: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('limit'),
267
+ display_stock: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('display_stock')
268
+ };
269
+ },
270
+ processResults: function processResults(data) {
271
+ var terms = [];
272
+
273
+ if (data) {
274
+ jquery__WEBPACK_IMPORTED_MODULE_0___default.a.each(data, function (id, text) {
275
+ terms.push({
276
+ id: id,
277
+ text: text
278
+ });
279
+ });
280
+ }
281
+
282
+ return {
283
+ results: terms
284
+ };
285
+ },
286
+ cache: true
287
+ }
288
+ };
289
+ select2_args = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend(select2_args, getEnhancedSelectFormatString());
290
+ var name = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).attr('name'); // fix serializeJSON empty select and multiselect
291
+ //if (name.indexOf('[]') >= 0) {
292
+ // $(this).prepend('<input type="hidden" name="' + name + '" value="[]" />');
293
+ //}
294
+
295
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).selectWoo(select2_args).addClass('enhanced');
296
+
297
+ if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('sortable')) {
298
+ var $select = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
299
+ var $list = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).next('.select2-container').find('ul.select2-selection__rendered');
300
+ $list.sortable({
301
+ placeholder: 'ui-state-highlight select2-selection__choice',
302
+ forcePlaceholderSize: true,
303
+ items: 'li:not(.select2-search__field)',
304
+ tolerance: 'pointer',
305
+ stop: function stop() {
306
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()($list.find('.select2-selection__choice').get().reverse()).each(function () {
307
+ var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('data').id;
308
+ var option = $select.find('option[value="' + id + '"]')[0];
309
+ $select.prepend(option);
310
+ });
311
+ }
312
+ }); // Keep multiselects ordered alphabetically if they are not sortable.
313
+ } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).prop('multiple')) {
314
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).on('change', function () {
315
+ var $children = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).children(); //filter option fix appended input hidden
316
+
317
+ $children.filter('option').sort(function (a, b) {
318
+ var atext = a.text.toLowerCase();
319
+ var btext = b.text.toLowerCase();
320
+
321
+ if (atext > btext) {
322
+ return 1;
323
+ }
324
+
325
+ if (atext < btext) {
326
+ return -1;
327
+ }
328
+
329
+ return 0;
330
+ });
331
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).html($children);
332
+ });
333
+ }
334
+ });
335
+ });
336
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()('.wooccm-enhanced-search').filter(':not(.enhanced)').each(function () {
337
+ var select2_args = {
338
+ allowClear: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('allow_clear') ? true : false,
339
+ placeholder: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('placeholder'),
340
+ minimumInputLength: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('minimum_input_length') || '3',
341
+ escapeMarkup: function escapeMarkup(m) {
342
+ return m;
343
+ },
344
+ ajax: {
345
+ url: wooccm_admin.ajax_url,
346
+ dataType: 'json',
347
+ cache: true,
348
+ delay: 250,
349
+ data: function data(params) {
350
+ return {
351
+ term: params.term,
352
+ key: jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('key'),
353
+ action: 'wooccm_search_field',
354
+ nonce: wooccm_admin.nonce
355
+ };
356
+ },
357
+ processResults: function processResults(data, params) {
358
+ var terms = [];
359
+
360
+ if (data) {
361
+ jquery__WEBPACK_IMPORTED_MODULE_0___default.a.each(data, function (id, text) {
362
+ terms.push({
363
+ id: id,
364
+ text: text
365
+ });
366
+ });
367
+ }
368
+
369
+ return {
370
+ results: terms
371
+ };
372
+ }
373
+ }
374
+ };
375
+ select2_args = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend(select2_args, getEnhancedSelectFormatString());
376
+ jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).select2(select2_args).addClass('enhanced');
377
+ });
378
+ /* })(jQuery); */
379
+
380
+ /***/ }),
381
+
382
+ /***/ "./src/backend/scss/editor.scss":
383
+ /*!**************************************!*\
384
+ !*** ./src/backend/scss/editor.scss ***!
385
+ \**************************************/
386
+ /*! no static exports found */
387
+ /***/ (function(module, exports) {
388
+
389
+ // removed by extract-text-webpack-plugin
390
+
391
+ /***/ }),
392
+
393
+ /***/ "jquery":
394
+ /*!**********************************!*\
395
+ !*** external {"this":"jQuery"} ***!
396
+ \**********************************/
397
+ /*! no static exports found */
398
+ /***/ (function(module, exports) {
399
+
400
+ (function() { module.exports = this["jQuery"]; }());
401
+
402
+ /***/ }),
403
+
404
+ /***/ "jquery-serializejson":
405
+ /*!****************************************************!*\
406
+ !*** external {"this":["window","serializeJSON"]} ***!
407
+ \****************************************************/
408
+ /*! no static exports found */
409
+ /***/ (function(module, exports) {
410
+
411
+ (function() { module.exports = this["window"]["serializeJSON"]; }());
412
+
413
+ /***/ })
414
+
415
+ /******/ });
416
+ //# sourceMappingURL=admin.js.map
assets/frontend/css/checkout.css CHANGED
@@ -1 +1,116 @@
1
- .woocommerce form .wooccm-clearfix:before,.woocommerce form .wooccm-clearfix:after{content:'';display:table}.woocommerce form .wooccm-clearfix:after{clear:both}.woocommerce form .wooccm-conditional-child{display:none}.woocommerce form .wooccm-type-radio .woocommerce-radio-wrapper label{display:inline-block}.woocommerce form .wooccm-colorpicker-iris .iris-picker{display:none}.woocommerce form .wooccm-colorpicker-iris.active .iris-picker{display:block}.button.fileinput-button{position:relative;overflow:hidden !important}.button.fileinput-button input{position:absolute;top:0;right:0;margin:0;opacity:0;-ms-filter:'alpha(opacity=0)';font-size:200px;direction:ltr;cursor:pointer}.wooccm-file-list{margin:0 -5px;padding:0;display:flex;flex-wrap:wrap;align-items:center;justify-content:start}.wooccm-file-list .wooccm-file-file{display:flex;justify-content:center;align-items:stretch;box-sizing:border-box;padding:10px 5px 0 5px;width:25%;position:relative}.wooccm-file-list .wooccm-file-file .wooccm-file-list-delete{z-index:1;position:absolute;top:2px;right:-3px;width:16px;height:16px;background-color:#222;display:block;line-height:16px;text-align:center;color:#fefefe;font-weight:900;border-radius:50%;font-size:12px;cursor:pointer;font-family:code;text-decoration:none !important}.wooccm-file-list .wooccm-file-file .wooccm-file-list-container{width:100%;overflow:hidden}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container{display:flex;justify-content:center;align-items:center;overflow:hidden;width:100%;padding-top:100%;position:relative;background:#eee}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container>img{overflow:hidden;object-fit:cover;position:absolute;top:30%;bottom:auto;height:40%;opacity:0.8}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container>img.image{top:0;bottom:0;left:0;right:0;max-height:100%;max-height:100%;height:100%;width:100%}.wooccm-file-list .ui-timepicker-table a{word-break:normal}.wooccm-file-list .ui-state-disabled,.wooccm-file-list .ui-widget-content .ui-state-disabled,.wooccm-file-list .ui-widget-header .ui-state-disabled{width:100%}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .woocommerce form {
2
+ /* @media (min-width: 768px) {
3
+ .wooccm-field {
4
+ &.form-row-first {
5
+ width: 47.0588235294%;
6
+ float: left;
7
+ margin-right: 5.8823529412%;
8
+ clear: both;
9
+ }
10
+ &.form-row-last {
11
+ width: 45.4545454545%;
12
+ float: right;
13
+ margin-right: 0;
14
+ }
15
+ }
16
+ }*/ }
17
+ .woocommerce form .wooccm-clearfix:before, .woocommerce form .wooccm-clearfix:after {
18
+ content: "";
19
+ display: table; }
20
+ .woocommerce form .wooccm-clearfix:after {
21
+ clear: both; }
22
+ .woocommerce form .wooccm-conditional-child {
23
+ display: none; }
24
+ .woocommerce form .wooccm-type-hidden {
25
+ display: none; }
26
+ .woocommerce form .wooccm-type-radio .woocommerce-radio-wrapper label {
27
+ display: inline-block; }
28
+ .woocommerce form .wooccm-colorpicker-iris .iris-picker {
29
+ display: none; }
30
+ .woocommerce form .wooccm-colorpicker-iris.active .iris-picker {
31
+ display: block; }
32
+
33
+ .button.fileinput-button {
34
+ position: relative;
35
+ overflow: hidden !important; }
36
+ .button.fileinput-button input {
37
+ position: absolute;
38
+ top: 0;
39
+ right: 0;
40
+ margin: 0;
41
+ opacity: 0;
42
+ -ms-filter: "alpha(opacity=0)";
43
+ font-size: 200px;
44
+ direction: ltr;
45
+ cursor: pointer; }
46
+
47
+ .wooccm-file-list {
48
+ margin: 0 -5px;
49
+ padding: 0;
50
+ display: flex;
51
+ flex-wrap: wrap;
52
+ align-items: center;
53
+ justify-content: start; }
54
+ .wooccm-file-list .wooccm-file-file {
55
+ display: flex;
56
+ justify-content: center;
57
+ align-items: stretch;
58
+ box-sizing: border-box;
59
+ padding: 10px 5px 0 5px;
60
+ width: 25%;
61
+ position: relative; }
62
+ .wooccm-file-list .wooccm-file-file .wooccm-file-list-delete {
63
+ z-index: 1;
64
+ position: absolute;
65
+ top: 2px;
66
+ right: -3px;
67
+ width: 16px;
68
+ height: 16px;
69
+ background-color: #222;
70
+ display: block;
71
+ line-height: 16px;
72
+ text-align: center;
73
+ color: #fefefe;
74
+ font-weight: 900;
75
+ border-radius: 50%;
76
+ font-size: 12px;
77
+ cursor: pointer;
78
+ font-family: code;
79
+ text-decoration: none !important; }
80
+ .wooccm-file-list .wooccm-file-file .wooccm-file-list-container {
81
+ width: 100%;
82
+ overflow: hidden; }
83
+ .wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container {
84
+ display: flex;
85
+ justify-content: center;
86
+ align-items: center;
87
+ overflow: hidden;
88
+ width: 100%;
89
+ padding-top: 100%;
90
+ position: relative;
91
+ background: #eee; }
92
+ .wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container > img {
93
+ overflow: hidden;
94
+ object-fit: cover;
95
+ position: absolute;
96
+ top: 30%;
97
+ bottom: auto;
98
+ height: 40%;
99
+ opacity: 0.8; }
100
+ .wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container > img.image {
101
+ top: 0;
102
+ bottom: 0;
103
+ left: 0;
104
+ right: 0;
105
+ max-height: 100%;
106
+ max-height: 100%;
107
+ height: 100%;
108
+ width: 100%; }
109
+ .wooccm-file-list .ui-timepicker-table a {
110
+ word-break: normal; }
111
+ .wooccm-file-list .ui-state-disabled,
112
+ .wooccm-file-list .ui-widget-content .ui-state-disabled,
113
+ .wooccm-file-list .ui-widget-header .ui-state-disabled {
114
+ width: 100%; }
115
+
116
+ /*# sourceMappingURL=checkout.css.map*/
assets/frontend/js/checkout.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('jquery', 'selectWoo'), 'version' => 'acb3437adce2bd11ff9c4881456b2708');
1
+ <?php return array('dependencies' => array('jquery', 'selectWoo'), 'version' => 'c77d9a8d87e70175e97e8b7144796b9b');
assets/frontend/js/checkout.js CHANGED
@@ -1 +1,693 @@
1
- !function(e){var t={};function o(c){if(t[c])return t[c].exports;var i=t[c]={i:c,l:!1,exports:{}};return e[c].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=e,o.c=t,o.d=function(e,t,c){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(o.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(c,i,function(t){return e[t]}.bind(null,i));return c},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";o.r(t);o(3),o(1),o(2);!function(e){var t=function(e){return e.is(".processing")||e.parents(".processing").length};e(document).on("country_to_state_changing",(function(t,o,c){var i=c,n=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(n,(function(e,t){var o=i.find(t),c=o.find("[data-required]").data("required")||o.find(".wooccm-required-field").length;!function(e,t){t?(e.find("label .optional").remove(),e.addClass("validate-required"),0===e.find("label .required").length&&e.find("label").append('<abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>'),e.show(),e.find("input[type=hidden]").prop("type","text")):(e.find("label .required").remove(),e.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field"),0===e.find("label .optional").length&&e.find("label").append('<span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}(o,c)}))}));var o={};if(e(".wooccm-type-file").each((function(t,c){var i=e(c),n=i.find("[type=file]"),a=i.find(".wooccm-file-button"),r=i.find(".wooccm-file-list");o[i.attr("id")]=[],a.on("click",(function(e){e.preventDefault(),n.trigger("click")})),r.on("click",".wooccm-file-list-delete",(function(t){var c=e(this).closest(".wooccm-file-file"),n=e(this).closest("[data-file_id]").data("file_id");o[i.attr("id")]=e.grep(o[i.attr("id")],(function(e,t){return t!=n})),c.remove(),e("#order_review").trigger("wooccm_upload")})),n.on("change",(function(t){var c=e(this)[0].files;c.length&&window.FileReader&&e.each(c,(function(t,c){if(r.find("span[data-file_id]").length+t>=wooccm_upload.limit.max_files)return alert("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1;if(c.size>wooccm_upload.limit.max_file_size)return alert("Exeeds max file size of "+wooccm_upload.limit.max_file_size),!0;var n,a=new FileReader;a.onload=(n=c,function(t){setTimeout((function(){!function(t,o,c,i,n){var a,r=e(t);n.match("image.*")?a="image":n.match("application/ms.*")?(c=wooccm_upload.icons.spreadsheet,a="spreadsheet"):n.match("application/x.*")?(c=wooccm_upload.icons.archive,a="application"):n.match("audio.*")?(c=wooccm_upload.icons.audio,a="audio"):n.match("text.*")?(c=wooccm_upload.icons.text,a="text"):n.match("video.*")?(c=wooccm_upload.icons.video,a="video"):(c=wooccm_upload.icons.interactive,a="interactive");var l='<span data-file_id="'+o+'" title="'+i+'" class="wooccm-file-file">\n <span class="wooccm-file-list-container">\n <a title="'+i+'" class="wooccm-file-list-delete">×</a>\n <span class="wooccm-file-list-image-container">\n <img class="'+a+'" alt="'+i+'" src="'+c+'"/>\n </span>\n </span>\n </span>';r.append(l).fadeIn()}(r,o[i.attr("id")].push(c)-1,t.target.result,n.name,n.type),e("#order_review").trigger("wooccm_upload")}),200)}),a.readAsDataURL(c)}))}))})),e("#order_review").on("ajaxSuccess wooccm_upload",(function(t,o,c){var i=e(t.target).find("#place_order");e(".wooccm-type-file").length?i.addClass("wooccm-upload-process"):i.removeClass("wooccm-upload-process")})),e(document).on("click","#place_order.wooccm-upload-process",(function(c){c.preventDefault();var i,n=e("form.checkout"),a=e(this);e(".wooccm-type-file").length&&(window.FormData&&Object.keys(o).length&&(t(n)||(a.html(wooccm_upload.message.uploading),t(i=n)||i.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})),e.each(o,(function(t,o){var c=e("#"+t).find(".wooccm-file-field"),i=new FormData;e.each(o,(function(e,t){return e>wooccm_upload.limit.max_files?(console.log("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1):t.size>wooccm_upload.limit.max_file_size?(console.log("Exeeds max file size of "+wooccm_upload.limit.max_files),!0):(console.log("We're ready to upload "+t.name),void i.append("wooccm_checkout_attachment_upload[]",t))})),i.append("action","wooccm_checkout_attachment_upload"),i.append("nonce",wooccm_upload.nonce),e.ajax({async:!1,url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:i,processData:!1,contentType:!1,beforeSend:function(e){},success:function(t){t.success?c.val(t.data):e("body").trigger("update_checkout")},complete:function(e){}})})),function(e){e.removeClass("processing").unblock()}(n),a.removeClass("wooccm-upload-process").trigger("click")))})),e(document).on("change",".wooccm-add-price",(function(t){e("body").trigger("update_checkout")})),e(".wooccm-field").each((function(t,o){e(o).find("input,textarea,select").on("change keyup wooccm_change",(function(t){var o=e(t.target).attr("name").replace("[]",""),c=e(t.target).prop("type"),i=e(t.target).val();"checkbox"==c&&(i=-1!==e(t.target).attr("name").indexOf("[]")?e(t.target).closest(".wooccm-field").find("input:checked").map((function(e,t){return t.value})).toArray():e(t.target).is(":checked")),e("*[data-conditional-parent="+o+"]").closest(".wooccm-field").hide(),e("*[data-conditional-parent="+o+"]").each((function(t,o){var c=e(o),n=c&&c.data("conditional-parent-value");(i==n||e.isArray(i)&&i.indexOf(n)>-1)&&c.closest(".wooccm-field").fadeIn()}))}))})),e(".wooccm-conditional-child").each((function(t,o){var c=e(o),i=e("#"+c.find("[data-conditional-parent]").data("conditional-parent")+"_field");i.find("select:first").trigger("wooccm_change"),i.find("textarea:first").trigger("wooccm_change"),i.find("input[type=button]:first").trigger("wooccm_change"),i.find("input[type=radio]:checked:first").trigger("wooccm_change"),i.find("input[type=checkbox]:checked:first").trigger("wooccm_change"),i.find("input[type=color]:first").trigger("wooccm_change"),i.find("input[type=date]:first").trigger("wooccm_change"),i.find("input[type=datetime-local]:first").trigger("wooccm_change"),i.find("input[type=email]:first").trigger("wooccm_change"),i.find("input[type=file]:first").trigger("wooccm_change"),i.find("input[type=hidden]:first").trigger("wooccm_change"),i.find("input[type=image]:first").trigger("wooccm_change"),i.find("input[type=month]:first").trigger("wooccm_change"),i.find("input[type=number]:first").trigger("wooccm_change"),i.find("input[type=password]:first").trigger("wooccm_change"),i.find("input[type=range]:first").trigger("wooccm_change"),i.find("input[type=reset]:first").trigger("wooccm_change"),i.find("input[type=search]:first").trigger("wooccm_change"),i.find("input[type=submit]:first").trigger("wooccm_change"),i.find("input[type=tel]:first").trigger("wooccm_change"),i.find("input[type=text]:first").trigger("wooccm_change"),i.find("input[type=time]:first").trigger("wooccm_change"),i.find("input[type=url]:first").trigger("wooccm_change"),i.find("input[type=week]:first").trigger("wooccm_change")})),e(".wooccm-enhanced-datepicker").each((function(t,o){var c=e(this),i=c.data("disable")||!1;e.isFunction(e.fn.datepicker)&&c.datepicker({dateFormat:c.data("formatdate")||"dd-mm-yy",minDate:c.data("mindate"),maxDate:c.data("maxdate"),beforeShowDay:function(t){var o=null!=t.getDay()&&t.getDay().toString();return i?[-1===e.inArray(o,i)]:[!0]}})})),e(".wooccm-enhanced-timepicker").each((function(t,o){var c=e(this);e.isFunction(e.fn.timepicker)&&(console.log(c.data("format-ampm")),c.timepicker({showPeriodLabels:!!c.data("format-ampm"),showPeriod:!!c.data("format-ampm"),showLeadingZero:!0,hours:c.data("hours")||void 0,minutes:c.data("minutes")||void 0}))})),e(".wooccm-colorpicker-farbtastic").each((function(t,o){var c=e(o),i=c.find("input[type=text]"),n=c.find(".wooccmcolorpicker_container");i.hide(),e.isFunction(e.fn.farbtastic)&&(n.farbtastic("#"+i.attr("id")),n.on("click",(function(e){i.fadeIn()})))})),e(".wooccm-colorpicker-iris").each((function(t,o){var c=e(o),i=c.find("input[type=text]");i.css("background",i.val()),i.on("click",(function(e){c.toggleClass("active")})),i.iris({class:i.attr("id"),palettes:!0,color:"",hide:!1,change:function(e,t){i.css("background",t.color.toString()).fadeIn()}})})),e(document).on("click",(function(t){0===e(t.target).closest(".iris-picker").length&&e(".wooccm-colorpicker-iris").removeClass("active")})),"undefined"==typeof wc_country_select_params)return!1;if(e().selectWoo){e("select.wooccm-enhanced-select").each((function(){var t=e.extend({width:"100%",placeholder:e(this).data("placeholder")||"",allowClear:e(this).data("allowclear")||!1,selectOnClose:e(this).data("selectonclose")||!1,closeOnSelect:e(this).data("closeonselect")||!1,minimumResultsForSearch:e(this).data("search")||-1},{language:{errorLoading:function(){return wc_country_select_params.i18n_searching},inputTooLong:function(e){var t=e.input.length-e.maximum;return 1===t?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",t)},inputTooShort:function(e){var t=e.minimum-e.input.length;return 1===t?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",t)},loadingMore:function(){return wc_country_select_params.i18n_load_more},maximumSelected:function(e){return 1===e.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",e.maximum)},noResults:function(){return wc_country_select_params.i18n_no_matches},searching:function(){return wc_country_select_params.i18n_searching}}});e(this).on("select2:select",(function(){e(this).focus()})).selectWoo(t)}))}}(jQuery)},function(e,t){!function(){e.exports=this.jQuery}()},function(e,t){!function(){e.exports=this.window.selectWoo}()},function(e,t){}]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = "./src/frontend/checkout.js");
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ({
88
+
89
+ /***/ "./src/frontend/checkout.js":
90
+ /*!**********************************!*\
91
+ !*** ./src/frontend/checkout.js ***!
92
+ \**********************************/
93
+ /*! no exports provided */
94
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
95
+
96
+ "use strict";
97
+ __webpack_require__.r(__webpack_exports__);
98
+ /* harmony import */ var _scss_style_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./scss/style.scss */ "./src/frontend/scss/style.scss");
99
+ /* harmony import */ var _scss_style_scss__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_scss_style_scss__WEBPACK_IMPORTED_MODULE_0__);
100
+ /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ "jquery");
101
+ /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);
102
+ /* harmony import */ var selectWoo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! selectWoo */ "selectWoo");
103
+ /* harmony import */ var selectWoo__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(selectWoo__WEBPACK_IMPORTED_MODULE_2__);
104
+
105
+
106
+
107
+
108
+ (function ($) {
109
+ "use strict";
110
+
111
+ var is_blocked = function is_blocked($node) {
112
+ return $node.is('.processing') || $node.parents('.processing').length;
113
+ };
114
+
115
+ var block = function block($node) {
116
+ if (!is_blocked($node)) {
117
+ $node.addClass('processing').block({
118
+ message: null,
119
+ overlayCSS: {
120
+ background: '#fff',
121
+ opacity: 0.6
122
+ }
123
+ });
124
+ }
125
+ };
126
+
127
+ var unblock = function unblock($node) {
128
+ $node.removeClass('processing').unblock();
129
+ };
130
+
131
+ var append_image = function append_image(list, i, source, name, filetype) {
132
+ var $field_list = $(list),
133
+ source_class;
134
+
135
+ if (filetype.match('image.*')) {
136
+ source_class = 'image';
137
+ } else if (filetype.match('application/ms.*')) {
138
+ source = wooccm_upload.icons.spreadsheet;
139
+ source_class = 'spreadsheet';
140
+ } else if (filetype.match('application/x.*')) {
141
+ source = wooccm_upload.icons.archive;
142
+ source_class = 'application';
143
+ } else if (filetype.match('audio.*')) {
144
+ source = wooccm_upload.icons.audio;
145
+ source_class = 'audio';
146
+ } else if (filetype.match('text.*')) {
147
+ source = wooccm_upload.icons.text;
148
+ source_class = 'text';
149
+ } else if (filetype.match('video.*')) {
150
+ source = wooccm_upload.icons.video;
151
+ source_class = 'video';
152
+ } else {
153
+ //if ((false === filetype.match('application/ms.*') && false === filetype.match('application/x.*') && false === filetype.match('audio.*') && false === filetype.match('text.*') && false === filetype.match('video.*')) || (0 === filetype.length || !filetype)) {
154
+ source = wooccm_upload.icons.interactive;
155
+ source_class = 'interactive';
156
+ }
157
+
158
+ var html = '<span data-file_id="' + i + '" title="' + name + '" class="wooccm-file-file">\n\
159
+ <span class="wooccm-file-list-container">\n\
160
+ <a title="' + name + '" class="wooccm-file-list-delete">×</a>\n\
161
+ <span class="wooccm-file-list-image-container">\n\
162
+ <img class="' + source_class + '" alt="' + name + '" src="' + source + '"/>\n\
163
+ </span>\n\
164
+ </span>\n\
165
+ </span>';
166
+ $field_list.append(html).fadeIn();
167
+ };
168
+
169
+ function field_is_required(field, is_required) {
170
+ if (is_required) {
171
+ field.find('label .optional').remove();
172
+ field.addClass('validate-required');
173
+
174
+ if (field.find('label .required').length === 0) {
175
+ field.find('label').append('<abbr class="required" title="' + wc_address_i18n_params.i18n_required_text + '">*</abbr>');
176
+ } //fix state hidden
177
+
178
+
179
+ field.show();
180
+ field.find('input[type=hidden]').prop('type', 'text');
181
+ } else {
182
+ field.find('label .required').remove();
183
+ field.removeClass('validate-required woocommerce-invalid woocommerce-invalid-required-field');
184
+
185
+ if (field.find('label .optional').length === 0) {
186
+ field.find('label').append('<span class="optional">(' + wc_address_i18n_params.i18n_optional_text + ')</span>');
187
+ }
188
+ }
189
+ }
190
+
191
+ $(document).on('country_to_state_changing', function (event, country, wrapper) {
192
+ var thisform = wrapper,
193
+ thislocale;
194
+ var locale_fields = $.parseJSON(wc_address_i18n_params.locale_fields);
195
+ $.each(locale_fields, function (key, value) {
196
+ var field = thisform.find(value),
197
+ required = field.find('[data-required]').data('required') || field.find('.wooccm-required-field').length;
198
+ field_is_required(field, required);
199
+ });
200
+ }); // Field
201
+ // ---------------------------------------------------------------------------
202
+
203
+ var fileList = {};
204
+ $('.wooccm-type-file').each(function (i, field) {
205
+ var $field = $(field),
206
+ $button_file = $field.find('[type=file]'),
207
+ $button_click = $field.find('.wooccm-file-button'),
208
+ $field_list = $field.find('.wooccm-file-list');
209
+ fileList[$field.attr('id')] = []; // Simulate click
210
+ // -------------------------------------------------------------------------
211
+
212
+ $button_click.on('click', function (e) {
213
+ e.preventDefault();
214
+ $button_file.trigger('click');
215
+ }); // Delete images
216
+ // ---------------------------------------------------------------------------
217
+
218
+ $field_list.on('click', '.wooccm-file-list-delete', function (e) {
219
+ var $file = $(this).closest('.wooccm-file-file'),
220
+ file_id = $(this).closest('[data-file_id]').data('file_id');
221
+ fileList[$field.attr('id')] = $.grep(fileList[$field.attr('id')], function (value, index) {
222
+ return index != file_id;
223
+ });
224
+ $file.remove();
225
+ $('#order_review').trigger('wooccm_upload');
226
+ }); // Append images
227
+ // -------------------------------------------------------------------------
228
+
229
+ $button_file.on('change', function (e) {
230
+ var files = $(this)[0].files;
231
+
232
+ if (files.length) {
233
+ if (window.FileReader) {
234
+ $.each(files, function (i, file) {
235
+ var count = $field_list.find('span[data-file_id]').length + i;
236
+
237
+ if (count >= wooccm_upload.limit.max_files) {
238
+ alert('Exeeds max files limit of ' + wooccm_upload.limit.max_files);
239
+ return false;
240
+ }
241
+
242
+ if (file.size > wooccm_upload.limit.max_file_size) {
243
+ alert('Exeeds max file size of ' + wooccm_upload.limit.max_file_size);
244
+ return true;
245
+ }
246
+
247
+ var reader = new FileReader();
248
+
249
+ reader.onload = function (theFile) {
250
+ return function (e) {
251
+ setTimeout(function () {
252
+ append_image($field_list, fileList[$field.attr('id')].push(file) - 1, e.target.result, theFile.name, theFile.type);
253
+ $('#order_review').trigger('wooccm_upload');
254
+ }, 200);
255
+ };
256
+ }(file);
257
+
258
+ reader.readAsDataURL(file);
259
+ });
260
+ }
261
+ }
262
+ });
263
+ }); // Add class on place order reload if upload field exists
264
+ // ---------------------------------------------------------------------------
265
+ // $(document).on('checkout_place_order_success', function (e) {
266
+ // alert('submit!');
267
+ // });
268
+ // $('form.checkout').on('checkout_place_order_success', function (e) {
269
+ // alert('submit!');
270
+ // });
271
+
272
+ $('#order_review').on('ajaxSuccess wooccm_upload', function (e, xhr, settings) {
273
+ // console.log('e', e);
274
+ // console.log('xhr', xhr);
275
+ // console.log('settings', settings);
276
+ var $order_review = $(e.target),
277
+ $place_order = $order_review.find('#place_order'),
278
+ $fields = $('.wooccm-type-file'),
279
+ fields = $fields.length;
280
+
281
+ if (fields) {
282
+ $place_order.addClass('wooccm-upload-process');
283
+ } else {
284
+ $place_order.removeClass('wooccm-upload-process');
285
+ }
286
+ }); // Upload files
287
+ // ---------------------------------------------------------------------------
288
+
289
+ $(document).on('click', '#place_order.wooccm-upload-process', function (e) {
290
+ e.preventDefault();
291
+ var $form = $('form.checkout'),
292
+ $place_order = $(this),
293
+ $fields = $('.wooccm-type-file');
294
+
295
+ if (!$fields.length) {
296
+ return;
297
+ }
298
+
299
+ if (!window.FormData) {
300
+ return;
301
+ }
302
+
303
+ if (!Object.keys(fileList).length) {
304
+ return;
305
+ }
306
+
307
+ if (!is_blocked($form)) {
308
+ $place_order.html(wooccm_upload.message.uploading);
309
+ block($form);
310
+ }
311
+
312
+ $.each(fileList, function (field_id, files) {
313
+ var $field = $('#' + field_id),
314
+ $attachment_ids = $field.find('.wooccm-file-field'),
315
+ data = new FormData();
316
+ $.each(files, function (file_id, file) {
317
+ if (file_id > wooccm_upload.limit.max_files) {
318
+ console.log('Exeeds max files limit of ' + wooccm_upload.limit.max_files);
319
+ return false;
320
+ }
321
+
322
+ if (file.size > wooccm_upload.limit.max_file_size) {
323
+ console.log('Exeeds max file size of ' + wooccm_upload.limit.max_files);
324
+ return true;
325
+ }
326
+
327
+ console.log('We\'re ready to upload ' + file.name);
328
+ data.append('wooccm_checkout_attachment_upload[]', file);
329
+ });
330
+ data.append('action', 'wooccm_checkout_attachment_upload');
331
+ data.append('nonce', wooccm_upload.nonce);
332
+ $.ajax({
333
+ async: false,
334
+ url: wooccm_upload.ajax_url,
335
+ type: 'POST',
336
+ cache: false,
337
+ data: data,
338
+ processData: false,
339
+ contentType: false,
340
+ beforeSend: function beforeSend(response) {//$place_order.html(wooccm_upload.message.uploading);
341
+ },
342
+ success: function success(response) {
343
+ if (response.success) {
344
+ $attachment_ids.val(response.data);
345
+ } else {
346
+ $('body').trigger('update_checkout');
347
+ }
348
+ },
349
+ complete: function complete(response) {}
350
+ });
351
+ });
352
+ unblock($form);
353
+ $place_order.removeClass('wooccm-upload-process').trigger('click');
354
+ }); // Update checkout fees
355
+ // ---------------------------------------------------------------------------
356
+
357
+ $(document).on('change', '.wooccm-add-price', function (e) {
358
+ $('body').trigger('update_checkout');
359
+ }); // Conditional
360
+ // ---------------------------------------------------------------------------
361
+
362
+ $('.wooccm-field').each(function (i, field) {
363
+ $(field).find('input,textarea,select').on('change keyup wooccm_change', function (e) {
364
+ var name = $(e.target).attr('name').replace('[]', ''),
365
+ type = $(e.target).prop('type'),
366
+ value = $(e.target).val();
367
+
368
+ if (type == 'checkbox') {
369
+ // fix for multicheckbox
370
+ if ($(e.target).attr('name').indexOf('[]') !== -1) {
371
+ value = $(e.target).closest('.wooccm-field').find('input:checked').map(function (i, e) {
372
+ return e.value;
373
+ }).toArray();
374
+ } else {
375
+ value = $(e.target).is(':checked');
376
+ }
377
+ }
378
+
379
+ $('*[data-conditional-parent=' + name + ']').closest('.wooccm-field').hide();
380
+ $('*[data-conditional-parent=' + name + ']').each(function (i, child) {
381
+ var $child = $(child),
382
+ condition = $child && $child.data('conditional-parent-value');
383
+ /* console.log('name', name);
384
+ console.log('value', value);
385
+ console.log('condition', condition); */
386
+
387
+ if (value == condition || $.isArray(value) && value.indexOf(condition) > -1) {
388
+ $child.closest('.wooccm-field').fadeIn();
389
+ }
390
+ });
391
+ });
392
+ });
393
+ $('.wooccm-conditional-child').each(function (i, field) {
394
+ var $field = $(field),
395
+ $parent = $('#' + $field.find('[data-conditional-parent]').data('conditional-parent') + '_field'); // dont use change event because trigger update_checkout event
396
+
397
+ $parent.find('select:first').trigger('wooccm_change');
398
+ $parent.find('textarea:first').trigger('wooccm_change');
399
+ $parent.find('input[type=button]:first').trigger('wooccm_change');
400
+ $parent.find('input[type=radio]:checked:first').trigger('wooccm_change');
401
+ $parent.find('input[type=checkbox]:checked:first').trigger('wooccm_change');
402
+ $parent.find('input[type=color]:first').trigger('wooccm_change');
403
+ $parent.find('input[type=date]:first').trigger('wooccm_change');
404
+ $parent.find('input[type=datetime-local]:first').trigger('wooccm_change');
405
+ $parent.find('input[type=email]:first').trigger('wooccm_change');
406
+ $parent.find('input[type=file]:first').trigger('wooccm_change');
407
+ $parent.find('input[type=hidden]:first').trigger('wooccm_change');
408
+ $parent.find('input[type=image]:first').trigger('wooccm_change');
409
+ $parent.find('input[type=month]:first').trigger('wooccm_change');
410
+ $parent.find('input[type=number]:first').trigger('wooccm_change');
411
+ $parent.find('input[type=password]:first').trigger('wooccm_change');
412
+ $parent.find('input[type=range]:first').trigger('wooccm_change');
413
+ $parent.find('input[type=reset]:first').trigger('wooccm_change');
414
+ $parent.find('input[type=search]:first').trigger('wooccm_change');
415
+ $parent.find('input[type=submit]:first').trigger('wooccm_change');
416
+ $parent.find('input[type=tel]:first').trigger('wooccm_change');
417
+ $parent.find('input[type=text]:first').trigger('wooccm_change');
418
+ $parent.find('input[type=time]:first').trigger('wooccm_change');
419
+ $parent.find('input[type=url]:first').trigger('wooccm_change');
420
+ $parent.find('input[type=week]:first').trigger('wooccm_change');
421
+ });
422
+ /*$('.wooccm-conditional-child-delete').each(function (i, field) {
423
+
424
+ var $field = $(field),
425
+ $parent = $('#' + $field.find('[data-conditional-parent]').data('conditional-parent') + '_field'),
426
+ show_if_value = $field.find('[data-conditional-parent-value]').length && $field.find('[data-conditional-parent-value]').data('conditional-parent-value').toString();
427
+
428
+ if ($parent.length) {
429
+
430
+ console.log($parent.find('select:first').length)
431
+
432
+ //console.log('#' + $field.find('[data-conditional-parent]').data('conditional-parent'));
433
+
434
+ $parent.on('wooccm_change change keyup', function (e) {
435
+
436
+ console.log('change', e.target)
437
+
438
+ var $this = $(e.target),
439
+ value = $this.val();
440
+ // fix for select2 search
441
+ if ($this.hasClass('select2-selection')) {
442
+ return;
443
+ }
444
+
445
+ //make sure its a single checkbox otherwise return value
446
+ if ($this.prop('type') == 'checkbox') {
447
+ // fix for multicheckbox
448
+ if ($this.attr('name').indexOf('[]') !== -1) {
449
+ value = $parent.find('input:checked').map(function (i, e) {
450
+ return e.value
451
+ }).toArray();
452
+ } else {
453
+ value = $this.is(':checked');
454
+ }
455
+ }
456
+
457
+ if (show_if_value == value || ($.isArray(value) && value.indexOf(show_if_value) > -1)) {
458
+ $field.fadeIn();
459
+ } else {
460
+ $field.fadeOut();
461
+ }
462
+
463
+ $this.off('wooccm_change');
464
+ $this.off('change');
465
+ $this.off('keyup');
466
+ $field.trigger('change');
467
+ });
468
+ // dont use change event because trigger update_checkout event
469
+ $parent.find('select:first').trigger('wooccm_change');
470
+ $parent.find('textarea:first').trigger('wooccm_change');
471
+ $parent.find('input[type=button]:first').trigger('wooccm_change');
472
+ $parent.find('input[type=radio]:checked:first').trigger('wooccm_change');
473
+ $parent.find('input[type=checkbox]:checked:first').trigger('wooccm_change');
474
+ $parent.find('input[type=color]:first').trigger('wooccm_change');
475
+ $parent.find('input[type=date]:first').trigger('wooccm_change');
476
+ $parent.find('input[type=datetime-local]:first').trigger('wooccm_change');
477
+ $parent.find('input[type=email]:first').trigger('wooccm_change');
478
+ $parent.find('input[type=file]:first').trigger('wooccm_change');
479
+ $parent.find('input[type=hidden]:first').trigger('wooccm_change');
480
+ $parent.find('input[type=image]:first').trigger('wooccm_change');
481
+ $parent.find('input[type=month]:first').trigger('wooccm_change');
482
+ $parent.find('input[type=number]:first').trigger('wooccm_change');
483
+ $parent.find('input[type=password]:first').trigger('wooccm_change');
484
+ $parent.find('input[type=range]:first').trigger('wooccm_change');
485
+ $parent.find('input[type=reset]:first').trigger('wooccm_change');
486
+ $parent.find('input[type=search]:first').trigger('wooccm_change');
487
+ $parent.find('input[type=submit]:first').trigger('wooccm_change');
488
+ $parent.find('input[type=tel]:first').trigger('wooccm_change');
489
+ $parent.find('input[type=text]:first').trigger('wooccm_change');
490
+ $parent.find('input[type=time]:first').trigger('wooccm_change');
491
+ $parent.find('input[type=url]:first').trigger('wooccm_change');
492
+ $parent.find('input[type=week]:first').trigger('wooccm_change');
493
+ } else {
494
+ $field.show();
495
+ }
496
+
497
+ });*/
498
+ // Datepicker fields
499
+ // ---------------------------------------------------------------------------
500
+
501
+ $('.wooccm-enhanced-datepicker').each(function (i, field) {
502
+ var $input = $(this),
503
+ disable = $input.data('disable') || false;
504
+
505
+ if ($.isFunction($.fn.datepicker)) {
506
+ $input.datepicker({
507
+ dateFormat: $input.data('formatdate') || 'dd-mm-yy',
508
+ minDate: $input.data('mindate'),
509
+ maxDate: $input.data('maxdate'),
510
+ beforeShowDay: function beforeShowDay(date) {
511
+ var day = date.getDay() != undefined && date.getDay().toString();
512
+
513
+ if (disable) {
514
+ return [$.inArray(day, disable) === -1];
515
+ }
516
+
517
+ return [true];
518
+ }
519
+ });
520
+ }
521
+ }); // Timepicker fields
522
+ // ---------------------------------------------------------------------------
523
+
524
+ $('.wooccm-enhanced-timepicker').each(function (i, field) {
525
+ var $input = $(this);
526
+
527
+ if ($.isFunction($.fn.timepicker)) {
528
+ console.log($input.data('format-ampm'));
529
+ $input.timepicker({
530
+ showPeriodLabels: !!$input.data('format-ampm'),
531
+ showPeriod: !!$input.data('format-ampm'),
532
+ showLeadingZero: true,
533
+ hours: $input.data('hours') || undefined,
534
+ minutes: $input.data('minutes') || undefined
535
+ /* hours: {
536
+ starts: 9, // First displayed hour
537
+ ends: 21 // Last displayed hour
538
+ },/*
539
+ minutes: {
540
+ starts: 5, // First displayed minute
541
+ ends: 55, // Last displayed minute
542
+ interval: 5, // Interval of displayed minutes
543
+ manual: [] // Optional extra entries for minutes
544
+ }, */
545
+
546
+ });
547
+ }
548
+ }); // Color fields
549
+ // ---------------------------------------------------------------------------
550
+
551
+ $('.wooccm-colorpicker-farbtastic').each(function (i, field) {
552
+ var $field = $(field),
553
+ $input = $field.find('input[type=text]'),
554
+ $container = $field.find('.wooccmcolorpicker_container');
555
+ $input.hide();
556
+
557
+ if ($.isFunction($.fn.farbtastic)) {
558
+ $container.farbtastic('#' + $input.attr('id'));
559
+ $container.on('click', function (e) {
560
+ $input.fadeIn();
561
+ });
562
+ }
563
+ });
564
+ $('.wooccm-colorpicker-iris').each(function (i, field) {
565
+ var $field = $(field),
566
+ $input = $field.find('input[type=text]');
567
+ $input.css('background', $input.val());
568
+ $input.on('click', function (e) {
569
+ $field.toggleClass('active');
570
+ });
571
+ $input.iris({
572
+ class: $input.attr('id'),
573
+ palettes: true,
574
+ color: '',
575
+ hide: false,
576
+ change: function change(event, ui) {
577
+ $input.css('background', ui.color.toString()).fadeIn();
578
+ }
579
+ });
580
+ });
581
+ $(document).on('click', function (e) {
582
+ if ($(e.target).closest('.iris-picker').length === 0) {
583
+ $('.wooccm-colorpicker-iris').removeClass('active');
584
+ }
585
+ });
586
+
587
+ if (typeof wc_country_select_params === 'undefined') {
588
+ return false;
589
+ }
590
+
591
+ if ($().selectWoo) {
592
+ var getEnhancedSelectFormatString = function getEnhancedSelectFormatString() {
593
+ return {
594
+ 'language': {
595
+ errorLoading: function errorLoading() {
596
+ return wc_country_select_params.i18n_searching;
597
+ },
598
+ inputTooLong: function inputTooLong(args) {
599
+ var overChars = args.input.length - args.maximum;
600
+
601
+ if (1 === overChars) {
602
+ return wc_country_select_params.i18n_input_too_long_1;
603
+ }
604
+
605
+ return wc_country_select_params.i18n_input_too_long_n.replace('%qty%', overChars);
606
+ },
607
+ inputTooShort: function inputTooShort(args) {
608
+ var remainingChars = args.minimum - args.input.length;
609
+
610
+ if (1 === remainingChars) {
611
+ return wc_country_select_params.i18n_input_too_short_1;
612
+ }
613
+
614
+ return wc_country_select_params.i18n_input_too_short_n.replace('%qty%', remainingChars);
615
+ },
616
+ loadingMore: function loadingMore() {
617
+ return wc_country_select_params.i18n_load_more;
618
+ },
619
+ maximumSelected: function maximumSelected(args) {
620
+ if (args.maximum === 1) {
621
+ return wc_country_select_params.i18n_selection_too_long_1;
622
+ }
623
+
624
+ return wc_country_select_params.i18n_selection_too_long_n.replace('%qty%', args.maximum);
625
+ },
626
+ noResults: function noResults() {
627
+ return wc_country_select_params.i18n_no_matches;
628
+ },
629
+ searching: function searching() {
630
+ return wc_country_select_params.i18n_searching;
631
+ }
632
+ }
633
+ };
634
+ };
635
+
636
+ var wooccm_enhanced_select = function wooccm_enhanced_select() {
637
+ $('select.wooccm-enhanced-select').each(function () {
638
+ var select2_args = $.extend({
639
+ width: '100%',
640
+ placeholder: $(this).data('placeholder') || '',
641
+ allowClear: $(this).data('allowclear') || false,
642
+ selectOnClose: $(this).data('selectonclose') || false,
643
+ closeOnSelect: $(this).data('closeonselect') || false,
644
+ //forceAbove: $(this).data('forceabove') || false,
645
+ minimumResultsForSearch: $(this).data('search') || -1
646
+ }, getEnhancedSelectFormatString());
647
+ $(this).on('select2:select', function () {
648
+ $(this).focus();
649
+ }).selectWoo(select2_args);
650
+ });
651
+ };
652
+
653
+ wooccm_enhanced_select();
654
+ }
655
+ })(jQuery);
656
+
657
+ /***/ }),
658
+
659
+ /***/ "./src/frontend/scss/style.scss":
660
+ /*!**************************************!*\
661
+ !*** ./src/frontend/scss/style.scss ***!
662
+ \**************************************/
663
+ /*! no static exports found */
664
+ /***/ (function(module, exports) {
665
+
666
+ // removed by extract-text-webpack-plugin
667
+
668
+ /***/ }),
669
+
670
+ /***/ "jquery":
671
+ /*!**********************************!*\
672
+ !*** external {"this":"jQuery"} ***!
673
+ \**********************************/
674
+ /*! no static exports found */
675
+ /***/ (function(module, exports) {
676
+
677
+ (function() { module.exports = this["jQuery"]; }());
678
+
679
+ /***/ }),
680
+
681
+ /***/ "selectWoo":
682
+ /*!************************************************!*\
683
+ !*** external {"this":["window","selectWoo"]} ***!
684
+ \************************************************/
685
+ /*! no static exports found */
686
+ /***/ (function(module, exports) {
687
+
688
+ (function() { module.exports = this["window"]["selectWoo"]; }());
689
+
690
+ /***/ })
691
+
692
+ /******/ });
693
+ //# sourceMappingURL=checkout.js.map
assets/frontend/js/order-upload.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('jquery'), 'version' => '21579d17fba223671216029a4af5bd89');
1
+ <?php return array('dependencies' => array('jquery'), 'version' => 'd4bc62353901c81b90b2f90db3aba8b3');
assets/frontend/js/order-upload.js CHANGED
@@ -1 +1,244 @@
1
- !function(e){var t={};function o(a){if(t[a])return t[a].exports;var c=t[a]={i:a,l:!1,exports:{}};return e[a].call(c.exports,c,c.exports,o),c.l=!0,c.exports}o.m=e,o.c=t,o.d=function(e,t,a){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(o.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)o.d(a,c,function(t){return e[t]}.bind(null,c));return a},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";o.r(t);o(1);jQuery(document).ready((function(e){e(document).on("click",".wooccm_delete_attachment",(function(t){var o=e(this).closest("tr"),a=e(this).data("attachment_id");o.hide(),e("#wooccm_order_attachment_update").prop("disabled",!1),e("#delete_attachments_ids").val(e("#delete_attachments_ids").val().replace(a,""))})),e(document).on("click","#wooccm_order_attachment_update",(function(t){e.ajax({url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:{action:"wooccm_order_attachment_update",nonce:wooccm_upload.nonce,delete_attachments_ids:e("#delete_attachments_ids").val(),all_attachments_ids:e("#all_attachments_ids").val()},beforeSend:function(t){e(".wooccm_upload_results").html(wooccm_upload.message.saving)},success:function(t){t.success?(e(".wooccm_upload_results").html(wooccm_upload.message.deleted),e("#wooccm_order_attachment_update").prop("disabled",!0)):e(".wooccm_upload_results").html(t.data)}})})),e(document).on("change","#wooccm_order_attachment_upload",(function(t){var o=!1,a=e(this).data("order_id");window.FormData&&(o=new FormData);for(var c,n=0,r=this.files.length;n<r;n++)c=this.files[n],o&&o.append("wooccm_order_attachment_upload[]",c);o&&(o.append("action","wooccm_order_attachment_upload"),o.append("nonce",wooccm_upload.nonce),o.append("order_id",a),e.ajax({url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:o,processData:!1,contentType:!1,beforeSend:function(t){var o;e(".wooccm_upload_results").html(wooccm_upload.message.uploading),function(e){return e.is(".processing")||e.parents(".processing").length}(o=e(".wooccm_order_attachments_wrapper"))||o.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},success:function(t){t.success?(e(".wooccm_order_attachments_wrapper").fadeOut(),e(".wooccm_order_attachments_wrapper").replaceWith(e(t.data).fadeIn()),e(".wooccm_upload_results").html(wooccm_upload.message.success)):e(".wooccm_upload_results").html(t.data),e(".wooccm_order_attachments_wrapper").removeClass("processing").unblock()}}))}))}))},function(e,t){!function(){e.exports=this.jQuery}()}]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = "./src/frontend/order-upload.js");
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ({
88
+
89
+ /***/ "./src/frontend/order-upload.js":
90
+ /*!**************************************!*\
91
+ !*** ./src/frontend/order-upload.js ***!
92
+ \**************************************/
93
+ /*! no exports provided */
94
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
95
+
96
+ "use strict";
97
+ __webpack_require__.r(__webpack_exports__);
98
+ /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
99
+ /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
100
+
101
+
102
+ (function ($) {
103
+ "use strict";
104
+
105
+ var is_blocked = function is_blocked($node) {
106
+ return $node.is('.processing') || $node.parents('.processing').length;
107
+ };
108
+
109
+ var block = function block($node) {
110
+ if (!is_blocked($node)) {
111
+ $node.addClass('processing').block({
112
+ message: null,
113
+ overlayCSS: {
114
+ background: '#fff',
115
+ opacity: 0.6
116
+ }
117
+ });
118
+ }
119
+ };
120
+
121
+ var unblock = function unblock($node) {
122
+ $node.removeClass('processing').unblock();
123
+ };
124
+
125
+ $(document).ready(function ($) {
126
+ // Delete
127
+ // -------------------------------------------------------------------------
128
+ $(document).on('click', '.wooccm_delete_attachment', function (e) {
129
+ var $tr = $(this).closest('tr'),
130
+ attachment_id = $(this).data('attachment_id');
131
+ $tr.hide();
132
+ $('#wooccm_order_attachment_update').prop('disabled', false);
133
+ $('#delete_attachments_ids').val($('#delete_attachments_ids').val().replace(attachment_id, ''));
134
+ });
135
+ $(document).on('click', '#wooccm_order_attachment_update', function (e) {
136
+ $.ajax({
137
+ url: wooccm_upload.ajax_url,
138
+ type: 'POST',
139
+ cache: false,
140
+ data: {
141
+ action: 'wooccm_order_attachment_update',
142
+ nonce: wooccm_upload.nonce,
143
+ delete_attachments_ids: $('#delete_attachments_ids').val(),
144
+ all_attachments_ids: $('#all_attachments_ids').val()
145
+ },
146
+ beforeSend: function beforeSend(response) {
147
+ $('.wooccm_upload_results').html(wooccm_upload.message.saving);
148
+ },
149
+ success: function success(response) {
150
+ if (response.success) {
151
+ $('.wooccm_upload_results').html(wooccm_upload.message.deleted);
152
+ $('#wooccm_order_attachment_update').prop('disabled', true);
153
+ } else {
154
+ $('.wooccm_upload_results').html(response.data);
155
+ }
156
+ }
157
+ });
158
+ }); // Upload
159
+ // -------------------------------------------------------------------------
160
+
161
+ $(document).on('change', '#wooccm_order_attachment_upload', function (e) {
162
+ var data = false,
163
+ order_id = $(this).data('order_id');
164
+
165
+ if (window.FormData) {
166
+ data = new FormData();
167
+ }
168
+
169
+ var i = 0,
170
+ len = this.files.length,
171
+ file;
172
+
173
+ for (; i < len; i++) {
174
+ file = this.files[i];
175
+
176
+ if (data) {
177
+ data.append('wooccm_order_attachment_upload[]', file);
178
+ }
179
+ }
180
+ /*
181
+ * filter file types
182
+ * var file_array = ' . wooccm_js_array($file_types) . ';
183
+ var wooempt = "' . implode(',', $file_types) . '";
184
+
185
+ for ( i = 0; i < length; i++ ) {
186
+ file = this.files[i];
187
+ for(x=0; x < ' . $number_of_types . '; x++){
188
+ if( !wooempt || file.type.match(file_array[x]) ) {
189
+ if (formdata) {
190
+ formdata.append("files_wooccm[]",file);
191
+ }
192
+ }
193
+ }
194
+ }
195
+ */
196
+
197
+
198
+ if (data) {
199
+ data.append('action', 'wooccm_order_attachment_upload');
200
+ data.append('nonce', wooccm_upload.nonce);
201
+ data.append('order_id', order_id);
202
+ $.ajax({
203
+ url: wooccm_upload.ajax_url,
204
+ type: 'POST',
205
+ cache: false,
206
+ data: data,
207
+ processData: false,
208
+ contentType: false,
209
+ beforeSend: function beforeSend(response) {
210
+ $('.wooccm_upload_results').html(wooccm_upload.message.uploading);
211
+ block($('.wooccm_order_attachments_wrapper'));
212
+ },
213
+ success: function success(response) {
214
+ if (response.success) {
215
+ $('.wooccm_order_attachments_wrapper').fadeOut();
216
+ $('.wooccm_order_attachments_wrapper').replaceWith($(response.data).fadeIn());
217
+ $('.wooccm_upload_results').html(wooccm_upload.message.success);
218
+ } else {
219
+ $('.wooccm_upload_results').html(response.data);
220
+ }
221
+
222
+ unblock($('.wooccm_order_attachments_wrapper'));
223
+ }
224
+ });
225
+ }
226
+ });
227
+ });
228
+ })(jQuery);
229
+
230
+ /***/ }),
231
+
232
+ /***/ "jquery":
233
+ /*!**********************************!*\
234
+ !*** external {"this":"jQuery"} ***!
235
+ \**********************************/
236
+ /*! no static exports found */
237
+ /***/ (function(module, exports) {
238
+
239
+ (function() { module.exports = this["jQuery"]; }());
240
+
241
+ /***/ })
242
+
243
+ /******/ });
244
+ //# sourceMappingURL=order-upload.js.map
includes/view/frontend/class-wooccm-fields-disable.php CHANGED
@@ -15,6 +15,9 @@ class WOOCCM_Fields_Display
15
  add_filter('wooccm_checkout_field_filter', array($this, 'disable_by_role'));
16
  // Fix country
17
  add_filter('wooccm_checkout_field_filter', array($this, 'fix_country'));
 
 
 
18
  }
19
 
20
  public static function instance()
@@ -38,6 +41,17 @@ class WOOCCM_Fields_Display
38
  return $field;
39
  }
40
 
 
 
 
 
 
 
 
 
 
 
 
41
  function disable_by_role($field)
42
  {
43
 
15
  add_filter('wooccm_checkout_field_filter', array($this, 'disable_by_role'));
16
  // Fix country
17
  add_filter('wooccm_checkout_field_filter', array($this, 'fix_country'));
18
+ // Fix email
19
+ // make sure guest users include their email in order to download products
20
+ add_filter('wooccm_checkout_field_filter', array($this, 'fix_email'));
21
  }
22
 
23
  public static function instance()
41
  return $field;
42
  }
43
 
44
+ function fix_email($field)
45
+ {
46
+
47
+ if ($field['type'] == 'email' && !is_user_logged_in()) {
48
+ $field['disabled'] = false;
49
+ $field['required'] = true;
50
+ }
51
+
52
+ return $field;
53
+ }
54
+
55
  function disable_by_role($field)
56
  {
57
 
includes/view/frontend/class-wooccm-fields-handler.php CHANGED
@@ -18,6 +18,9 @@ class WOOCCM_Fields_Handler
18
  // -----------------------------------------------------------------------
19
  add_filter('woocommerce_checkout_fields', array($this, 'remove_checkout_fields'));
20
 
 
 
 
21
  // Fix address_2 field
22
  // -----------------------------------------------------------------------
23
  //add_filter('default_option_woocommerce_checkout_address_2_field', array($this, 'woocommerce_checkout_address_2_field'));
@@ -279,6 +282,33 @@ class WOOCCM_Fields_Handler
279
 
280
  return $data;
281
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  }
283
 
284
  WOOCCM_Fields_Handler::instance();
18
  // -----------------------------------------------------------------------
19
  add_filter('woocommerce_checkout_fields', array($this, 'remove_checkout_fields'));
20
 
21
+ // Fix defualt address fields classes
22
+ add_filter('wooccm_checkout_field_filter', array($this, 'fix_address_fields_classes'));
23
+
24
  // Fix address_2 field
25
  // -----------------------------------------------------------------------
26
  //add_filter('default_option_woocommerce_checkout_address_2_field', array($this, 'woocommerce_checkout_address_2_field'));
282
 
283
  return $data;
284
  }
285
+
286
+ public function fix_address_fields_classes($field)
287
+ {
288
+
289
+ if (isset($field['key'])) {
290
+
291
+ $key = str_replace(array('shipping_', 'billing_'), '', $field['key']);
292
+
293
+ if (in_array($key, array(
294
+ 'country',
295
+ 'address_1',
296
+ 'address_2',
297
+ 'city',
298
+ 'state',
299
+ 'postcode',
300
+ ))) {
301
+
302
+ $field['class'][] = 'address-field';
303
+
304
+ if ($key == 'country') {
305
+ $field['class'][] = 'update_totals_on_change';
306
+ }
307
+ }
308
+ }
309
+
310
+ return $field;
311
+ }
312
  }
313
 
314
  WOOCCM_Fields_Handler::instance();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/
4
  Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
5
  Requires at least: 3.4
6
  Tested up to: 5.7
7
- Stable tag: 5.3.7
8
  WC requires at least: 3.1.0
9
  WC tested up to: 5.4
10
  License: GPLv3
@@ -107,6 +107,13 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
 
110
  = 5.3.7 =
111
  * Fix: shipping address forced label click disabled
112
 
4
  Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
5
  Requires at least: 3.4
6
  Tested up to: 5.7
7
+ Stable tag: 5.3.9
8
  WC requires at least: 3.1.0
9
  WC tested up to: 5.4
10
  License: GPLv3
107
 
108
  == Changelog ==
109
 
110
+ = 5.3.9 =
111
+ * Fix: address fields trigger shipping total change
112
+ * Fix: make sure guest users include their email in order to download products
113
+
114
+ = 5.3.8 =
115
+ * Fix: country label
116
+
117
  = 5.3.7 =
118
  * Fix: shipping address forced label click disabled
119
 
woocommerce-checkout-manager.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Checkout Manager for WooCommerce
5
  * Plugin URI: https://quadlayers.com/portfolio/woocommerce-checkout-manager/
6
  * Description: Manages WooCommerce Checkout, the advanced way.
7
- * Version: 5.3.7
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
4
  * Plugin Name: Checkout Manager for WooCommerce
5
  * Plugin URI: https://quadlayers.com/portfolio/woocommerce-checkout-manager/
6
  * Description: Manages WooCommerce Checkout, the advanced way.
7
+ * Version: 5.3.9
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3