Changeset 3669483
- Timestamp:
- 08/27/2026 08:30:44 PM (2 months ago)
- Location:
- simple-sales-tax
- Files:
-
- 64 edited
- 1 copied
-
tags/8.4.16 (copied) (copied from simple-sales-tax/trunk )
-
tags/8.4.16/assets/css/certificate-modal.css (modified) (1 diff)
-
tags/8.4.16/assets/css/certificate-modal.min.css (modified) (1 diff)
-
tags/8.4.16/assets/css/checkout.css (modified) (1 diff)
-
tags/8.4.16/assets/css/checkout.min.css (modified) (1 diff)
-
tags/8.4.16/assets/js/blocks/tax-exemption/block.js (modified) (4 diffs)
-
tags/8.4.16/assets/js/blocks/tax-exemption/style.scss (modified) (1 diff)
-
tags/8.4.16/assets/js/certificate-table.js (modified) (9 diffs)
-
tags/8.4.16/assets/js/certificate-table.min.js (modified) (1 diff)
-
tags/8.4.16/assets/js/tic-select.js (modified) (2 diffs)
-
tags/8.4.16/assets/js/tic-select.min.js (modified) (1 diff)
-
tags/8.4.16/build/style-tax-exemption-block-rtl.css (modified) (1 diff)
-
tags/8.4.16/build/style-tax-exemption-block.css (modified) (1 diff)
-
tags/8.4.16/build/tax-exemption-block-frontend.asset.php (modified) (1 diff)
-
tags/8.4.16/build/tax-exemption-block-frontend.js (modified) (1 diff)
-
tags/8.4.16/build/tax-exemption-block.asset.php (modified) (1 diff)
-
tags/8.4.16/build/tax-exemption-block.js (modified) (1 diff)
-
tags/8.4.16/changelog.txt (modified) (1 diff)
-
tags/8.4.16/includes/abstracts/class-sst-abstract-cart.php (modified) (2 diffs)
-
tags/8.4.16/includes/class-simplesalestax.php (modified) (1 diff)
-
tags/8.4.16/includes/class-sst-addresses.php (modified) (3 diffs)
-
tags/8.4.16/includes/class-sst-blocks-integration.php (modified) (1 diff)
-
tags/8.4.16/includes/class-sst-certificates.php (modified) (3 diffs)
-
tags/8.4.16/includes/frontend/class-sst-checkout.php (modified) (10 diffs)
-
tags/8.4.16/includes/frontend/views/html-checkout.php (modified) (2 diffs)
-
tags/8.4.16/includes/sst-functions.php (modified) (1 diff)
-
tags/8.4.16/includes/v3/Exemptions.php (modified) (2 diffs)
-
tags/8.4.16/includes/vendor/composer/installed.php (modified) (2 diffs)
-
tags/8.4.16/includes/views/html-certificate-list.php (modified) (6 diffs)
-
tags/8.4.16/includes/views/html-select-tic-modal.php (modified) (1 diff)
-
tags/8.4.16/languages/simple-sales-tax.pot (modified) (14 diffs)
-
tags/8.4.16/readme.txt (modified) (1 diff)
-
tags/8.4.16/simple-sales-tax.php (modified) (1 diff)
-
trunk/assets/css/certificate-modal.css (modified) (1 diff)
-
trunk/assets/css/certificate-modal.min.css (modified) (1 diff)
-
trunk/assets/css/checkout.css (modified) (1 diff)
-
trunk/assets/css/checkout.min.css (modified) (1 diff)
-
trunk/assets/js/blocks/tax-exemption/block.js (modified) (4 diffs)
-
trunk/assets/js/blocks/tax-exemption/style.scss (modified) (1 diff)
-
trunk/assets/js/certificate-table.js (modified) (9 diffs)
-
trunk/assets/js/certificate-table.min.js (modified) (1 diff)
-
trunk/assets/js/tic-select.js (modified) (2 diffs)
-
trunk/assets/js/tic-select.min.js (modified) (1 diff)
-
trunk/build/style-tax-exemption-block-rtl.css (modified) (1 diff)
-
trunk/build/style-tax-exemption-block.css (modified) (1 diff)
-
trunk/build/tax-exemption-block-frontend.asset.php (modified) (1 diff)
-
trunk/build/tax-exemption-block-frontend.js (modified) (1 diff)
-
trunk/build/tax-exemption-block.asset.php (modified) (1 diff)
-
trunk/build/tax-exemption-block.js (modified) (1 diff)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/includes/abstracts/class-sst-abstract-cart.php (modified) (2 diffs)
-
trunk/includes/class-simplesalestax.php (modified) (1 diff)
-
trunk/includes/class-sst-addresses.php (modified) (3 diffs)
-
trunk/includes/class-sst-blocks-integration.php (modified) (1 diff)
-
trunk/includes/class-sst-certificates.php (modified) (3 diffs)
-
trunk/includes/frontend/class-sst-checkout.php (modified) (10 diffs)
-
trunk/includes/frontend/views/html-checkout.php (modified) (2 diffs)
-
trunk/includes/sst-functions.php (modified) (1 diff)
-
trunk/includes/v3/Exemptions.php (modified) (2 diffs)
-
trunk/includes/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/includes/views/html-certificate-list.php (modified) (6 diffs)
-
trunk/includes/views/html-select-tic-modal.php (modified) (1 diff)
-
trunk/languages/simple-sales-tax.pot (modified) (14 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/simple-sales-tax.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
simple-sales-tax/tags/8.4.16/assets/css/certificate-modal.css
r3607416 r3669483 108 108 } 109 109 110 #sst-certificates th, 111 #sst-certificates td { 112 vertical-align: middle; 113 } 114 115 #sst-certificates .sst-certificate-select-column { 116 width: 32px; 117 text-align: center; 118 } 119 120 #sst-certificates strong, 121 #sst-certificates .sst-certificate-meta, 122 #sst-certificates code { 123 display: block; 124 } 125 126 #sst-certificates .sst-certificate-meta, 127 #sst-certificates code { 128 margin-top: 3px; 129 color: #646970; 130 font-size: 12px; 131 line-height: 1.35; 132 } 133 134 #sst-certificates code { 135 width: fit-content; 136 padding: 1px 5px; 137 border-radius: 3px; 138 background: #f0f0f1; 139 } 140 141 #sst-certificates .sst-certificate-table-message { 142 padding: 18px 12px; 143 color: #646970; 144 text-align: center; 145 } 146 147 #sst-certificates .sst-certificate-table-message .spinner { 148 float: none; 149 margin: 0 8px 0 0; 150 vertical-align: middle; 151 visibility: visible; 152 } 153 154 .sst-certificate-table-footer, 155 .sst-certificate-table-actions, 156 .sst-certificate-table-pagination { 157 display: flex; 158 flex-wrap: wrap; 159 align-items: center; 160 gap: 8px; 161 } 162 163 .sst-certificate-table-footer { 164 justify-content: space-between; 165 } 166 167 .sst-certificate-table-pagination { 168 color: #646970; 169 font-size: 12px; 170 } 171 172 .sst-certificate-table-pagination[hidden] { 173 display: none; 174 } 175 176 @media screen and (max-width: 782px) { 177 #sst-certificates thead { 178 display: none; 179 } 180 181 #sst-certificates tbody tr, 182 #sst-certificates tbody td { 183 display: block; 184 width: auto; 185 } 186 187 #sst-certificates tbody tr { 188 padding: 10px 12px; 189 border-bottom: 1px solid #dcdcde; 190 } 191 192 #sst-certificates tbody td { 193 padding: 7px 0; 194 border: 0; 195 } 196 197 #sst-certificates tbody td::before { 198 display: block; 199 margin-bottom: 3px; 200 color: #646970; 201 content: attr(data-title); 202 font-size: 11px; 203 font-weight: 600; 204 text-transform: uppercase; 205 } 206 207 #sst-certificates .sst-certificate-select-column { 208 text-align: left; 209 } 210 } 211 110 212 .select2-container.select2-container--open, 111 213 .sst-select2-dropdown { -
simple-sales-tax/tags/8.4.16/assets/css/certificate-modal.min.css
r3607416 r3669483 1 .wc-backbone-modal .wc-backbone-modal-content.sst-certificate-modal-content{width:800px}.sst-select-tic-modal-content .wc-backbone-modal-main,.sst-view-certificate-modal-content .wc-backbone-modal-main{padding-bottom:0}.sst-certificate{background:top left no-repeat;background-image:url('../img/exemption_certificate750x600.png');clear:both;width:750px;height:600px;margin-bottom:15px;margin-left:auto;margin-right:auto;position:relative}.sst-certificate--single{background-image:url('../img/sp_exemption_certificate750x600.png')}.sst-certificate span{position:absolute;text-align:center;height:20px;line-height:20px;font-size:16px;font-weight:700;color:#000}.sst-certificate span#PurchaserName{top:205px;left:405px;width:222px}.sst-certificate span#PurchaserAddress{top:227px;left:190px;width:445px}.sst-certificate span#PurchaserState{top:296px;left:215px;width:245px}.sst-certificate span#PurchaserExemptionReason{top:318px;left:180px;width:480px}.sst-certificate span#Date{top:378px;left:445px;width:235px}.sst-certificate span#TaxType{top:407px;left:445px;width:235px}.sst-certificate span#IDNumber{top:436px;left:445px;width:235px}.sst-certificate span#PurchaserBusinessType{top:465px;left:445px;width:235px}.sst-certificate span#MerchantName{top:495px;left:445px;width:235px}.sst-certificate span#OrderID{top:353px;left:445px;width:235px}span.table-action-sep,table a.sst-certificate-delete,table a.sst-certificate-view{display:inline-block;vertical-align:middle}span.table-action-sep{margin:0 3px} .select2-container.select2-container--open,.sst-select2-dropdown{z-index:100002!important}1 .wc-backbone-modal .wc-backbone-modal-content.sst-certificate-modal-content{width:800px}.sst-select-tic-modal-content .wc-backbone-modal-main,.sst-view-certificate-modal-content .wc-backbone-modal-main{padding-bottom:0}.sst-certificate{background:top left no-repeat;background-image:url('../img/exemption_certificate750x600.png');clear:both;width:750px;height:600px;margin-bottom:15px;margin-left:auto;margin-right:auto;position:relative}.sst-certificate--single{background-image:url('../img/sp_exemption_certificate750x600.png')}.sst-certificate span{position:absolute;text-align:center;height:20px;line-height:20px;font-size:16px;font-weight:700;color:#000}.sst-certificate span#PurchaserName{top:205px;left:405px;width:222px}.sst-certificate span#PurchaserAddress{top:227px;left:190px;width:445px}.sst-certificate span#PurchaserState{top:296px;left:215px;width:245px}.sst-certificate span#PurchaserExemptionReason{top:318px;left:180px;width:480px}.sst-certificate span#Date{top:378px;left:445px;width:235px}.sst-certificate span#TaxType{top:407px;left:445px;width:235px}.sst-certificate span#IDNumber{top:436px;left:445px;width:235px}.sst-certificate span#PurchaserBusinessType{top:465px;left:445px;width:235px}.sst-certificate span#MerchantName{top:495px;left:445px;width:235px}.sst-certificate span#OrderID{top:353px;left:445px;width:235px}span.table-action-sep,table a.sst-certificate-delete,table a.sst-certificate-view{display:inline-block;vertical-align:middle}span.table-action-sep{margin:0 3px}#sst-certificates td,#sst-certificates th{vertical-align:middle}#sst-certificates .sst-certificate-select-column{width:32px;text-align:center}#sst-certificates .sst-certificate-meta,#sst-certificates code,#sst-certificates strong{display:block}#sst-certificates .sst-certificate-meta,#sst-certificates code{margin-top:3px;color:#646970;font-size:12px;line-height:1.35}#sst-certificates code{width:fit-content;padding:1px 5px;border-radius:3px;background:#f0f0f1}#sst-certificates .sst-certificate-table-message{padding:18px 12px;color:#646970;text-align:center}#sst-certificates .sst-certificate-table-message .spinner{float:none;margin:0 8px 0 0;vertical-align:middle;visibility:visible}.sst-certificate-table-actions,.sst-certificate-table-footer,.sst-certificate-table-pagination{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.sst-certificate-table-footer{justify-content:space-between}.sst-certificate-table-pagination{color:#646970;font-size:12px}.sst-certificate-table-pagination[hidden]{display:none}@media screen and (max-width:782px){#sst-certificates thead{display:none}#sst-certificates tbody td,#sst-certificates tbody tr{display:block;width:auto}#sst-certificates tbody tr{padding:10px 12px;border-bottom:1px solid #dcdcde}#sst-certificates tbody td{padding:7px 0;border:0}#sst-certificates tbody td::before{display:block;margin-bottom:3px;color:#646970;content:attr(data-title);font-size:11px;font-weight:600;text-transform:uppercase}#sst-certificates .sst-certificate-select-column{text-align:left}}.select2-container.select2-container--open,.sst-select2-dropdown{z-index:100002!important} -
simple-sales-tax/tags/8.4.16/assets/css/checkout.css
r2970922 r3669483 2 2 border-bottom: 1px solid #aaa; 3 3 } 4 5 .sst-certificate-selection-help { 6 margin-top: -0.5em; 7 color: #646970; 8 font-size: 0.875em; 9 line-height: 1.45; 10 } -
simple-sales-tax/tags/8.4.16/assets/css/checkout.min.css
r2970922 r3669483 1 #select2-certificate_id-results li:first-of-type:not(:last-of-type){border-bottom:1px solid #aaa} 1 #select2-certificate_id-results li:first-of-type:not(:last-of-type){border-bottom:1px solid #aaa}.sst-certificate-selection-help{margin-top:-.5em;color:#646970;font-size:.875em;line-height:1.45} -
simple-sales-tax/tags/8.4.16/assets/js/blocks/tax-exemption/block.js
r3151104 r3669483 32 32 33 33 const Block = ( { className, children } ) => { 34 if ( !showExemptionForm) {34 if ( ! showExemptionForm ) { 35 35 return null; 36 36 } … … 43 43 const { __internalIncrementCalculating, __internalDecrementCalculating } = 44 44 useDispatch( CHECKOUT_STORE_KEY ); 45 let selectionHelp = __( 46 'No exemption certificate will be applied to this order.', 47 'simple-sales-tax' 48 ); 49 50 if ( certificateId === 'new' ) { 51 selectionHelp = __( 52 'Complete the certificate details below to apply it to this order.', 53 'simple-sales-tax' 54 ); 55 } else if ( certificateId ) { 56 selectionHelp = __( 57 'This certificate will be applied to this order. Certificates are ordered newest first.', 58 'simple-sales-tax' 59 ); 60 } 45 61 46 62 const onChangeCertificate = ( value ) => { … … 82 98 id="exemption-certificate-input" 83 99 label={ __( 84 ' Exemption certificate',100 'Certificate to apply', 85 101 'simple-sales-tax' 86 102 ) } … … 89 105 value={ certificateId } 90 106 /> 107 <p className="sst-certificate-selection-help"> 108 { selectionHelp } 109 </p> 91 110 <a href={ myAccountEndpointUrl } target="_blank"> 92 111 { __( -
simple-sales-tax/tags/8.4.16/assets/js/blocks/tax-exemption/style.scss
r3151104 r3669483 8 8 .wc-block-components-text-input { 9 9 margin-top: 1em; 10 } 11 12 .sst-certificate-selection-help { 13 margin: 0.5em 0 0; 14 color: #5f6368; 15 font-size: 0.875em; 16 line-height: 1.45; 10 17 } 11 18 -
simple-sales-tax/tags/8.4.16/assets/js/certificate-table.js
r3655406 r3669483 4 4 var $blank_template = wp.template( 'sst-certificate-row-blank' ); 5 5 var $loading_template = wp.template( 'sst-certificate-row-loading' ); 6 var pageSize = 20; 6 7 7 8 // Backbone model … … 17 18 fetchOnLoad: false, 18 19 isLoading: false, 20 visibleCount: pageSize, 19 21 initialize: function( options ) { 20 22 this.userId = options.user_id ? +options.user_id : 0; … … 22 24 this.fetchOnLoad = !! options.fetch_on_load; 23 25 this.isLoading = false; 24 25 this.listenTo( this.model, 'change:certificates', this.render ); 26 this.visibleCount = pageSize; 27 this.$table = this.$el.closest( 'table' ); 28 29 this.listenTo( this.model, 'change:certificates', this.resetAndRender ); 26 30 this.listenTo( this.model, 'change:selected', this.fireChangeHook ); 27 31 … … 40 44 ); 41 45 46 this.$table.on( 47 'click', 48 '.sst-certificate-show-more', 49 { view: this }, 50 this.onShowMore 51 ); 52 42 53 if ( this.fetchOnLoad ) { 43 54 this.fetchCertificates(); 44 55 } 56 }, 57 resetAndRender: function() { 58 this.visibleCount = pageSize; 59 this.render(); 45 60 }, 46 61 render: function() { 47 62 if ( this.isLoading ) { 48 63 this.$el.empty(); 64 this.updateTableStatus( 0 ); 49 65 if ( typeof $loading_template === 'function' ) { 50 66 this.$el.append( $loading_template() ); … … 53 69 } 54 70 55 var certificates = _. indexBy( this.model.get( 'certificates' ), 'CertificateID'),71 var certificates = _.values( this.model.get( 'certificates' ) ), 56 72 selected = this.model.get( 'selected' ), 57 view = this, 58 index = 1; 73 view = this; 59 74 60 75 // Blank out the contents. 61 76 this.$el.empty(); 62 77 63 if ( _.size( certificates )) {78 if ( certificates.length ) { 64 79 // Populate $tbody with the current certificates 65 $.each( certificates, function( id, rowData ) { 66 rowData.Index = index++; 80 $.each( certificates.slice( 0, this.visibleCount ), function( index, rowData ) { 67 81 view.$el.append( $row_template( rowData ) ); 68 82 } ); 83 this.updateTableStatus( certificates.length ); 69 84 70 85 // Make the rows function … … 75 90 // Select certificate (first certificate selected by default) 76 91 if ( selected ) { 77 $( 'input[name="certificate_id"][value="' + selected + '"]' ).prop( 'checked', true );92 view.$el.find( 'input[name="certificate_id"][value="' + selected + '"]' ).prop( 'checked', true ); 78 93 } else { 79 var first = $( 'input[name="certificate_id"]' ).first();80 if ( first ) {94 var first = view.$el.find( 'input[name="certificate_id"]' ).first(); 95 if ( first.length ) { 81 96 first.prop( 'checked', true ); 82 97 this.model.set( 'selected', first.val() ); … … 84 99 } 85 100 } else { 101 this.updateTableStatus( 0 ); 86 102 view.$el.append( $blank_template ); 87 103 } 104 }, 105 updateTableStatus: function( total ) { 106 var $pagination = this.$table.find( '.sst-certificate-table-pagination' ); 107 108 if ( ! total ) { 109 $pagination.prop( 'hidden', true ); 110 return; 111 } 112 113 var shown = Math.min( this.visibleCount, total ); 114 var countText = script_data.strings.showing_certificates || 'Showing %1$d of %2$d certificates'; 115 countText = countText.replace( '%1$d', shown ).replace( '%2$d', total ); 116 117 $pagination.prop( 'hidden', false ); 118 $pagination.find( '.sst-certificate-count' ).text( countText ); 119 $pagination.find( '.sst-certificate-show-more' ).toggle( shown < total ); 120 }, 121 onShowMore: function( event ) { 122 event.preventDefault(); 123 124 var view = event.data.view; 125 view.visibleCount += pageSize; 126 view.render(); 88 127 }, 89 128 fetchCertificates: function() { … … 171 210 172 211 view.model.set( 'certificates', response.data.certificates ); 173 view.model.trigger( 'change:certificates' );174 212 } ) 175 213 .fail( function() { … … 285 323 view.model.set( 'selected', response.data.certificate_id ); 286 324 view.model.set( 'certificates', response.data.certificates ); 287 view.model.trigger( 'change:certificates' );288 325 } ) 289 326 .fail( function( jqXHR ) { -
simple-sales-tax/tags/8.4.16/assets/js/certificate-table.min.js
r3655406 r3669483 1 jQuery(function( c){var n=window.SST_Certificate_Table_Data||{strings:{},certificates:{},user_id:0},a=wp.template("sst-certificate-row"),d=wp.template("sst-certificate-row-blank"),r=wp.template("sst-certificate-row-loading"),e=Backbone.Model.extend({certificates:{},selected:""}),t=Backbone.View.extend({userId:0,addressFields:{},fetchOnLoad:!1,isLoading:!1,initialize:function(e){this.userId=e.user_id?+e.user_id:0,this.addressFields=e.address_fields||{},this.fetchOnLoad=!!e.fetch_on_load,this.isLoading=!1,this.listenTo(this.model,"change:certificates",this.render),this.listenTo(this.model,"change:selected",this.fireChangeHook),c(document.body).on("click",".sst-certificate-add",{view:this},this.onAddCertificate),c(document.body).on("click",".sst-certificate-refresh",{view:this},this.onRefreshCertificates),this.fetchOnLoad&&this.fetchCertificates()},render:function(){var e,i,s,t;this.isLoading?(this.$el.empty(),"function"==typeof r&&this.$el.append(r())):(t=_.indexBy(this.model.get("certificates"),"CertificateID"),e=this.model.get("selected"),s=1,(i=this).$el.empty(),_.size(t)?(c.each(t,function(e,t){t.Index=s++,i.$el.append(a(t))}),i.$el.find(".sst-certificate-delete").on("click",{view:this},this.onDeleteRow),i.$el.find(".sst-certificate-view").on("click",{view:this},this.onViewCertificate),i.$el.find('input[name="certificate_id"]').on("change",this.updateSelected.bind(this)),e?c('input[name="certificate_id"][value="'+e+'"]').prop("checked",!0):(t=c('input[name="certificate_id"]').first())&&(t.prop("checked",!0),this.model.set("selected",t.val()))):i.$el.append(d))},fetchCertificates:function(){var t=this,e=(t.isLoading=!0,t.render(),{nonce:n.get_certificates_nonce});t.userId&&(e.customerId=t.userId,e.user_id=t.userId),c.post(n.ajaxurl+"?action=sst_get_certificates",e).then(function(e){t.isLoading=!1,e.success&&e.data?t.model.set("certificates",e.data):t.render()}).fail(function(){t.isLoading=!1,t.render()})},fireChangeHook:function(){var e=this.model.get("selected");wp.hooks.doAction("sst_certificate_changed",e)},block:function(){c(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){c(this.el).unblock()},updateSelected:function(e){this.model.set("selected",c(e.target).val())},onDeleteRow:function(e){var t=e.data.view,i=t.model,s=(_.indexBy(i.get("certificates"),"CertificateID"),t.model.get("selected")),a=c(this).closest("tr").data("id");e.preventDefault(),confirm(n.strings.delete_certificate)&&(t.block(),i={nonce:n.delete_certificate_nonce,certificate_id:a},t.userId&&(i.user_id=t.userId),c.post(n.ajaxurl+"?action=sst_delete_certificate",i).then(function(e){if(!e.success)throw new Error(e.data);s==a&&t.model.set("selected",""),t.model.set("certificates",e.data.certificates),t.model.trigger("change:certificates")}).fail(function(){alert(n.strings.delete_failed)}).always(function(){t.unblock()}))},onViewCertificate:function(e){var t=e.data.view.model,t=_.indexBy(t.get("certificates"),"CertificateID")[c(this).closest("tr").data("id")];e.preventDefault(),t&&c(this).SSTBackboneModal({template:"sst-modal-view-certificate",variable:t})},onAddCertificate:function(e){e.preventDefault();e=e.data.view;SST_Add_Certificate_Modal.open({address:e.getBillingAddress(),onAddCertificate:e.addCertificateHandler.bind(e)})},onRefreshCertificates:function(e){var t=e.data.view,e=(e.preventDefault(),t.block(),{nonce:n.refresh_certificates_nonce});t.userId&&(e.user_id=t.userId),c.post(n.ajaxurl+"?action=sst_refresh_certificates",e).then(function(e){if(!e.success)throw new Error(e.data);e.data&&e.data.certificates?t.model.set("certificates",e.data.certificates):window.location.reload()}).fail(function(){alert(n.strings.refresh_failed||"Failed to refresh certificates")}).always(function(){t.unblock()})},getBillingAddress:function(){var e,t,i=n.billing_address,s=this.addressFields;for(e in i)i.hasOwnProperty(e)&&e in s&&(t=s[e],(t=c('[name="'+t+'"]')).length&&(i[e]=t.val()));return i},addCertificateHandler:function(e){var t=this,e=(t.block(),{nonce:SST_Add_Certificate_Data.nonce,address:t.getBillingAddress(),...e});t.userId&&(e.user_id=t.userId),c.post(n.ajaxurl+"?action=sst_add_certificate",e).then(function(e){e.success?(t.model.set("selected",e.data.certificate_id),t.model.set("certificates",e.data.certificates),t.model.trigger("change:certificates")):(e=e.data?n.strings.add_failed+": "+e.data:n.strings.add_failed,alert(e))}).fail(function(e){var t=n.strings.add_failed;e.responseJSON&&e.responseJSON.data?t+=": "+e.responseJSON.data:e.responseText&&(t+=": "+e.responseText),alert(t)}).always(function(){t.unblock()})}});var i={user_id:n.user_id,certificates:n.certificates,fetch_on_load:n.fetch_on_load};i=i||{};var s,o={selector:"#sst-certificates",address_fields:{first_name:"billing_first_name",last_name:"billing_last_name",address_1:"billing_address_1",address_2:"billing_address_2",country:"billing_country",city:"billing_city",state:"billing_state",postcode:"billing_postcode"},certificates:{},selected:"",user_id:0,fetch_on_load:!1};for(s in o)o.hasOwnProperty(s)&&!i.hasOwnProperty(s)&&(i[s]=o[s]);i.model=new e({certificates:i.certificates,selected:i.selected}),i.el=c(i.selector).find("tbody"),new t(i).render()});1 jQuery(function(n){var c=window.SST_Certificate_Table_Data||{strings:{},certificates:{},user_id:0},s=wp.template("sst-certificate-row"),a=wp.template("sst-certificate-row-blank"),d=wp.template("sst-certificate-row-loading"),e=Backbone.Model.extend({certificates:{},selected:""}),t=Backbone.View.extend({userId:0,addressFields:{},fetchOnLoad:!1,isLoading:!1,visibleCount:20,initialize:function(e){this.userId=e.user_id?+e.user_id:0,this.addressFields=e.address_fields||{},this.fetchOnLoad=!!e.fetch_on_load,this.isLoading=!1,this.visibleCount=20,this.$table=this.$el.closest("table"),this.listenTo(this.model,"change:certificates",this.resetAndRender),this.listenTo(this.model,"change:selected",this.fireChangeHook),n(document.body).on("click",".sst-certificate-add",{view:this},this.onAddCertificate),n(document.body).on("click",".sst-certificate-refresh",{view:this},this.onRefreshCertificates),this.$table.on("click",".sst-certificate-show-more",{view:this},this.onShowMore),this.fetchOnLoad&&this.fetchCertificates()},resetAndRender:function(){this.visibleCount=20,this.render()},render:function(){var e,i,t;this.isLoading?(this.$el.empty(),this.updateTableStatus(0),"function"==typeof d&&this.$el.append(d())):(t=_.values(this.model.get("certificates")),e=this.model.get("selected"),(i=this).$el.empty(),t.length?(n.each(t.slice(0,this.visibleCount),function(e,t){i.$el.append(s(t))}),this.updateTableStatus(t.length),i.$el.find(".sst-certificate-delete").on("click",{view:this},this.onDeleteRow),i.$el.find(".sst-certificate-view").on("click",{view:this},this.onViewCertificate),i.$el.find('input[name="certificate_id"]').on("change",this.updateSelected.bind(this)),e?i.$el.find('input[name="certificate_id"][value="'+e+'"]').prop("checked",!0):(t=i.$el.find('input[name="certificate_id"]').first()).length&&(t.prop("checked",!0),this.model.set("selected",t.val()))):(this.updateTableStatus(0),i.$el.append(a)))},updateTableStatus:function(e){var t,i,s=this.$table.find(".sst-certificate-table-pagination");e?(t=Math.min(this.visibleCount,e),i=(i=c.strings.showing_certificates||"Showing %1$d of %2$d certificates").replace("%1$d",t).replace("%2$d",e),s.prop("hidden",!1),s.find(".sst-certificate-count").text(i),s.find(".sst-certificate-show-more").toggle(t<e)):s.prop("hidden",!0)},onShowMore:function(e){e.preventDefault();e=e.data.view;e.visibleCount+=20,e.render()},fetchCertificates:function(){var t=this,e=(t.isLoading=!0,t.render(),{nonce:c.get_certificates_nonce});t.userId&&(e.customerId=t.userId,e.user_id=t.userId),n.post(c.ajaxurl+"?action=sst_get_certificates",e).then(function(e){t.isLoading=!1,e.success&&e.data?t.model.set("certificates",e.data):t.render()}).fail(function(){t.isLoading=!1,t.render()})},fireChangeHook:function(){var e=this.model.get("selected");wp.hooks.doAction("sst_certificate_changed",e)},block:function(){n(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){n(this.el).unblock()},updateSelected:function(e){this.model.set("selected",n(e.target).val())},onDeleteRow:function(e){var t=e.data.view,i=t.model,s=(_.indexBy(i.get("certificates"),"CertificateID"),t.model.get("selected")),a=n(this).closest("tr").data("id");e.preventDefault(),confirm(c.strings.delete_certificate)&&(t.block(),i={nonce:c.delete_certificate_nonce,certificate_id:a},t.userId&&(i.user_id=t.userId),n.post(c.ajaxurl+"?action=sst_delete_certificate",i).then(function(e){if(!e.success)throw new Error(e.data);s==a&&t.model.set("selected",""),t.model.set("certificates",e.data.certificates)}).fail(function(){alert(c.strings.delete_failed)}).always(function(){t.unblock()}))},onViewCertificate:function(e){var t=e.data.view.model,t=_.indexBy(t.get("certificates"),"CertificateID")[n(this).closest("tr").data("id")];e.preventDefault(),t&&n(this).SSTBackboneModal({template:"sst-modal-view-certificate",variable:t})},onAddCertificate:function(e){e.preventDefault();e=e.data.view;SST_Add_Certificate_Modal.open({address:e.getBillingAddress(),onAddCertificate:e.addCertificateHandler.bind(e)})},onRefreshCertificates:function(e){var t=e.data.view,e=(e.preventDefault(),t.block(),{nonce:c.refresh_certificates_nonce});t.userId&&(e.user_id=t.userId),n.post(c.ajaxurl+"?action=sst_refresh_certificates",e).then(function(e){if(!e.success)throw new Error(e.data);e.data&&e.data.certificates?t.model.set("certificates",e.data.certificates):window.location.reload()}).fail(function(){alert(c.strings.refresh_failed||"Failed to refresh certificates")}).always(function(){t.unblock()})},getBillingAddress:function(){var e,t,i=c.billing_address,s=this.addressFields;for(e in i)i.hasOwnProperty(e)&&e in s&&(t=s[e],(t=n('[name="'+t+'"]')).length&&(i[e]=t.val()));return i},addCertificateHandler:function(e){var t=this,e=(t.block(),{nonce:SST_Add_Certificate_Data.nonce,address:t.getBillingAddress(),...e});t.userId&&(e.user_id=t.userId),n.post(c.ajaxurl+"?action=sst_add_certificate",e).then(function(e){e.success?(t.model.set("selected",e.data.certificate_id),t.model.set("certificates",e.data.certificates)):(e=e.data?c.strings.add_failed+": "+e.data:c.strings.add_failed,alert(e))}).fail(function(e){var t=c.strings.add_failed;e.responseJSON&&e.responseJSON.data?t+=": "+e.responseJSON.data:e.responseText&&(t+=": "+e.responseText),alert(t)}).always(function(){t.unblock()})}});var i={user_id:c.user_id,certificates:c.certificates,fetch_on_load:c.fetch_on_load};i=i||{};var r,o={selector:"#sst-certificates",address_fields:{first_name:"billing_first_name",last_name:"billing_last_name",address_1:"billing_address_1",address_2:"billing_address_2",country:"billing_country",city:"billing_city",state:"billing_state",postcode:"billing_postcode"},certificates:{},selected:"",user_id:0,fetch_on_load:!1};for(r in o)o.hasOwnProperty(r)&&!i.hasOwnProperty(r)&&(i[r]=o[r]);i.model=new e({certificates:i.certificates,selected:i.selected}),i.el=n(i.selector).find("tbody"),new t(i).render()}); -
simple-sales-tax/tags/8.4.16/assets/js/tic-select.js
r2766600 r3669483 52 52 }, 53 53 updateSelection: function( event ) { 54 event.preventDefault(); 54 55 var $target = $( event.target ), 55 56 $tr = $target.closest( 'tr' ); … … 70 71 var tic_id = this.input.val(); 71 72 72 if ( '' == tic_id ) {73 if ( '' == tic_id || undefined === tic_id ) { 73 74 this.readout.text( this.readout.data( 'default' ) ); 74 75 } else { 75 var tic = data.tic_list[ parseInt( tic_id ) ]; 76 this.readout.text( tic['description'] + ' (' + tic['id'] + ')' ); 76 var tic = data.tic_list ? data.tic_list[ parseInt( tic_id ) ] : null; 77 if ( tic && tic['description'] ) { 78 this.readout.text( tic['description'] + ' (' + tic['id'] + ')' ); 79 } else { 80 this.readout.text( this.readout.data( 'default' ) || ( 'TIC ' + tic_id ) ); 81 } 77 82 } 78 83 }, -
simple-sales-tax/tags/8.4.16/assets/js/tic-select.min.js
r2490188 r3669483 1 !function(s, c){s(function(){var t=wp.template("sst-tic-row"),e=Backbone.View.extend({rowTemplate:t,input:null,readout:null,initialize:function(){this.input=this.$el.siblings(".sst-tic-input"),this.readout=this.$el.siblings(".sst-selected-tic"),this.handleInputChange=this.handleInputChange.bind(this),this.$el.on("click",{view:this},this.openModal),this.input.on("change",this.handleInputChange)},render:function(){this.selectTIC(this.input.val())},bindEvents:function(){s(document.body).on("click",".sst-select-done",{view:this},this.updateSelection),s(document.body).on("wc_backbone_modal_response",{view:this},this.completeSelection)},unbindEvents:function(){s(document.body).off("click",".sst-select-done",this.updateSelection),s(document.body).off("wc_backbone_modal_response",this.completeSelection)},openModal:function(t){var e=t.data.view;t.preventDefault(),s(this).SSTBackboneModal({template:"sst-tic-select-modal"}),e.bindEvents(),e.initModal()},initModal:function(t){var i=this,n=s(".sst-tic-list");n.empty(),_.each(c.tic_list,function(t,e){n.append(i.rowTemplate(t))}),s(".sst-tic-search").hideseek()},updateSelection:function(t){t=s(t.target).closest("tr");s('input[name="tic"]').val(t.data("id")),s("#btn-ok").trigger("click")},completeSelection:function(t,e,i){"sst-tic-select-modal"===e&&(t.data.view.selectTIC(i.tic),t.data.view.unbindEvents())},selectTIC:function(t){this.input.val(t).trigger("change")},handleInputChange:function(){var t=this.input.val();""==t?this.readout.text(this.readout.data("default")):(t=c.tic_list[parseInt(t)],this.readout.text(t.description+" ("+t.id+")"))},remove:function(){Backbone.View.prototype.remove.call(this),this.input.off("change")}});function i(){s(".sst-select-tic:not(.initialized)").each(function(){new e({el:s(this)}).render(),s(this).addClass("initialized")})}i(),s(document.body).on(c.tic_select_init_events,i)})}(jQuery,ticSelectLocalizeScript);1 !function(s,o){s(function(){var t=wp.template("sst-tic-row"),e=Backbone.View.extend({rowTemplate:t,input:null,readout:null,initialize:function(){this.input=this.$el.siblings(".sst-tic-input"),this.readout=this.$el.siblings(".sst-selected-tic"),this.handleInputChange=this.handleInputChange.bind(this),this.$el.on("click",{view:this},this.openModal),this.input.on("change",this.handleInputChange)},render:function(){this.selectTIC(this.input.val())},bindEvents:function(){s(document.body).on("click",".sst-select-done",{view:this},this.updateSelection),s(document.body).on("wc_backbone_modal_response",{view:this},this.completeSelection)},unbindEvents:function(){s(document.body).off("click",".sst-select-done",this.updateSelection),s(document.body).off("wc_backbone_modal_response",this.completeSelection)},openModal:function(t){var e=t.data.view;t.preventDefault(),s(this).SSTBackboneModal({template:"sst-tic-select-modal"}),e.bindEvents(),e.initModal()},initModal:function(t){var i=this,n=s(".sst-tic-list");n.empty(),_.each(o.tic_list,function(t,e){n.append(i.rowTemplate(t))}),s(".sst-tic-search").hideseek()},updateSelection:function(t){t.preventDefault();t=s(t.target).closest("tr");s('input[name="tic"]').val(t.data("id")),s("#btn-ok").trigger("click")},completeSelection:function(t,e,i){"sst-tic-select-modal"===e&&(t.data.view.selectTIC(i.tic),t.data.view.unbindEvents())},selectTIC:function(t){this.input.val(t).trigger("change")},handleInputChange:function(){var t,e=this.input.val();""==e||void 0===e?this.readout.text(this.readout.data("default")):(t=o.tic_list?o.tic_list[parseInt(e)]:null)&&t.description?this.readout.text(t.description+" ("+t.id+")"):this.readout.text(this.readout.data("default")||"TIC "+e)},remove:function(){Backbone.View.prototype.remove.call(this),this.input.off("change")}});function i(){s(".sst-select-tic:not(.initialized)").each(function(){new e({el:s(this)}).render(),s(this).addClass("initialized")})}i(),s(document.body).on(o.tic_select_init_events,i)})}(jQuery,ticSelectLocalizeScript); -
simple-sales-tax/tags/8.4.16/build/style-tax-exemption-block-rtl.css
r3175018 r3669483 1 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(-360deg)}}@keyframes loading__animation{100%{transform:translateX(-100%)}}.wp-block-simple-sales-tax-tax-exemption{margin:1.5em 0}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-title.wc-block-components-title{margin-bottom:1em}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-text-input{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst- radio-group{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group label{display:block;margin-bottom:.5em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label{padding-right:2em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label input{right:0}.wp-block-simple-sales-tax-tax-exemption a{display:block;margin:1em 0}1 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(-360deg)}}@keyframes loading__animation{100%{transform:translateX(-100%)}}.wp-block-simple-sales-tax-tax-exemption{margin:1.5em 0}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-title.wc-block-components-title{margin-bottom:1em}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-text-input{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst-certificate-selection-help{margin:.5em 0 0;color:#5f6368;font-size:.875em;line-height:1.45}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group label{display:block;margin-bottom:.5em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label{padding-right:2em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label input{right:0}.wp-block-simple-sales-tax-tax-exemption a{display:block;margin:1em 0} 2 2 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(-360deg)}}@keyframes loading__animation{100%{transform:translateX(-100%)}}.wc-blocks-components-select{width:100%}.wc-blocks-components-select .wc-blocks-components-select__container{border-radius:4px;box-sizing:border-box;background:#fff;width:100%;height:3.125em;position:relative}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__container{background-color:rgba(0,0,0,.1);color:#fff}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__container:focus{background-color:rgba(0,0,0,.1);color:#fff}.has-error .wc-blocks-components-select .wc-blocks-components-select__container{border-color:#cc1818}.wc-blocks-components-select .wc-blocks-components-select__select{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-decoration:inherit;text-transform:inherit;font-size:1em;border-radius:4px;width:100%;height:100%;appearance:none;background:none;padding:1em .5em 0;color:#2b2d2f;border:1px solid rgba(17,17,17,.8)}.wc-blocks-components-select .wc-blocks-components-select__select:focus{border-color:currentColor;border-width:1.5px}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__select{border-color:rgba(255,255,255,.4);color:#fff}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__select:focus{border-color:currentColor}.has-error .wc-blocks-components-select .wc-blocks-components-select__select{color:#cc1818}.wc-blocks-components-select .wc-blocks-components-select__label{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-decoration:inherit;text-transform:inherit;font-size:1em;position:absolute;line-height:1.25;right:.5em;top:2px;transform-origin:top right;transition:all 200ms ease;color:#2b2d2f;z-index:1;margin:0;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 32px);white-space:nowrap;transform:translateY(15%) scale(0.75)}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__label{color:rgba(255,255,255,.6)}.has-error .wc-blocks-components-select .wc-blocks-components-select__label{color:#cc1818}@media screen and (prefers-reduced-motion: reduce){.wc-blocks-components-select .wc-blocks-components-select__label{transition:none}}.wc-blocks-components-select .wc-blocks-components-select__expand{position:absolute;transform:translate(0%, -50%);top:50%;left:12px;pointer-events:none;fill:#2b2d2f}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__expand{fill:#fff}.has-error .wc-blocks-components-select .wc-blocks-components-select__expand{fill:#cc1818} 3 3 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(-360deg)}}@keyframes loading__animation{100%{transform:translateX(-100%)}}.wc-blocks-components-select__container{margin-top:16px} -
simple-sales-tax/tags/8.4.16/build/style-tax-exemption-block.css
r3175018 r3669483 1 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes loading__animation{100%{transform:translateX(100%)}}.wp-block-simple-sales-tax-tax-exemption{margin:1.5em 0}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-title.wc-block-components-title{margin-bottom:1em}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-text-input{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst- radio-group{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group label{display:block;margin-bottom:.5em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label{padding-left:2em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label input{left:0}.wp-block-simple-sales-tax-tax-exemption a{display:block;margin:1em 0}1 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes loading__animation{100%{transform:translateX(100%)}}.wp-block-simple-sales-tax-tax-exemption{margin:1.5em 0}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-title.wc-block-components-title{margin-bottom:1em}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-text-input{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst-certificate-selection-help{margin:.5em 0 0;color:#5f6368;font-size:.875em;line-height:1.45}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group label{display:block;margin-bottom:.5em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label{padding-left:2em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label input{left:0}.wp-block-simple-sales-tax-tax-exemption a{display:block;margin:1em 0} 2 2 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes loading__animation{100%{transform:translateX(100%)}}.wc-blocks-components-select{width:100%}.wc-blocks-components-select .wc-blocks-components-select__container{border-radius:4px;box-sizing:border-box;background:#fff;width:100%;height:3.125em;position:relative}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__container{background-color:rgba(0,0,0,.1);color:#fff}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__container:focus{background-color:rgba(0,0,0,.1);color:#fff}.has-error .wc-blocks-components-select .wc-blocks-components-select__container{border-color:#cc1818}.wc-blocks-components-select .wc-blocks-components-select__select{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-decoration:inherit;text-transform:inherit;font-size:1em;border-radius:4px;width:100%;height:100%;appearance:none;background:none;padding:1em .5em 0;color:#2b2d2f;border:1px solid rgba(17,17,17,.8)}.wc-blocks-components-select .wc-blocks-components-select__select:focus{border-color:currentColor;border-width:1.5px}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__select{border-color:rgba(255,255,255,.4);color:#fff}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__select:focus{border-color:currentColor}.has-error .wc-blocks-components-select .wc-blocks-components-select__select{color:#cc1818}.wc-blocks-components-select .wc-blocks-components-select__label{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-decoration:inherit;text-transform:inherit;font-size:1em;position:absolute;line-height:1.25;left:.5em;top:2px;transform-origin:top left;transition:all 200ms ease;color:#2b2d2f;z-index:1;margin:0;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 32px);white-space:nowrap;transform:translateY(15%) scale(0.75)}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__label{color:rgba(255,255,255,.6)}.has-error .wc-blocks-components-select .wc-blocks-components-select__label{color:#cc1818}@media screen and (prefers-reduced-motion: reduce){.wc-blocks-components-select .wc-blocks-components-select__label{transition:none}}.wc-blocks-components-select .wc-blocks-components-select__expand{position:absolute;transform:translate(0%, -50%);top:50%;right:12px;pointer-events:none;fill:#2b2d2f}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__expand{fill:#fff}.has-error .wc-blocks-components-select .wc-blocks-components-select__expand{fill:#cc1818} 3 3 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes loading__animation{100%{transform:translateX(100%)}}.wc-blocks-components-select__container{margin-top:16px} -
simple-sales-tax/tags/8.4.16/build/tax-exemption-block-frontend.asset.php
r3326417 r3669483 1 <?php return array('dependencies' => array('react', 'wc-blocks-checkout', 'wc-blocks-components', 'wc-blocks-data-store', 'wc-settings', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-primitives'), 'version' => ' ae6e300ebc3116c74d20');1 <?php return array('dependencies' => array('react', 'wc-blocks-checkout', 'wc-blocks-components', 'wc-blocks-data-store', 'wc-settings', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-primitives'), 'version' => '70508e420fb3ab445162'); -
simple-sales-tax/tags/8.4.16/build/tax-exemption-block-frontend.js
r3326417 r3669483 1 (()=>{"use strict";var e,a={728:()=>{const e=window.wc.blocksCheckout,a=window.React,t=window.wp.data,l=window.wp.i18n,s=window.wc.wcSettings,r=window.wp.element,i=(0,r.forwardRef)((function({icon:e,size:a=24,...t},l){return(0,r.cloneElement)(e,{width:a,height:a,...t,ref:l})})),n=window.wp.primitives,o=(0,a.createElement)(n.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(n.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));function c(e){var a,t,l="";if("string"==typeof e||"number"==typeof e)l+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(a=0;a<s;a++)e[a]&&(t=c(e[a]))&&(l&&(l+=" "),l+=t)}else for(t in e)e[t]&&(l&&(l+=" "),l+=t);return l}function u(){for(var e,a,t=0,l="",s=arguments.length;t<s;t++)(e=arguments[t])&&(a=c(e))&&(l&&(l+=" "),l+=a);return l}const p=u,m=window.wc.wcBlocksData,d=window.wc.blocksComponents,_=e=>{var s;const{onChange:n,options:c,label:u,value:_="",className: x,size:h,errorId:g,required:b,errorMessage:v=(0,l.__)("Please select a valid option","woocommerce"),placeholder:E,...f}=e,S=(0,r.useCallback)((e=>{n(e.target.value)}),[n]),y=(0,l.getLocaleData)(),O=["de","de_AT","de_CH"].includes(null!==(s=y?.[""]?.lang)&&void 0!==s?s:"en"),w=(0,r.useMemo)((()=>({value:"",label:null!=E?E:(0,l.sprintf)(1 (()=>{"use strict";var e,a={728:()=>{const e=window.wc.blocksCheckout,a=window.React,t=window.wp.data,l=window.wp.i18n,s=window.wc.wcSettings,r=window.wp.element,i=(0,r.forwardRef)((function({icon:e,size:a=24,...t},l){return(0,r.cloneElement)(e,{width:a,height:a,...t,ref:l})})),n=window.wp.primitives,o=(0,a.createElement)(n.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(n.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));function c(e){var a,t,l="";if("string"==typeof e||"number"==typeof e)l+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(a=0;a<s;a++)e[a]&&(t=c(e[a]))&&(l&&(l+=" "),l+=t)}else for(t in e)e[t]&&(l&&(l+=" "),l+=t);return l}function u(){for(var e,a,t=0,l="",s=arguments.length;t<s;t++)(e=arguments[t])&&(a=c(e))&&(l&&(l+=" "),l+=a);return l}const p=u,m=window.wc.wcBlocksData,d=window.wc.blocksComponents,_=e=>{var s;const{onChange:n,options:c,label:u,value:_="",className:h,size:x,errorId:g,required:b,errorMessage:v=(0,l.__)("Please select a valid option","woocommerce"),placeholder:E,...f}=e,S=(0,r.useCallback)((e=>{n(e.target.value)}),[n]),y=(0,l.getLocaleData)(),w=["de","de_AT","de_CH"].includes(null!==(s=y?.[""]?.lang)&&void 0!==s?s:"en"),O=(0,r.useMemo)((()=>({value:"",label:null!=E?E:(0,l.sprintf)( 2 2 // translators: %s will be label of the field. For example "country/region". 3 3 // translators: %s will be label of the field. For example "country/region". 4 (0,l.__)("Select a %s","woocommerce"), O?u:u?.toLowerCase()),disabled:!!b})),[u,E,b,O]),C=(0,r.useId)(),T=f.id||`wc-blocks-components-select-${C}`,P=g||T,k=(0,r.useMemo)((()=>b&&_?c:[w].concat(c)),[b,_,w,c]),{setValidationErrors:R,clearValidationError:I}=(0,t.useDispatch)(m.validationStore),{error:A,validationErrorId:N}=(0,t.useSelect)((e=>{const a=e(m.validationStore);return{error:a.getValidationError(P),validationErrorId:a.getValidationErrorId(P)}}));(0,r.useEffect)((()=>(!b||_?I(P):R({[P]:{message:v,hidden:!0}}),()=>{I(P)})),[I,_,P,v,b,R]);const D=(0,t.useSelect)((e=>e(m.validationStore).getValidationError(P||"")||{hidden:!0}));return(0,a.createElement)("div",{className:p(x,{"has-error":!D.hidden})},(0,a.createElement)("div",{className:"wc-blocks-components-select"},(0,a.createElement)("div",{className:"wc-blocks-components-select__container"},(0,a.createElement)("label",{htmlFor:T,className:"wc-blocks-components-select__label"},u),(0,a.createElement)("select",{className:"wc-blocks-components-select__select",id:T,size:void 0!==h?h:1,onChange:S,value:_,"aria-invalid":!(!A?.message||A?.hidden),"aria-errormessage":N,...f},k.map((e=>(0,a.createElement)("option",{key:e.value,value:e.value,"data-alternate-values":`[${e.label}]`,disabled:void 0!==e.disabled&&e.disabled},e.label)))),(0,a.createElement)(i,{className:"wc-blocks-components-select__expand",icon:o}))),(0,a.createElement)(d.ValidationInputError,{propertyName:P}))},x=window.wp.htmlEntities,h=(e,a)=>{const t=a.find((a=>a.label.toLocaleUpperCase()===e.toLocaleUpperCase()||a.value.toLocaleUpperCase()===e.toLocaleUpperCase()));return t?t.value:""},g=({className:e,id:t,states:l,country:s,label:i,onChange:n,autoComplete:o="off",value:c="",required:p=!1})=>{const m=l[s],g=(0,r.useMemo)((()=>m&&Object.keys(m).length>0?Object.keys(m).map((e=>({value:e,label:(0,x.decodeEntities)(m[e])}))):[]),[m]),b=(0,r.useCallback)((e=>{const a=g.length>0?h(e,g):e;a!==c&&n(a)}),[n,g,c]),v=(0,r.useRef)(c);return(0,r.useEffect)((()=>{v.current!==c&&(v.current=c)}),[c]),(0,r.useEffect)((()=>{if(g.length>0&&v.current){const e=h(v.current,g);e!==v.current&&b(e)}}),[g,b]),g.length>0?(0,a.createElement)(_,{className:u(e,"wc-block-components-state-input"),options:g,label:i||"",id:t,onChange:b,value:c,autoComplete:o,required:p}):(0,a.createElement)(d.ValidatedTextInput,{className:e,id:t,label:i,onChange:b,autoComplete:o,value:c,required:p})},b=(0,s.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),v=(b.pluginUrl,b.pluginUrl,s.STORE_PAGES.shop,s.STORE_PAGES.checkout,s.STORE_PAGES.checkout,s.STORE_PAGES.privacy,s.STORE_PAGES.privacy,s.STORE_PAGES.terms,s.STORE_PAGES.terms,s.STORE_PAGES.cart,s.STORE_PAGES.cart,s.STORE_PAGES.myaccount?.permalink?s.STORE_PAGES.myaccount.permalink:(0,s.getSetting)("wpLoginUrl","/wp-login.php"),(0,s.getSetting)("localPickupEnabled",!1),(0,s.getSetting)("shippingMethodsExist",!1),(0,s.getSetting)("countries",{})),E=(0,s.getSetting)("countryData",{}),f=(Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowBilling)).map((e=>[e,v[e]||""]))),Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowBilling)).map((e=>[e,E[e].states||[]])))),S=(Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowShipping)).map((e=>[e,v[e]||""]))),Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowShipping)).map((e=>[e,E[e].states||[]]))),Object.fromEntries(Object.keys(E).map((e=>[e,E[e].locale||[]]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),y=((0,s.getSetting)("addressFieldsLocations",S).address,(0,s.getSetting)("addressFieldsLocations",S).contact,(0,s.getSetting)("addressFieldsLocations",S).order,(0,s.getSetting)("additionalOrderFields",{}),(0,s.getSetting)("additionalContactFields",{}),(0,s.getSetting)("additionalAddressFields",{}),[{value:"",label:(0,l.__)("Select a business type","simple-sales-tax"),disabled:!0},{value:"AccommodationAndFoodServices",label:(0,l.__)("Accommodation And Food Services","simple-sales-tax")},{value:"Agricultural_Forestry_Fishing_Hunting",label:(0,l.__)("Agricultural/Forestry/Fishing/Hunting","simple-sales-tax")},{value:"Construction",label:(0,l.__)("Construction","simple-sales-tax")},{value:"FinanceAndInsurance",label:(0,l.__)("Finance or Insurance","simple-sales-tax")},{value:"Information_PublishingAndCommunications",label:(0,l.__)("Information Publishing and Communications","simple-sales-tax")},{value:"Manufacturing",label:(0,l.__)("Manufacturing","simple-sales-tax")},{value:"Mining",label:(0,l.__)("Mining","simple-sales-tax")},{value:"RealEstate",label:(0,l.__)("Real Estate","simple-sales-tax")},{value:"RentalAndLeasing",label:(0,l.__)("Rental and Leasing","simple-sales-tax")},{value:"RetailTrade",label:(0,l.__)("Retail Trade","simple-sales-tax")},{value:"TransportationAndWarehousing",label:(0,l.__)("Transportation and Warehousing","simple-sales-tax")},{value:"Utilities",label:(0,l.__)("Utilities","simple-sales-tax")},{value:"WholesaleTrade",label:(0,l.__)("Wholesale Trade","simple-sales-tax")},{value:"BusinessServices",label:(0,l.__)("Business Services","simple-sales-tax")},{value:"ProfessionalServices",label:(0,l.__)("Professional Services","simple-sales-tax")},{value:"EducationAndHealthCareServices",label:(0,l.__)("Education and Health Care Services","simple-sales-tax")},{value:"NonprofitOrganization",label:(0,l.__)("Nonprofit Organization","simple-sales-tax")},{value:"Government",label:(0,l.__)("Government","simple-sales-tax")},{value:"NotABusiness",label:(0,l.__)("Not a Business","simple-sales-tax")},{value:"Other",label:(0,l.__)("Other","simple-sales-tax")}]),O=[{value:"",label:(0,l.__)("Select a reason","simple-sales-tax"),disabled:!0},{value:"FederalGovernmentDepartment",label:(0,l.__)("Federal Government Department","simple-sales-tax")},{value:"StateOrLocalGovernmentName",label:(0,l.__)("State Or Local Government","simple-sales-tax")},{value:"TribalGovernmentName",label:(0,l.__)("Tribal Government","simple-sales-tax")},{value:"ForeignDiplomat",label:(0,l.__)("Foreign Diplomat","simple-sales-tax")},{value:"CharitableOrganization",label:(0,l.__)("Charitable Organization","simple-sales-tax")},{value:"ReligiousOrEducationalOrganization",label:(0,l.__)("Religious or Educational Organization","simple-sales-tax")},{value:"Resale",label:(0,l.__)("Resale","simple-sales-tax")},{value:"AgriculturalProduction",label:(0,l.__)("Agricultural Production","simple-sales-tax")},{value:"IndustrialProductionOrManufacturing",label:(0,l.__)("Industrial Production or Manufacturing","simple-sales-tax")},{value:"DirectPayPermit",label:(0,l.__)("Direct Pay Permit","simple-sales-tax")},{value:"DirectMail",label:(0,l.__)("Direct Mail","simple-sales-tax")},{value:"Other",label:(0,l.__)("Other","simple-sales-tax")}],w="simple-sales-tax",C=(e,a)=>{const{__internalSetExtensionData:l}=(0,t.useDispatch)(m.CHECKOUT_STORE_KEY),s=(0,t.useSelect)((t=>{var l;const s=t(m.CHECKOUT_STORE_KEY).getExtensionData();return null!==(l=s[w]?.[e])&&void 0!==l?l:a})),i=(0,r.useCallback)((a=>{l(w,{[e]:a})}),[l]);return(0,r.useEffect)((()=>{i(a)}),[a,i]),[s,i]},T={SinglePurchase:!1,ExemptState:"",TaxType:"StateIssued",StateOfIssue:"",IDNumber:"",PurchaserBusinessType:"",PurchaserBusinessTypeOtherValue:"",PurchaserExemptionReason:"",PurchaserExemptionReasonOtherValue:""},P=()=>{const[s,r]=C("certificate",T),i=(e,a)=>{r({...s,[e]:a})},{businessTypeOtherError:n,exemptionReasonOtherError:o}=(0,t.useSelect)((e=>{const a=e(m.VALIDATION_STORE_KEY);return{businessTypeOtherError:a.getValidationError("purchase_business_type_other_value_error"),exemptionReasonOtherError:a.getValidationError("purchaser_exemption_reason_value_error")}})),c=e=>!!e?.message&&!e?.hidden;return(0,a.createElement)("div",{className:"sst-tax-exemption__form"},(0,a.createElement)("p",{class:"sst-tax-exemption__form-disclaimer"},(0,a.createElement)("strong",null,(0,l.__)("WARNING:","simple-sales-tax")),(0,l.__)("You are responsible for knowing if you qualify to claim exemption from tax in the state that is due tax on this sale. You will be held liable for any tax and interest, as well as civil and criminal penalties imposed by the member state, if you are not eligible to claim this exemption.","simple-sales-tax")),(0,a.createElement)(e.CheckboxControl,{id:"single_purchase",checked:s.SinglePurchase,onChange:e=>i("SinglePurchase",e)},(0,l.__)("This is a single-purchase exemption certificate","simple-sales-tax")),(0,a.createElement)(g,{id:"exempt_state",label:(0,l.__)("Exempt state","simple-sales-tax"),country:"US",states:f,value:s.ExemptState,onChange:e=>i("ExemptState",e),required:!0}),(0,a.createElement)("div",{className:"sst-radio-group",role:"radiogroup",id:"tax_type",ariaLabelledBy:"tax_type_label"},(0,a.createElement)("label",{id:"tax_type_label"},(0,l.__)("Tax ID type","simple-sales-tax")),(0,a.createElement)(d.RadioControl,{id:"tax_type",selected:s.TaxType,options:[{label:(0,l.__)("State Issued Exemption ID or Drivers License","simple-sales-tax"),value:"StateIssued"},{label:(0,l.__)("Federal Employer ID","simple-sales-tax"),value:"FEIN"}],onChange:e=>i("TaxType",e)})),"StateIssued"===s.TaxType&&(0,a.createElement)(g,{id:"state_of_issue",label:(0,l.__)("Issuing state","simple-sales-tax"),country:"US",states:f,value:s.StateOfIssue,onChange:e=>i("StateOfIssue",e),required:!0}),(0,a.createElement)(d.ValidatedTextInput,{id:"id_number",errorId:"id_number_error",label:(0,l.__)("Tax ID","simple-sales-tax"),required:!0,type:"text",value:s.IDNumber,onChange:e=>i("IDNumber",e)}),(0,a.createElement)(_,{id:"purchaser_business_type",label:(0,l.__)("Business type","simple-sales-tax"),onChange:e=>i("PurchaserBusinessType",e),options:y,value:s.PurchaserBusinessType,required:!0}),"Other"===s.PurchaserBusinessType&&(0,a.createElement)(d.ValidatedTextInput,{id:"purchase_business_type_other_value",errorId:"purchase_business_type_other_value_error",label:(0,l.__)("Explain the nature of your business","simple-sales-tax"),required:!0,type:"text",value:s.PurchaserBusinessTypeOtherValue,onChange:e=>i("PurchaserBusinessTypeOtherValue",e),showError:c(n),errorMessage:(0,l.__)("Please explain the nature of your business","simple-sales-tax")}),(0,a.createElement)(_,{id:"purchaser_exemption_reason",label:(0,l.__)("Reason for exemption","simple-sales-tax"),onChange:e=>i("PurchaserExemptionReason",e),options:O,value:s.PurchaserExemptionReason,required:!0}),"Other"===s.PurchaserExemptionReason&&(0,a.createElement)(d.ValidatedTextInput,{id:"purchaser_exemption_reason_value",errorId:"purchaser_exemption_reason_value_error",label:(0,l.__)("Please explain","simple-sales-tax"),required:!0,type:"text",value:s.PurchaserExemptionReasonOtherValue,onChange:e=>i("PurchaserExemptionReasonOtherValue",e),showError:c(o),errorMessage:(0,l.__)("Please explain why you are tax exempt","simple-sales-tax")}))},{showExemptionForm:k,certificateOptions:R,selectedCertificate:I,isUserLoggedIn:A,myAccountEndpointUrl:N}=(0,s.getSetting)("simple-sales-tax_data",""),D=Object.entries(R).map((([e,a])=>({value:e,label:a}))),F=JSON.parse('{"apiVersion":3,"name":"simple-sales-tax/tax-exemption","version":"1.0.0","title":"Tax Exemption Block","category":"woocommerce","description":"Adds a tax exemption form to the checkout.","supports":{"html":false,"align":false,"multiple":false,"reusable":false},"parent":["woocommerce/checkout-fields-block"],"textdomain":"simple-sales-tax","attributes":{},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}');(0,e.registerCheckoutBlock)({metadata:F,component:({className:s,children:r})=>{if(!k)return null;const[i,n]=C("certificate_id",I),{__internalIncrementCalculating:o,__internalDecrementCalculating:c}=(0,t.useDispatch)(m.CHECKOUT_STORE_KEY);return(0,a.createElement)("div",{className:s},(0,a.createElement)(d.Title,{headingLevel:"2"},(0,l.__)("Tax exemption","simple-sales-tax")),!A&&(0,a.createElement)("p",null,(0,l.__)("Please log in or register to apply an exemption certificate.","simple-sales-tax")),A&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(_,{id:"exemption-certificate-input",label:(0,l.__)("Exemption certificate","simple-sales-tax"),onChange:a=>{n(a),o(),(0,e.extensionCartUpdate)({namespace:"simple-sales-tax",data:{action:"set_certificate_id",certificate_id:a}}).finally((()=>{c()}))},options:D,value:i}),(0,a.createElement)("a",{href:N,target:"_blank"},(0,l.__)("Manage exemption certificates →","simple-sales-tax")),"new"===i&&(0,a.createElement)(P,null)))}})}},t={};function l(e){var s=t[e];if(void 0!==s)return s.exports;var r=t[e]={exports:{}};return a[e](r,r.exports,l),r.exports}l.m=a,e=[],l.O=(a,t,s,r)=>{if(!t){var i=1/0;for(u=0;u<e.length;u++){t=e[u][0],s=e[u][1],r=e[u][2];for(var n=!0,o=0;o<t.length;o++)(!1&r||i>=r)&&Object.keys(l.O).every((e=>l.O[e](t[o])))?t.splice(o--,1):(n=!1,r<i&&(i=r));if(n){e.splice(u--,1);var c=s();void 0!==c&&(a=c)}}return a}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[t,s,r]},l.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={293:0,575:0};l.O.j=a=>0===e[a];var a=(a,t)=>{var s,r,i=t[0],n=t[1],o=t[2],c=0;if(i.some((a=>0!==e[a]))){for(s in n)l.o(n,s)&&(l.m[s]=n[s]);if(o)var u=o(l)}for(a&&a(t);c<i.length;c++)r=i[c],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(u)},t=self.webpackChunksimplesalestax=self.webpackChunksimplesalestax||[];t.forEach(a.bind(null,0)),t.push=a.bind(null,t.push.bind(t))})();var s=l.O(void 0,[575],(()=>l(728)));s=l.O(s)})();4 (0,l.__)("Select a %s","woocommerce"),w?u:u?.toLowerCase()),disabled:!!b})),[u,E,b,w]),C=(0,r.useId)(),T=f.id||`wc-blocks-components-select-${C}`,P=g||T,k=(0,r.useMemo)((()=>b&&_?c:[O].concat(c)),[b,_,O,c]),{setValidationErrors:R,clearValidationError:I}=(0,t.useDispatch)(m.validationStore),{error:A,validationErrorId:N}=(0,t.useSelect)((e=>{const a=e(m.validationStore);return{error:a.getValidationError(P),validationErrorId:a.getValidationErrorId(P)}}));(0,r.useEffect)((()=>(!b||_?I(P):R({[P]:{message:v,hidden:!0}}),()=>{I(P)})),[I,_,P,v,b,R]);const D=(0,t.useSelect)((e=>e(m.validationStore).getValidationError(P||"")||{hidden:!0}));return(0,a.createElement)("div",{className:p(h,{"has-error":!D.hidden})},(0,a.createElement)("div",{className:"wc-blocks-components-select"},(0,a.createElement)("div",{className:"wc-blocks-components-select__container"},(0,a.createElement)("label",{htmlFor:T,className:"wc-blocks-components-select__label"},u),(0,a.createElement)("select",{className:"wc-blocks-components-select__select",id:T,size:void 0!==x?x:1,onChange:S,value:_,"aria-invalid":!(!A?.message||A?.hidden),"aria-errormessage":N,...f},k.map((e=>(0,a.createElement)("option",{key:e.value,value:e.value,"data-alternate-values":`[${e.label}]`,disabled:void 0!==e.disabled&&e.disabled},e.label)))),(0,a.createElement)(i,{className:"wc-blocks-components-select__expand",icon:o}))),(0,a.createElement)(d.ValidationInputError,{propertyName:P}))},h=window.wp.htmlEntities,x=(e,a)=>{const t=a.find((a=>a.label.toLocaleUpperCase()===e.toLocaleUpperCase()||a.value.toLocaleUpperCase()===e.toLocaleUpperCase()));return t?t.value:""},g=({className:e,id:t,states:l,country:s,label:i,onChange:n,autoComplete:o="off",value:c="",required:p=!1})=>{const m=l[s],g=(0,r.useMemo)((()=>m&&Object.keys(m).length>0?Object.keys(m).map((e=>({value:e,label:(0,h.decodeEntities)(m[e])}))):[]),[m]),b=(0,r.useCallback)((e=>{const a=g.length>0?x(e,g):e;a!==c&&n(a)}),[n,g,c]),v=(0,r.useRef)(c);return(0,r.useEffect)((()=>{v.current!==c&&(v.current=c)}),[c]),(0,r.useEffect)((()=>{if(g.length>0&&v.current){const e=x(v.current,g);e!==v.current&&b(e)}}),[g,b]),g.length>0?(0,a.createElement)(_,{className:u(e,"wc-block-components-state-input"),options:g,label:i||"",id:t,onChange:b,value:c,autoComplete:o,required:p}):(0,a.createElement)(d.ValidatedTextInput,{className:e,id:t,label:i,onChange:b,autoComplete:o,value:c,required:p})},b=(0,s.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),v=(b.pluginUrl,b.pluginUrl,s.STORE_PAGES.shop,s.STORE_PAGES.checkout,s.STORE_PAGES.checkout,s.STORE_PAGES.privacy,s.STORE_PAGES.privacy,s.STORE_PAGES.terms,s.STORE_PAGES.terms,s.STORE_PAGES.cart,s.STORE_PAGES.cart,s.STORE_PAGES.myaccount?.permalink?s.STORE_PAGES.myaccount.permalink:(0,s.getSetting)("wpLoginUrl","/wp-login.php"),(0,s.getSetting)("localPickupEnabled",!1),(0,s.getSetting)("shippingMethodsExist",!1),(0,s.getSetting)("countries",{})),E=(0,s.getSetting)("countryData",{}),f=(Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowBilling)).map((e=>[e,v[e]||""]))),Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowBilling)).map((e=>[e,E[e].states||[]])))),S=(Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowShipping)).map((e=>[e,v[e]||""]))),Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowShipping)).map((e=>[e,E[e].states||[]]))),Object.fromEntries(Object.keys(E).map((e=>[e,E[e].locale||[]]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),y=((0,s.getSetting)("addressFieldsLocations",S).address,(0,s.getSetting)("addressFieldsLocations",S).contact,(0,s.getSetting)("addressFieldsLocations",S).order,(0,s.getSetting)("additionalOrderFields",{}),(0,s.getSetting)("additionalContactFields",{}),(0,s.getSetting)("additionalAddressFields",{}),[{value:"",label:(0,l.__)("Select a business type","simple-sales-tax"),disabled:!0},{value:"AccommodationAndFoodServices",label:(0,l.__)("Accommodation And Food Services","simple-sales-tax")},{value:"Agricultural_Forestry_Fishing_Hunting",label:(0,l.__)("Agricultural/Forestry/Fishing/Hunting","simple-sales-tax")},{value:"Construction",label:(0,l.__)("Construction","simple-sales-tax")},{value:"FinanceAndInsurance",label:(0,l.__)("Finance or Insurance","simple-sales-tax")},{value:"Information_PublishingAndCommunications",label:(0,l.__)("Information Publishing and Communications","simple-sales-tax")},{value:"Manufacturing",label:(0,l.__)("Manufacturing","simple-sales-tax")},{value:"Mining",label:(0,l.__)("Mining","simple-sales-tax")},{value:"RealEstate",label:(0,l.__)("Real Estate","simple-sales-tax")},{value:"RentalAndLeasing",label:(0,l.__)("Rental and Leasing","simple-sales-tax")},{value:"RetailTrade",label:(0,l.__)("Retail Trade","simple-sales-tax")},{value:"TransportationAndWarehousing",label:(0,l.__)("Transportation and Warehousing","simple-sales-tax")},{value:"Utilities",label:(0,l.__)("Utilities","simple-sales-tax")},{value:"WholesaleTrade",label:(0,l.__)("Wholesale Trade","simple-sales-tax")},{value:"BusinessServices",label:(0,l.__)("Business Services","simple-sales-tax")},{value:"ProfessionalServices",label:(0,l.__)("Professional Services","simple-sales-tax")},{value:"EducationAndHealthCareServices",label:(0,l.__)("Education and Health Care Services","simple-sales-tax")},{value:"NonprofitOrganization",label:(0,l.__)("Nonprofit Organization","simple-sales-tax")},{value:"Government",label:(0,l.__)("Government","simple-sales-tax")},{value:"NotABusiness",label:(0,l.__)("Not a Business","simple-sales-tax")},{value:"Other",label:(0,l.__)("Other","simple-sales-tax")}]),w=[{value:"",label:(0,l.__)("Select a reason","simple-sales-tax"),disabled:!0},{value:"FederalGovernmentDepartment",label:(0,l.__)("Federal Government Department","simple-sales-tax")},{value:"StateOrLocalGovernmentName",label:(0,l.__)("State Or Local Government","simple-sales-tax")},{value:"TribalGovernmentName",label:(0,l.__)("Tribal Government","simple-sales-tax")},{value:"ForeignDiplomat",label:(0,l.__)("Foreign Diplomat","simple-sales-tax")},{value:"CharitableOrganization",label:(0,l.__)("Charitable Organization","simple-sales-tax")},{value:"ReligiousOrEducationalOrganization",label:(0,l.__)("Religious or Educational Organization","simple-sales-tax")},{value:"Resale",label:(0,l.__)("Resale","simple-sales-tax")},{value:"AgriculturalProduction",label:(0,l.__)("Agricultural Production","simple-sales-tax")},{value:"IndustrialProductionOrManufacturing",label:(0,l.__)("Industrial Production or Manufacturing","simple-sales-tax")},{value:"DirectPayPermit",label:(0,l.__)("Direct Pay Permit","simple-sales-tax")},{value:"DirectMail",label:(0,l.__)("Direct Mail","simple-sales-tax")},{value:"Other",label:(0,l.__)("Other","simple-sales-tax")}],O="simple-sales-tax",C=(e,a)=>{const{__internalSetExtensionData:l}=(0,t.useDispatch)(m.CHECKOUT_STORE_KEY),s=(0,t.useSelect)((t=>{var l;const s=t(m.CHECKOUT_STORE_KEY).getExtensionData();return null!==(l=s[O]?.[e])&&void 0!==l?l:a})),i=(0,r.useCallback)((a=>{l(O,{[e]:a})}),[l]);return(0,r.useEffect)((()=>{i(a)}),[a,i]),[s,i]},T={SinglePurchase:!1,ExemptState:"",TaxType:"StateIssued",StateOfIssue:"",IDNumber:"",PurchaserBusinessType:"",PurchaserBusinessTypeOtherValue:"",PurchaserExemptionReason:"",PurchaserExemptionReasonOtherValue:""},P=()=>{const[s,r]=C("certificate",T),i=(e,a)=>{r({...s,[e]:a})},{businessTypeOtherError:n,exemptionReasonOtherError:o}=(0,t.useSelect)((e=>{const a=e(m.VALIDATION_STORE_KEY);return{businessTypeOtherError:a.getValidationError("purchase_business_type_other_value_error"),exemptionReasonOtherError:a.getValidationError("purchaser_exemption_reason_value_error")}})),c=e=>!!e?.message&&!e?.hidden;return(0,a.createElement)("div",{className:"sst-tax-exemption__form"},(0,a.createElement)("p",{class:"sst-tax-exemption__form-disclaimer"},(0,a.createElement)("strong",null,(0,l.__)("WARNING:","simple-sales-tax")),(0,l.__)("You are responsible for knowing if you qualify to claim exemption from tax in the state that is due tax on this sale. You will be held liable for any tax and interest, as well as civil and criminal penalties imposed by the member state, if you are not eligible to claim this exemption.","simple-sales-tax")),(0,a.createElement)(e.CheckboxControl,{id:"single_purchase",checked:s.SinglePurchase,onChange:e=>i("SinglePurchase",e)},(0,l.__)("This is a single-purchase exemption certificate","simple-sales-tax")),(0,a.createElement)(g,{id:"exempt_state",label:(0,l.__)("Exempt state","simple-sales-tax"),country:"US",states:f,value:s.ExemptState,onChange:e=>i("ExemptState",e),required:!0}),(0,a.createElement)("div",{className:"sst-radio-group",role:"radiogroup",id:"tax_type",ariaLabelledBy:"tax_type_label"},(0,a.createElement)("label",{id:"tax_type_label"},(0,l.__)("Tax ID type","simple-sales-tax")),(0,a.createElement)(d.RadioControl,{id:"tax_type",selected:s.TaxType,options:[{label:(0,l.__)("State Issued Exemption ID or Drivers License","simple-sales-tax"),value:"StateIssued"},{label:(0,l.__)("Federal Employer ID","simple-sales-tax"),value:"FEIN"}],onChange:e=>i("TaxType",e)})),"StateIssued"===s.TaxType&&(0,a.createElement)(g,{id:"state_of_issue",label:(0,l.__)("Issuing state","simple-sales-tax"),country:"US",states:f,value:s.StateOfIssue,onChange:e=>i("StateOfIssue",e),required:!0}),(0,a.createElement)(d.ValidatedTextInput,{id:"id_number",errorId:"id_number_error",label:(0,l.__)("Tax ID","simple-sales-tax"),required:!0,type:"text",value:s.IDNumber,onChange:e=>i("IDNumber",e)}),(0,a.createElement)(_,{id:"purchaser_business_type",label:(0,l.__)("Business type","simple-sales-tax"),onChange:e=>i("PurchaserBusinessType",e),options:y,value:s.PurchaserBusinessType,required:!0}),"Other"===s.PurchaserBusinessType&&(0,a.createElement)(d.ValidatedTextInput,{id:"purchase_business_type_other_value",errorId:"purchase_business_type_other_value_error",label:(0,l.__)("Explain the nature of your business","simple-sales-tax"),required:!0,type:"text",value:s.PurchaserBusinessTypeOtherValue,onChange:e=>i("PurchaserBusinessTypeOtherValue",e),showError:c(n),errorMessage:(0,l.__)("Please explain the nature of your business","simple-sales-tax")}),(0,a.createElement)(_,{id:"purchaser_exemption_reason",label:(0,l.__)("Reason for exemption","simple-sales-tax"),onChange:e=>i("PurchaserExemptionReason",e),options:w,value:s.PurchaserExemptionReason,required:!0}),"Other"===s.PurchaserExemptionReason&&(0,a.createElement)(d.ValidatedTextInput,{id:"purchaser_exemption_reason_value",errorId:"purchaser_exemption_reason_value_error",label:(0,l.__)("Please explain","simple-sales-tax"),required:!0,type:"text",value:s.PurchaserExemptionReasonOtherValue,onChange:e=>i("PurchaserExemptionReasonOtherValue",e),showError:c(o),errorMessage:(0,l.__)("Please explain why you are tax exempt","simple-sales-tax")}))},{showExemptionForm:k,certificateOptions:R,selectedCertificate:I,isUserLoggedIn:A,myAccountEndpointUrl:N}=(0,s.getSetting)("simple-sales-tax_data",""),D=Object.entries(R).map((([e,a])=>({value:e,label:a}))),F=JSON.parse('{"apiVersion":3,"name":"simple-sales-tax/tax-exemption","version":"1.0.0","title":"Tax Exemption Block","category":"woocommerce","description":"Adds a tax exemption form to the checkout.","supports":{"html":false,"align":false,"multiple":false,"reusable":false},"parent":["woocommerce/checkout-fields-block"],"textdomain":"simple-sales-tax","attributes":{},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}');(0,e.registerCheckoutBlock)({metadata:F,component:({className:s,children:r})=>{if(!k)return null;const[i,n]=C("certificate_id",I),{__internalIncrementCalculating:o,__internalDecrementCalculating:c}=(0,t.useDispatch)(m.CHECKOUT_STORE_KEY);let u=(0,l.__)("No exemption certificate will be applied to this order.","simple-sales-tax");return"new"===i?u=(0,l.__)("Complete the certificate details below to apply it to this order.","simple-sales-tax"):i&&(u=(0,l.__)("This certificate will be applied to this order. Certificates are ordered newest first.","simple-sales-tax")),(0,a.createElement)("div",{className:s},(0,a.createElement)(d.Title,{headingLevel:"2"},(0,l.__)("Tax exemption","simple-sales-tax")),!A&&(0,a.createElement)("p",null,(0,l.__)("Please log in or register to apply an exemption certificate.","simple-sales-tax")),A&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(_,{id:"exemption-certificate-input",label:(0,l.__)("Certificate to apply","simple-sales-tax"),onChange:a=>{n(a),o(),(0,e.extensionCartUpdate)({namespace:"simple-sales-tax",data:{action:"set_certificate_id",certificate_id:a}}).finally((()=>{c()}))},options:D,value:i}),(0,a.createElement)("p",{className:"sst-certificate-selection-help"},u),(0,a.createElement)("a",{href:N,target:"_blank"},(0,l.__)("Manage exemption certificates →","simple-sales-tax")),"new"===i&&(0,a.createElement)(P,null)))}})}},t={};function l(e){var s=t[e];if(void 0!==s)return s.exports;var r=t[e]={exports:{}};return a[e](r,r.exports,l),r.exports}l.m=a,e=[],l.O=(a,t,s,r)=>{if(!t){var i=1/0;for(u=0;u<e.length;u++){t=e[u][0],s=e[u][1],r=e[u][2];for(var n=!0,o=0;o<t.length;o++)(!1&r||i>=r)&&Object.keys(l.O).every((e=>l.O[e](t[o])))?t.splice(o--,1):(n=!1,r<i&&(i=r));if(n){e.splice(u--,1);var c=s();void 0!==c&&(a=c)}}return a}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[t,s,r]},l.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={293:0,575:0};l.O.j=a=>0===e[a];var a=(a,t)=>{var s,r,i=t[0],n=t[1],o=t[2],c=0;if(i.some((a=>0!==e[a]))){for(s in n)l.o(n,s)&&(l.m[s]=n[s]);if(o)var u=o(l)}for(a&&a(t);c<i.length;c++)r=i[c],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(u)},t=self.webpackChunksimplesalestax=self.webpackChunksimplesalestax||[];t.forEach(a.bind(null,0)),t.push=a.bind(null,t.push.bind(t))})();var s=l.O(void 0,[575],(()=>l(728)));s=l.O(s)})(); -
simple-sales-tax/tags/8.4.16/build/tax-exemption-block.asset.php
r3326417 r3669483 1 <?php return array('dependencies' => array('react', 'wc-blocks-checkout', 'wc-blocks-components', 'wc-blocks-data-store', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-primitives'), 'version' => ' 87afb26bfc240c967e00');1 <?php return array('dependencies' => array('react', 'wc-blocks-checkout', 'wc-blocks-components', 'wc-blocks-data-store', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-primitives'), 'version' => '45531217e6a53f629eb4'); -
simple-sales-tax/tags/8.4.16/build/tax-exemption-block.js
r3326417 r3669483 1 (()=>{"use strict";var e,a={959:()=>{const e=window.React,a=window.wp.element,t=(0,a.forwardRef)((function({icon:e,size:t=24,...l},s){return(0,a.cloneElement)(e,{width:t,height:t,...l,ref:s})})),l=window.wp.primitives,s=(0,e.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(l.Path,{fillRule:"evenodd",d:"M6.5 8a1.5 1.5 0 103 0 1.5 1.5 0 00-3 0zM8 5a3 3 0 100 6 3 3 0 000-6zm6.5 11a1.5 1.5 0 103 0 1.5 1.5 0 00-3 0zm1.5-3a3 3 0 100 6 3 3 0 000-6zM5.47 17.41a.75.75 0 001.06 1.06L18.47 6.53a.75.75 0 10-1.06-1.06L5.47 17.41z",clipRule:"evenodd"})),r=window.wp.blocks,i=window.wp.blockEditor,n=window.wp.components,o=window.wp.data,c=window.wp.i18n,u=window.wc.wcSettings,p=(0,e.createElement)(l.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(l.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));function m(e){var a,t,l="";if("string"==typeof e||"number"==typeof e)l+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(a=0;a<s;a++)e[a]&&(t=m(e[a]))&&(l&&(l+=" "),l+=t)}else for(t in e)e[t]&&(l&&(l+=" "),l+=t);return l}function d(){for(var e,a,t=0,l="",s=arguments.length;t<s;t++)(e=arguments[t])&&(a=m(e))&&(l&&(l+=" "),l+=a);return l}const _=d,x=window.wc.wcBlocksData,h=window.wc.blocksComponents, g=l=>{var s;const{onChange:r,options:i,label:n,value:u="",className:m,size:d,errorId:g,required:b,errorMessage:v=(0,c.__)("Please select a valid option","woocommerce"),placeholder:E,...f}=l,w=(0,a.useCallback)((e=>{r(e.target.value)}),[r]),S=(0,c.getLocaleData)(),y=["de","de_AT","de_CH"].includes(null!==(s=S?.[""]?.lang)&&void 0!==s?s:"en"),O=(0,a.useMemo)((()=>({value:"",label:null!=E?E:(0,c.sprintf)(1 (()=>{"use strict";var e,a={959:()=>{const e=window.React,a=window.wp.element,t=(0,a.forwardRef)((function({icon:e,size:t=24,...l},s){return(0,a.cloneElement)(e,{width:t,height:t,...l,ref:s})})),l=window.wp.primitives,s=(0,e.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(l.Path,{fillRule:"evenodd",d:"M6.5 8a1.5 1.5 0 103 0 1.5 1.5 0 00-3 0zM8 5a3 3 0 100 6 3 3 0 000-6zm6.5 11a1.5 1.5 0 103 0 1.5 1.5 0 00-3 0zm1.5-3a3 3 0 100 6 3 3 0 000-6zM5.47 17.41a.75.75 0 001.06 1.06L18.47 6.53a.75.75 0 10-1.06-1.06L5.47 17.41z",clipRule:"evenodd"})),r=window.wp.blocks,i=window.wp.blockEditor,n=window.wp.components,o=window.wp.data,c=window.wp.i18n,u=window.wc.wcSettings,p=(0,e.createElement)(l.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(l.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));function m(e){var a,t,l="";if("string"==typeof e||"number"==typeof e)l+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(a=0;a<s;a++)e[a]&&(t=m(e[a]))&&(l&&(l+=" "),l+=t)}else for(t in e)e[t]&&(l&&(l+=" "),l+=t);return l}function d(){for(var e,a,t=0,l="",s=arguments.length;t<s;t++)(e=arguments[t])&&(a=m(e))&&(l&&(l+=" "),l+=a);return l}const _=d,x=window.wc.wcBlocksData,h=window.wc.blocksComponents,b=l=>{var s;const{onChange:r,options:i,label:n,value:u="",className:m,size:d,errorId:b,required:g,errorMessage:v=(0,c.__)("Please select a valid option","woocommerce"),placeholder:E,...f}=l,w=(0,a.useCallback)((e=>{r(e.target.value)}),[r]),S=(0,c.getLocaleData)(),y=["de","de_AT","de_CH"].includes(null!==(s=S?.[""]?.lang)&&void 0!==s?s:"en"),O=(0,a.useMemo)((()=>({value:"",label:null!=E?E:(0,c.sprintf)( 2 2 // translators: %s will be label of the field. For example "country/region". 3 3 // translators: %s will be label of the field. For example "country/region". 4 (0,c.__)("Select a %s","woocommerce"),y?n:n?.toLowerCase()),disabled:!! b})),[n,E,b,y]),T=(0,a.useId)(),C=f.id||`wc-blocks-components-select-${T}`,P=g||C,k=(0,a.useMemo)((()=>b&&u?i:[O].concat(i)),[b,u,O,i]),{setValidationErrors:R,clearValidationError:I}=(0,o.useDispatch)(x.validationStore),{error:A,validationErrorId:N}=(0,o.useSelect)((e=>{const a=e(x.validationStore);return{error:a.getValidationError(P),validationErrorId:a.getValidationErrorId(P)}}));(0,a.useEffect)((()=>(!b||u?I(P):R({[P]:{message:v,hidden:!0}}),()=>{I(P)})),[I,u,P,v,b,R]);const D=(0,o.useSelect)((e=>e(x.validationStore).getValidationError(P||"")||{hidden:!0}));return(0,e.createElement)("div",{className:_(m,{"has-error":!D.hidden})},(0,e.createElement)("div",{className:"wc-blocks-components-select"},(0,e.createElement)("div",{className:"wc-blocks-components-select__container"},(0,e.createElement)("label",{htmlFor:C,className:"wc-blocks-components-select__label"},n),(0,e.createElement)("select",{className:"wc-blocks-components-select__select",id:C,size:void 0!==d?d:1,onChange:w,value:u,"aria-invalid":!(!A?.message||A?.hidden),"aria-errormessage":N,...f},k.map((a=>(0,e.createElement)("option",{key:a.value,value:a.value,"data-alternate-values":`[${a.label}]`,disabled:void 0!==a.disabled&&a.disabled},a.label)))),(0,e.createElement)(t,{className:"wc-blocks-components-select__expand",icon:p}))),(0,e.createElement)(h.ValidationInputError,{propertyName:P}))},b=window.wc.blocksCheckout,v=window.wp.htmlEntities,E=(e,a)=>{const t=a.find((a=>a.label.toLocaleUpperCase()===e.toLocaleUpperCase()||a.value.toLocaleUpperCase()===e.toLocaleUpperCase()));return t?t.value:""},f=({className:t,id:l,states:s,country:r,label:i,onChange:n,autoComplete:o="off",value:c="",required:u=!1})=>{const p=s[r],m=(0,a.useMemo)((()=>p&&Object.keys(p).length>0?Object.keys(p).map((e=>({value:e,label:(0,v.decodeEntities)(p[e])}))):[]),[p]),_=(0,a.useCallback)((e=>{const a=m.length>0?E(e,m):e;a!==c&&n(a)}),[n,m,c]),x=(0,a.useRef)(c);return(0,a.useEffect)((()=>{x.current!==c&&(x.current=c)}),[c]),(0,a.useEffect)((()=>{if(m.length>0&&x.current){const e=E(x.current,m);e!==x.current&&_(e)}}),[m,_]),m.length>0?(0,e.createElement)(g,{className:d(t,"wc-block-components-state-input"),options:m,label:i||"",id:l,onChange:_,value:c,autoComplete:o,required:u}):(0,e.createElement)(h.ValidatedTextInput,{className:t,id:l,label:i,onChange:_,autoComplete:o,value:c,required:u})},w=(0,u.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),S=(w.pluginUrl,w.pluginUrl,u.STORE_PAGES.shop,u.STORE_PAGES.checkout,u.STORE_PAGES.checkout,u.STORE_PAGES.privacy,u.STORE_PAGES.privacy,u.STORE_PAGES.terms,u.STORE_PAGES.terms,u.STORE_PAGES.cart,u.STORE_PAGES.cart,u.STORE_PAGES.myaccount?.permalink?u.STORE_PAGES.myaccount.permalink:(0,u.getSetting)("wpLoginUrl","/wp-login.php"),(0,u.getSetting)("localPickupEnabled",!1),(0,u.getSetting)("shippingMethodsExist",!1),(0,u.getSetting)("countries",{})),y=(0,u.getSetting)("countryData",{}),O=(Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowBilling)).map((e=>[e,S[e]||""]))),Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowBilling)).map((e=>[e,y[e].states||[]])))),T=(Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowShipping)).map((e=>[e,S[e]||""]))),Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowShipping)).map((e=>[e,y[e].states||[]]))),Object.fromEntries(Object.keys(y).map((e=>[e,y[e].locale||[]]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),C=((0,u.getSetting)("addressFieldsLocations",T).address,(0,u.getSetting)("addressFieldsLocations",T).contact,(0,u.getSetting)("addressFieldsLocations",T).order,(0,u.getSetting)("additionalOrderFields",{}),(0,u.getSetting)("additionalContactFields",{}),(0,u.getSetting)("additionalAddressFields",{}),[{value:"",label:(0,c.__)("Select a business type","simple-sales-tax"),disabled:!0},{value:"AccommodationAndFoodServices",label:(0,c.__)("Accommodation And Food Services","simple-sales-tax")},{value:"Agricultural_Forestry_Fishing_Hunting",label:(0,c.__)("Agricultural/Forestry/Fishing/Hunting","simple-sales-tax")},{value:"Construction",label:(0,c.__)("Construction","simple-sales-tax")},{value:"FinanceAndInsurance",label:(0,c.__)("Finance or Insurance","simple-sales-tax")},{value:"Information_PublishingAndCommunications",label:(0,c.__)("Information Publishing and Communications","simple-sales-tax")},{value:"Manufacturing",label:(0,c.__)("Manufacturing","simple-sales-tax")},{value:"Mining",label:(0,c.__)("Mining","simple-sales-tax")},{value:"RealEstate",label:(0,c.__)("Real Estate","simple-sales-tax")},{value:"RentalAndLeasing",label:(0,c.__)("Rental and Leasing","simple-sales-tax")},{value:"RetailTrade",label:(0,c.__)("Retail Trade","simple-sales-tax")},{value:"TransportationAndWarehousing",label:(0,c.__)("Transportation and Warehousing","simple-sales-tax")},{value:"Utilities",label:(0,c.__)("Utilities","simple-sales-tax")},{value:"WholesaleTrade",label:(0,c.__)("Wholesale Trade","simple-sales-tax")},{value:"BusinessServices",label:(0,c.__)("Business Services","simple-sales-tax")},{value:"ProfessionalServices",label:(0,c.__)("Professional Services","simple-sales-tax")},{value:"EducationAndHealthCareServices",label:(0,c.__)("Education and Health Care Services","simple-sales-tax")},{value:"NonprofitOrganization",label:(0,c.__)("Nonprofit Organization","simple-sales-tax")},{value:"Government",label:(0,c.__)("Government","simple-sales-tax")},{value:"NotABusiness",label:(0,c.__)("Not a Business","simple-sales-tax")},{value:"Other",label:(0,c.__)("Other","simple-sales-tax")}]),P=[{value:"",label:(0,c.__)("Select a reason","simple-sales-tax"),disabled:!0},{value:"FederalGovernmentDepartment",label:(0,c.__)("Federal Government Department","simple-sales-tax")},{value:"StateOrLocalGovernmentName",label:(0,c.__)("State Or Local Government","simple-sales-tax")},{value:"TribalGovernmentName",label:(0,c.__)("Tribal Government","simple-sales-tax")},{value:"ForeignDiplomat",label:(0,c.__)("Foreign Diplomat","simple-sales-tax")},{value:"CharitableOrganization",label:(0,c.__)("Charitable Organization","simple-sales-tax")},{value:"ReligiousOrEducationalOrganization",label:(0,c.__)("Religious or Educational Organization","simple-sales-tax")},{value:"Resale",label:(0,c.__)("Resale","simple-sales-tax")},{value:"AgriculturalProduction",label:(0,c.__)("Agricultural Production","simple-sales-tax")},{value:"IndustrialProductionOrManufacturing",label:(0,c.__)("Industrial Production or Manufacturing","simple-sales-tax")},{value:"DirectPayPermit",label:(0,c.__)("Direct Pay Permit","simple-sales-tax")},{value:"DirectMail",label:(0,c.__)("Direct Mail","simple-sales-tax")},{value:"Other",label:(0,c.__)("Other","simple-sales-tax")}],k="simple-sales-tax",R=(e,t)=>{const{__internalSetExtensionData:l}=(0,o.useDispatch)(x.CHECKOUT_STORE_KEY),s=(0,o.useSelect)((a=>{var l;const s=a(x.CHECKOUT_STORE_KEY).getExtensionData();return null!==(l=s[k]?.[e])&&void 0!==l?l:t})),r=(0,a.useCallback)((a=>{l(k,{[e]:a})}),[l]);return(0,a.useEffect)((()=>{r(t)}),[t,r]),[s,r]},I={SinglePurchase:!1,ExemptState:"",TaxType:"StateIssued",StateOfIssue:"",IDNumber:"",PurchaserBusinessType:"",PurchaserBusinessTypeOtherValue:"",PurchaserExemptionReason:"",PurchaserExemptionReasonOtherValue:""},A=()=>{const[a,t]=R("certificate",I),l=(e,l)=>{t({...a,[e]:l})},{businessTypeOtherError:s,exemptionReasonOtherError:r}=(0,o.useSelect)((e=>{const a=e(x.VALIDATION_STORE_KEY);return{businessTypeOtherError:a.getValidationError("purchase_business_type_other_value_error"),exemptionReasonOtherError:a.getValidationError("purchaser_exemption_reason_value_error")}})),i=e=>!!e?.message&&!e?.hidden;return(0,e.createElement)("div",{className:"sst-tax-exemption__form"},(0,e.createElement)("p",{class:"sst-tax-exemption__form-disclaimer"},(0,e.createElement)("strong",null,(0,c.__)("WARNING:","simple-sales-tax")),(0,c.__)("You are responsible for knowing if you qualify to claim exemption from tax in the state that is due tax on this sale. You will be held liable for any tax and interest, as well as civil and criminal penalties imposed by the member state, if you are not eligible to claim this exemption.","simple-sales-tax")),(0,e.createElement)(b.CheckboxControl,{id:"single_purchase",checked:a.SinglePurchase,onChange:e=>l("SinglePurchase",e)},(0,c.__)("This is a single-purchase exemption certificate","simple-sales-tax")),(0,e.createElement)(f,{id:"exempt_state",label:(0,c.__)("Exempt state","simple-sales-tax"),country:"US",states:O,value:a.ExemptState,onChange:e=>l("ExemptState",e),required:!0}),(0,e.createElement)("div",{className:"sst-radio-group",role:"radiogroup",id:"tax_type",ariaLabelledBy:"tax_type_label"},(0,e.createElement)("label",{id:"tax_type_label"},(0,c.__)("Tax ID type","simple-sales-tax")),(0,e.createElement)(h.RadioControl,{id:"tax_type",selected:a.TaxType,options:[{label:(0,c.__)("State Issued Exemption ID or Drivers License","simple-sales-tax"),value:"StateIssued"},{label:(0,c.__)("Federal Employer ID","simple-sales-tax"),value:"FEIN"}],onChange:e=>l("TaxType",e)})),"StateIssued"===a.TaxType&&(0,e.createElement)(f,{id:"state_of_issue",label:(0,c.__)("Issuing state","simple-sales-tax"),country:"US",states:O,value:a.StateOfIssue,onChange:e=>l("StateOfIssue",e),required:!0}),(0,e.createElement)(h.ValidatedTextInput,{id:"id_number",errorId:"id_number_error",label:(0,c.__)("Tax ID","simple-sales-tax"),required:!0,type:"text",value:a.IDNumber,onChange:e=>l("IDNumber",e)}),(0,e.createElement)(g,{id:"purchaser_business_type",label:(0,c.__)("Business type","simple-sales-tax"),onChange:e=>l("PurchaserBusinessType",e),options:C,value:a.PurchaserBusinessType,required:!0}),"Other"===a.PurchaserBusinessType&&(0,e.createElement)(h.ValidatedTextInput,{id:"purchase_business_type_other_value",errorId:"purchase_business_type_other_value_error",label:(0,c.__)("Explain the nature of your business","simple-sales-tax"),required:!0,type:"text",value:a.PurchaserBusinessTypeOtherValue,onChange:e=>l("PurchaserBusinessTypeOtherValue",e),showError:i(s),errorMessage:(0,c.__)("Please explain the nature of your business","simple-sales-tax")}),(0,e.createElement)(g,{id:"purchaser_exemption_reason",label:(0,c.__)("Reason for exemption","simple-sales-tax"),onChange:e=>l("PurchaserExemptionReason",e),options:P,value:a.PurchaserExemptionReason,required:!0}),"Other"===a.PurchaserExemptionReason&&(0,e.createElement)(h.ValidatedTextInput,{id:"purchaser_exemption_reason_value",errorId:"purchaser_exemption_reason_value_error",label:(0,c.__)("Please explain","simple-sales-tax"),required:!0,type:"text",value:a.PurchaserExemptionReasonOtherValue,onChange:e=>l("PurchaserExemptionReasonOtherValue",e),showError:i(r),errorMessage:(0,c.__)("Please explain why you are tax exempt","simple-sales-tax")}))},{showExemptionForm:N,certificateOptions:D,selectedCertificate:B,isUserLoggedIn:F,myAccountEndpointUrl:L}=(0,u.getSetting)("simple-sales-tax_data",""),G=Object.entries(D).map((([e,a])=>({value:e,label:a}))),V=({className:a,children:t})=>{if(!N)return null;const[l,s]=R("certificate_id",B),{__internalIncrementCalculating:r,__internalDecrementCalculating:i}=(0,o.useDispatch)(x.CHECKOUT_STORE_KEY);return(0,e.createElement)("div",{className:a},(0,e.createElement)(h.Title,{headingLevel:"2"},(0,c.__)("Tax exemption","simple-sales-tax")),!F&&(0,e.createElement)("p",null,(0,c.__)("Please log in or register to apply an exemption certificate.","simple-sales-tax")),F&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(g,{id:"exemption-certificate-input",label:(0,c.__)("Exemption certificate","simple-sales-tax"),onChange:e=>{s(e),r(),(0,b.extensionCartUpdate)({namespace:"simple-sales-tax",data:{action:"set_certificate_id",certificate_id:e}}).finally((()=>{i()}))},options:G,value:l}),(0,e.createElement)("a",{href:L,target:"_blank"},(0,c.__)("Manage exemption certificates →","simple-sales-tax")),"new"===l&&(0,e.createElement)(A,null)))},M=JSON.parse('{"apiVersion":3,"name":"simple-sales-tax/tax-exemption","version":"1.0.0","title":"Tax Exemption Block","category":"woocommerce","description":"Adds a tax exemption form to the checkout.","supports":{"html":false,"align":false,"multiple":false,"reusable":false},"parent":["woocommerce/checkout-fields-block"],"textdomain":"simple-sales-tax","attributes":{},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}');(0,r.registerBlockType)(M,{icon:{src:(0,e.createElement)(t,{icon:s,className:"wc-block-editor-components-block-icon"})},edit:()=>{const a=(0,i.useBlockProps)();return(0,e.createElement)("div",{...a},(0,e.createElement)(n.Disabled,null,(0,e.createElement)(V,null)))},save:()=>(0,e.createElement)("div",{"data-block-name":"simple-sales-tax/tax-exemption",...i.useBlockProps.save()})})}},t={};function l(e){var s=t[e];if(void 0!==s)return s.exports;var r=t[e]={exports:{}};return a[e](r,r.exports,l),r.exports}l.m=a,e=[],l.O=(a,t,s,r)=>{if(!t){var i=1/0;for(u=0;u<e.length;u++){t=e[u][0],s=e[u][1],r=e[u][2];for(var n=!0,o=0;o<t.length;o++)(!1&r||i>=r)&&Object.keys(l.O).every((e=>l.O[e](t[o])))?t.splice(o--,1):(n=!1,r<i&&(i=r));if(n){e.splice(u--,1);var c=s();void 0!==c&&(a=c)}}return a}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[t,s,r]},l.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={476:0,575:0};l.O.j=a=>0===e[a];var a=(a,t)=>{var s,r,i=t[0],n=t[1],o=t[2],c=0;if(i.some((a=>0!==e[a]))){for(s in n)l.o(n,s)&&(l.m[s]=n[s]);if(o)var u=o(l)}for(a&&a(t);c<i.length;c++)r=i[c],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(u)},t=self.webpackChunksimplesalestax=self.webpackChunksimplesalestax||[];t.forEach(a.bind(null,0)),t.push=a.bind(null,t.push.bind(t))})();var s=l.O(void 0,[575],(()=>l(959)));s=l.O(s)})();4 (0,c.__)("Select a %s","woocommerce"),y?n:n?.toLowerCase()),disabled:!!g})),[n,E,g,y]),C=(0,a.useId)(),T=f.id||`wc-blocks-components-select-${C}`,P=b||T,k=(0,a.useMemo)((()=>g&&u?i:[O].concat(i)),[g,u,O,i]),{setValidationErrors:R,clearValidationError:I}=(0,o.useDispatch)(x.validationStore),{error:A,validationErrorId:N}=(0,o.useSelect)((e=>{const a=e(x.validationStore);return{error:a.getValidationError(P),validationErrorId:a.getValidationErrorId(P)}}));(0,a.useEffect)((()=>(!g||u?I(P):R({[P]:{message:v,hidden:!0}}),()=>{I(P)})),[I,u,P,v,g,R]);const D=(0,o.useSelect)((e=>e(x.validationStore).getValidationError(P||"")||{hidden:!0}));return(0,e.createElement)("div",{className:_(m,{"has-error":!D.hidden})},(0,e.createElement)("div",{className:"wc-blocks-components-select"},(0,e.createElement)("div",{className:"wc-blocks-components-select__container"},(0,e.createElement)("label",{htmlFor:T,className:"wc-blocks-components-select__label"},n),(0,e.createElement)("select",{className:"wc-blocks-components-select__select",id:T,size:void 0!==d?d:1,onChange:w,value:u,"aria-invalid":!(!A?.message||A?.hidden),"aria-errormessage":N,...f},k.map((a=>(0,e.createElement)("option",{key:a.value,value:a.value,"data-alternate-values":`[${a.label}]`,disabled:void 0!==a.disabled&&a.disabled},a.label)))),(0,e.createElement)(t,{className:"wc-blocks-components-select__expand",icon:p}))),(0,e.createElement)(h.ValidationInputError,{propertyName:P}))},g=window.wc.blocksCheckout,v=window.wp.htmlEntities,E=(e,a)=>{const t=a.find((a=>a.label.toLocaleUpperCase()===e.toLocaleUpperCase()||a.value.toLocaleUpperCase()===e.toLocaleUpperCase()));return t?t.value:""},f=({className:t,id:l,states:s,country:r,label:i,onChange:n,autoComplete:o="off",value:c="",required:u=!1})=>{const p=s[r],m=(0,a.useMemo)((()=>p&&Object.keys(p).length>0?Object.keys(p).map((e=>({value:e,label:(0,v.decodeEntities)(p[e])}))):[]),[p]),_=(0,a.useCallback)((e=>{const a=m.length>0?E(e,m):e;a!==c&&n(a)}),[n,m,c]),x=(0,a.useRef)(c);return(0,a.useEffect)((()=>{x.current!==c&&(x.current=c)}),[c]),(0,a.useEffect)((()=>{if(m.length>0&&x.current){const e=E(x.current,m);e!==x.current&&_(e)}}),[m,_]),m.length>0?(0,e.createElement)(b,{className:d(t,"wc-block-components-state-input"),options:m,label:i||"",id:l,onChange:_,value:c,autoComplete:o,required:u}):(0,e.createElement)(h.ValidatedTextInput,{className:t,id:l,label:i,onChange:_,autoComplete:o,value:c,required:u})},w=(0,u.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),S=(w.pluginUrl,w.pluginUrl,u.STORE_PAGES.shop,u.STORE_PAGES.checkout,u.STORE_PAGES.checkout,u.STORE_PAGES.privacy,u.STORE_PAGES.privacy,u.STORE_PAGES.terms,u.STORE_PAGES.terms,u.STORE_PAGES.cart,u.STORE_PAGES.cart,u.STORE_PAGES.myaccount?.permalink?u.STORE_PAGES.myaccount.permalink:(0,u.getSetting)("wpLoginUrl","/wp-login.php"),(0,u.getSetting)("localPickupEnabled",!1),(0,u.getSetting)("shippingMethodsExist",!1),(0,u.getSetting)("countries",{})),y=(0,u.getSetting)("countryData",{}),O=(Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowBilling)).map((e=>[e,S[e]||""]))),Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowBilling)).map((e=>[e,y[e].states||[]])))),C=(Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowShipping)).map((e=>[e,S[e]||""]))),Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowShipping)).map((e=>[e,y[e].states||[]]))),Object.fromEntries(Object.keys(y).map((e=>[e,y[e].locale||[]]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),T=((0,u.getSetting)("addressFieldsLocations",C).address,(0,u.getSetting)("addressFieldsLocations",C).contact,(0,u.getSetting)("addressFieldsLocations",C).order,(0,u.getSetting)("additionalOrderFields",{}),(0,u.getSetting)("additionalContactFields",{}),(0,u.getSetting)("additionalAddressFields",{}),[{value:"",label:(0,c.__)("Select a business type","simple-sales-tax"),disabled:!0},{value:"AccommodationAndFoodServices",label:(0,c.__)("Accommodation And Food Services","simple-sales-tax")},{value:"Agricultural_Forestry_Fishing_Hunting",label:(0,c.__)("Agricultural/Forestry/Fishing/Hunting","simple-sales-tax")},{value:"Construction",label:(0,c.__)("Construction","simple-sales-tax")},{value:"FinanceAndInsurance",label:(0,c.__)("Finance or Insurance","simple-sales-tax")},{value:"Information_PublishingAndCommunications",label:(0,c.__)("Information Publishing and Communications","simple-sales-tax")},{value:"Manufacturing",label:(0,c.__)("Manufacturing","simple-sales-tax")},{value:"Mining",label:(0,c.__)("Mining","simple-sales-tax")},{value:"RealEstate",label:(0,c.__)("Real Estate","simple-sales-tax")},{value:"RentalAndLeasing",label:(0,c.__)("Rental and Leasing","simple-sales-tax")},{value:"RetailTrade",label:(0,c.__)("Retail Trade","simple-sales-tax")},{value:"TransportationAndWarehousing",label:(0,c.__)("Transportation and Warehousing","simple-sales-tax")},{value:"Utilities",label:(0,c.__)("Utilities","simple-sales-tax")},{value:"WholesaleTrade",label:(0,c.__)("Wholesale Trade","simple-sales-tax")},{value:"BusinessServices",label:(0,c.__)("Business Services","simple-sales-tax")},{value:"ProfessionalServices",label:(0,c.__)("Professional Services","simple-sales-tax")},{value:"EducationAndHealthCareServices",label:(0,c.__)("Education and Health Care Services","simple-sales-tax")},{value:"NonprofitOrganization",label:(0,c.__)("Nonprofit Organization","simple-sales-tax")},{value:"Government",label:(0,c.__)("Government","simple-sales-tax")},{value:"NotABusiness",label:(0,c.__)("Not a Business","simple-sales-tax")},{value:"Other",label:(0,c.__)("Other","simple-sales-tax")}]),P=[{value:"",label:(0,c.__)("Select a reason","simple-sales-tax"),disabled:!0},{value:"FederalGovernmentDepartment",label:(0,c.__)("Federal Government Department","simple-sales-tax")},{value:"StateOrLocalGovernmentName",label:(0,c.__)("State Or Local Government","simple-sales-tax")},{value:"TribalGovernmentName",label:(0,c.__)("Tribal Government","simple-sales-tax")},{value:"ForeignDiplomat",label:(0,c.__)("Foreign Diplomat","simple-sales-tax")},{value:"CharitableOrganization",label:(0,c.__)("Charitable Organization","simple-sales-tax")},{value:"ReligiousOrEducationalOrganization",label:(0,c.__)("Religious or Educational Organization","simple-sales-tax")},{value:"Resale",label:(0,c.__)("Resale","simple-sales-tax")},{value:"AgriculturalProduction",label:(0,c.__)("Agricultural Production","simple-sales-tax")},{value:"IndustrialProductionOrManufacturing",label:(0,c.__)("Industrial Production or Manufacturing","simple-sales-tax")},{value:"DirectPayPermit",label:(0,c.__)("Direct Pay Permit","simple-sales-tax")},{value:"DirectMail",label:(0,c.__)("Direct Mail","simple-sales-tax")},{value:"Other",label:(0,c.__)("Other","simple-sales-tax")}],k="simple-sales-tax",R=(e,t)=>{const{__internalSetExtensionData:l}=(0,o.useDispatch)(x.CHECKOUT_STORE_KEY),s=(0,o.useSelect)((a=>{var l;const s=a(x.CHECKOUT_STORE_KEY).getExtensionData();return null!==(l=s[k]?.[e])&&void 0!==l?l:t})),r=(0,a.useCallback)((a=>{l(k,{[e]:a})}),[l]);return(0,a.useEffect)((()=>{r(t)}),[t,r]),[s,r]},I={SinglePurchase:!1,ExemptState:"",TaxType:"StateIssued",StateOfIssue:"",IDNumber:"",PurchaserBusinessType:"",PurchaserBusinessTypeOtherValue:"",PurchaserExemptionReason:"",PurchaserExemptionReasonOtherValue:""},A=()=>{const[a,t]=R("certificate",I),l=(e,l)=>{t({...a,[e]:l})},{businessTypeOtherError:s,exemptionReasonOtherError:r}=(0,o.useSelect)((e=>{const a=e(x.VALIDATION_STORE_KEY);return{businessTypeOtherError:a.getValidationError("purchase_business_type_other_value_error"),exemptionReasonOtherError:a.getValidationError("purchaser_exemption_reason_value_error")}})),i=e=>!!e?.message&&!e?.hidden;return(0,e.createElement)("div",{className:"sst-tax-exemption__form"},(0,e.createElement)("p",{class:"sst-tax-exemption__form-disclaimer"},(0,e.createElement)("strong",null,(0,c.__)("WARNING:","simple-sales-tax")),(0,c.__)("You are responsible for knowing if you qualify to claim exemption from tax in the state that is due tax on this sale. You will be held liable for any tax and interest, as well as civil and criminal penalties imposed by the member state, if you are not eligible to claim this exemption.","simple-sales-tax")),(0,e.createElement)(g.CheckboxControl,{id:"single_purchase",checked:a.SinglePurchase,onChange:e=>l("SinglePurchase",e)},(0,c.__)("This is a single-purchase exemption certificate","simple-sales-tax")),(0,e.createElement)(f,{id:"exempt_state",label:(0,c.__)("Exempt state","simple-sales-tax"),country:"US",states:O,value:a.ExemptState,onChange:e=>l("ExemptState",e),required:!0}),(0,e.createElement)("div",{className:"sst-radio-group",role:"radiogroup",id:"tax_type",ariaLabelledBy:"tax_type_label"},(0,e.createElement)("label",{id:"tax_type_label"},(0,c.__)("Tax ID type","simple-sales-tax")),(0,e.createElement)(h.RadioControl,{id:"tax_type",selected:a.TaxType,options:[{label:(0,c.__)("State Issued Exemption ID or Drivers License","simple-sales-tax"),value:"StateIssued"},{label:(0,c.__)("Federal Employer ID","simple-sales-tax"),value:"FEIN"}],onChange:e=>l("TaxType",e)})),"StateIssued"===a.TaxType&&(0,e.createElement)(f,{id:"state_of_issue",label:(0,c.__)("Issuing state","simple-sales-tax"),country:"US",states:O,value:a.StateOfIssue,onChange:e=>l("StateOfIssue",e),required:!0}),(0,e.createElement)(h.ValidatedTextInput,{id:"id_number",errorId:"id_number_error",label:(0,c.__)("Tax ID","simple-sales-tax"),required:!0,type:"text",value:a.IDNumber,onChange:e=>l("IDNumber",e)}),(0,e.createElement)(b,{id:"purchaser_business_type",label:(0,c.__)("Business type","simple-sales-tax"),onChange:e=>l("PurchaserBusinessType",e),options:T,value:a.PurchaserBusinessType,required:!0}),"Other"===a.PurchaserBusinessType&&(0,e.createElement)(h.ValidatedTextInput,{id:"purchase_business_type_other_value",errorId:"purchase_business_type_other_value_error",label:(0,c.__)("Explain the nature of your business","simple-sales-tax"),required:!0,type:"text",value:a.PurchaserBusinessTypeOtherValue,onChange:e=>l("PurchaserBusinessTypeOtherValue",e),showError:i(s),errorMessage:(0,c.__)("Please explain the nature of your business","simple-sales-tax")}),(0,e.createElement)(b,{id:"purchaser_exemption_reason",label:(0,c.__)("Reason for exemption","simple-sales-tax"),onChange:e=>l("PurchaserExemptionReason",e),options:P,value:a.PurchaserExemptionReason,required:!0}),"Other"===a.PurchaserExemptionReason&&(0,e.createElement)(h.ValidatedTextInput,{id:"purchaser_exemption_reason_value",errorId:"purchaser_exemption_reason_value_error",label:(0,c.__)("Please explain","simple-sales-tax"),required:!0,type:"text",value:a.PurchaserExemptionReasonOtherValue,onChange:e=>l("PurchaserExemptionReasonOtherValue",e),showError:i(r),errorMessage:(0,c.__)("Please explain why you are tax exempt","simple-sales-tax")}))},{showExemptionForm:N,certificateOptions:D,selectedCertificate:B,isUserLoggedIn:F,myAccountEndpointUrl:L}=(0,u.getSetting)("simple-sales-tax_data",""),G=Object.entries(D).map((([e,a])=>({value:e,label:a}))),V=({className:a,children:t})=>{if(!N)return null;const[l,s]=R("certificate_id",B),{__internalIncrementCalculating:r,__internalDecrementCalculating:i}=(0,o.useDispatch)(x.CHECKOUT_STORE_KEY);let n=(0,c.__)("No exemption certificate will be applied to this order.","simple-sales-tax");return"new"===l?n=(0,c.__)("Complete the certificate details below to apply it to this order.","simple-sales-tax"):l&&(n=(0,c.__)("This certificate will be applied to this order. Certificates are ordered newest first.","simple-sales-tax")),(0,e.createElement)("div",{className:a},(0,e.createElement)(h.Title,{headingLevel:"2"},(0,c.__)("Tax exemption","simple-sales-tax")),!F&&(0,e.createElement)("p",null,(0,c.__)("Please log in or register to apply an exemption certificate.","simple-sales-tax")),F&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(b,{id:"exemption-certificate-input",label:(0,c.__)("Certificate to apply","simple-sales-tax"),onChange:e=>{s(e),r(),(0,g.extensionCartUpdate)({namespace:"simple-sales-tax",data:{action:"set_certificate_id",certificate_id:e}}).finally((()=>{i()}))},options:G,value:l}),(0,e.createElement)("p",{className:"sst-certificate-selection-help"},n),(0,e.createElement)("a",{href:L,target:"_blank"},(0,c.__)("Manage exemption certificates →","simple-sales-tax")),"new"===l&&(0,e.createElement)(A,null)))},M=JSON.parse('{"apiVersion":3,"name":"simple-sales-tax/tax-exemption","version":"1.0.0","title":"Tax Exemption Block","category":"woocommerce","description":"Adds a tax exemption form to the checkout.","supports":{"html":false,"align":false,"multiple":false,"reusable":false},"parent":["woocommerce/checkout-fields-block"],"textdomain":"simple-sales-tax","attributes":{},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}');(0,r.registerBlockType)(M,{icon:{src:(0,e.createElement)(t,{icon:s,className:"wc-block-editor-components-block-icon"})},edit:()=>{const a=(0,i.useBlockProps)();return(0,e.createElement)("div",{...a},(0,e.createElement)(n.Disabled,null,(0,e.createElement)(V,null)))},save:()=>(0,e.createElement)("div",{"data-block-name":"simple-sales-tax/tax-exemption",...i.useBlockProps.save()})})}},t={};function l(e){var s=t[e];if(void 0!==s)return s.exports;var r=t[e]={exports:{}};return a[e](r,r.exports,l),r.exports}l.m=a,e=[],l.O=(a,t,s,r)=>{if(!t){var i=1/0;for(u=0;u<e.length;u++){t=e[u][0],s=e[u][1],r=e[u][2];for(var n=!0,o=0;o<t.length;o++)(!1&r||i>=r)&&Object.keys(l.O).every((e=>l.O[e](t[o])))?t.splice(o--,1):(n=!1,r<i&&(i=r));if(n){e.splice(u--,1);var c=s();void 0!==c&&(a=c)}}return a}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[t,s,r]},l.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={476:0,575:0};l.O.j=a=>0===e[a];var a=(a,t)=>{var s,r,i=t[0],n=t[1],o=t[2],c=0;if(i.some((a=>0!==e[a]))){for(s in n)l.o(n,s)&&(l.m[s]=n[s]);if(o)var u=o(l)}for(a&&a(t);c<i.length;c++)r=i[c],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(u)},t=self.webpackChunksimplesalestax=self.webpackChunksimplesalestax||[];t.forEach(a.bind(null,0)),t.push=a.bind(null,t.push.bind(t))})();var s=l.O(void 0,[575],(()=>l(959)));s=l.O(s)})(); -
simple-sales-tax/tags/8.4.16/changelog.txt
r3655406 r3669483 2 2 3 3 Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 4 5 - [8.4.16] - 2026-08-27 = 6 7 Added: 8 - [DEV-9165] - Improve exemption certificate fetching and selection UX (#460) 9 10 Fixed: 11 - Fix: Prevent page form submission during TIC selection (#459) 12 - [DEV-8729] - Fix: Capture and filter Stripe Express Checkout totals to ensure tax-inclusive accuracy during AJAX requests (#457) 13 - [DEV-9333] - Fix rate limit trigger (#456) 14 - [DEV-9333] - Fix: Optimize API calls by fixing guest package caching and address verification (#455) 15 4 16 5 17 - [8.4.15] - 2026-08-20 = -
simple-sales-tax/tags/8.4.16/includes/abstracts/class-sst-abstract-cart.php
r3630538 r3669483 237 237 238 238 try { 239 $rate_limit->increment_count(); 240 239 241 $package['response'] = TaxCloud()->Lookup( $package['request'] ); 240 242 … … 246 248 247 249 $package['cart_id'] = key( $package['response'] ); 248 249 $rate_limit->increment_count();250 250 251 251 SST_Logger::debug( __( 'Tax lookup response:', 'simple-sales-tax' ), $package ); -
simple-sales-tax/tags/8.4.16/includes/class-simplesalestax.php
r3655406 r3669483 21 21 * @var string 22 22 */ 23 public $version = '8.4.1 5';23 public $version = '8.4.16'; 24 24 25 25 /** -
simple-sales-tax/tags/8.4.16/includes/class-sst-addresses.php
r3530282 r3669483 87 87 */ 88 88 public static function verify_address( $address ) { 89 if ( is_null( $address ) || ! is_a( $address, 'TaxCloud\Address' ) ) { 90 return $address; 91 } 92 93 // TaxCloud VerifyAddress requires a street address (Address1) and Zip5. 94 // If either is missing, skip the API call to avoid 400 Bad Request errors. 95 if ( empty( $address->getAddress1() ) || empty( $address->getZip5() ) ) { 96 return $address; 97 } 98 89 99 $addresses = get_transient( 'sst_verified_addresses' ); 90 100 … … 115 125 } 116 126 127 $rate_limit->increment_count(); 128 117 129 $request = new TaxCloud\Request\VerifyAddress( 118 130 SST_Settings::get( 'tc_id' ), … … 122 134 $address = TaxCloud()->VerifyAddress( $request ); 123 135 124 $rate_limit->increment_count();125 126 136 // Cache verified address. 127 137 $addresses[ $md5_hash ] = wp_json_encode( $address ); 128 138 129 // Cache validated addresses for 3days.139 // Cache validated addresses for 2 days. 130 140 set_transient( 'sst_verified_addresses', $addresses, 2 * DAY_IN_SECONDS ); 131 141 } catch ( Exception $ex ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch 132 142 SST_Logger::add( 'Failed to verify address: ' . $ex->getMessage() ); 133 // Leave address as-is. 143 // Cache unverified address as-is to avoid repeated failed API requests. 144 $addresses[ $md5_hash ] = wp_json_encode( $address ); 145 set_transient( 'sst_verified_addresses', $addresses, 2 * DAY_IN_SECONDS ); 134 146 } 135 147 -
simple-sales-tax/tags/8.4.16/includes/class-sst-blocks-integration.php
r3630538 r3669483 108 108 $certificates = SST_Certificates::get_certificates_formatted(); 109 109 $options = array( 110 'new' => 'Add new certificate',110 'new' => __( 'Add a new certificate', 'simple-sales-tax' ), 111 111 ); 112 112 113 113 foreach ( $certificates as $cert ) { 114 $options[ $cert['CertificateID'] ] = $cert[' Description'];114 $options[ $cert['CertificateID'] ] = $cert['CheckoutDescription']; 115 115 } 116 116 -
simple-sales-tax/tags/8.4.16/includes/class-sst-certificates.php
r3655406 r3669483 133 133 */ 134 134 public static function format_certificate( $certificate ) { 135 $detail = $certificate->getDetail(); 136 $formatted = array( 137 'CertificateID' => $certificate->getCertificateID(), 138 'PurchaserName' => $detail->getPurchaserFirstName() . ' ' . $detail->getPurchaserLastName(), 139 'CreatedDate' => gmdate( 'm/d/Y', strtotime( $detail->getCreatedDate() ) ), 135 $detail = $certificate->getDetail(); 136 $certificate_id = $certificate->getCertificateID(); 137 $created_date = $detail->getCreatedDate(); 138 $created_time = strtotime( $created_date ); 139 $exempt_states = self::get_exempt_state_abbreviations( $detail ); 140 $purchaser_name = trim( $detail->getPurchaserFirstName() . ' ' . $detail->getPurchaserLastName() ); 141 $short_id = self::get_short_certificate_id( $certificate_id ); 142 $formatted = array( 143 'CertificateID' => $certificate_id, 144 'CertificateLabel' => $short_id 145 ? sprintf( __( 'ID %s…', 'simple-sales-tax' ), $short_id ) 146 : __( 'ID unavailable', 'simple-sales-tax' ), 147 'PurchaserName' => $purchaser_name ?: __( 'Purchaser not specified', 'simple-sales-tax' ), 148 'CreatedDate' => self::format_certificate_datetime( $created_time ), 149 'CreatedTimestamp' => $created_time ?: 0, 150 'ExemptStates' => $exempt_states, 151 'ExemptStatesLabel' => $exempt_states 152 ? implode( ', ', $exempt_states ) 153 : __( 'States not specified', 'simple-sales-tax' ), 140 154 'PurchaserAddress' => $detail->getPurchaserAddress1(), 141 155 'PurchaserState' => sst_prettify( $detail->getPurchaserState() ), 142 'PurchaserExemptionReason' => sst_prettify( $detail->getPurchaserExemptionReason() ) ,156 'PurchaserExemptionReason' => sst_prettify( $detail->getPurchaserExemptionReason() ) ?: __( 'Exemption certificate', 'simple-sales-tax' ), 143 157 'SinglePurchase' => $detail->getSinglePurchase(), 144 158 'SinglePurchaserOrderNumber' => $detail->getSinglePurchaseOrderNumber(), 145 159 'TaxType' => sst_prettify( $detail->getPurchaserTaxID()->getTaxType() ), 146 160 'IDNumber' => $detail->getPurchaserTaxID()->getIDNumber(), 147 'PurchaserBusinessType' => sst_prettify( $detail->getPurchaserBusinessType() ) ,161 'PurchaserBusinessType' => sst_prettify( $detail->getPurchaserBusinessType() ) ?: __( 'Business type not specified', 'simple-sales-tax' ), 148 162 'Description' => self::get_certificate_description( 149 $detail 163 $detail, 164 $certificate_id 165 ), 166 'CheckoutDescription' => self::get_checkout_certificate_description( 167 $detail, 168 $certificate_id 150 169 ), 151 170 'SellerName' => SST_Settings::get( 'company_name' ), … … 158 177 * Get a text description of a certificate. 159 178 * 179 * @param TaxCloud\ExemptionCertificateDetail $detail Certificate details. 180 * @param string $certificate_id Certificate ID. 181 * 182 * @return string 183 */ 184 protected static function get_certificate_description( $detail, $certificate_id = '' ) { 185 $states = self::get_exempt_state_abbreviations( $detail ); 186 $state_label = $states ? implode( ', ', $states ) : __( 'States not specified', 'simple-sales-tax' ); 187 $reason = sst_prettify( $detail->getPurchaserExemptionReason() ) ?: __( 'Exemption certificate', 'simple-sales-tax' ); 188 $purchaser_name = trim( $detail->getPurchaserFirstName() . ' ' . $detail->getPurchaserLastName() ); 189 $created_time = strtotime( $detail->getCreatedDate() ); 190 $created_date = self::format_certificate_datetime( $created_time, true ); 191 $short_id = self::get_short_certificate_id( $certificate_id ); 192 $parts = array( 193 $state_label, 194 $reason, 195 ); 196 197 if ( $purchaser_name ) { 198 $parts[] = $purchaser_name; 199 } 200 201 /* translators: %s: certificate creation date. */ 202 $parts[] = sprintf( __( 'Added %s', 'simple-sales-tax' ), $created_date ); 203 204 if ( $short_id ) { 205 /* translators: %s: first characters of the certificate ID. */ 206 $parts[] = sprintf( __( 'ID %s…', 'simple-sales-tax' ), $short_id ); 207 } 208 209 return implode( ' • ', $parts ); 210 } 211 212 /** 213 * Get a concise certificate description for checkout selectors. 214 * 215 * @param TaxCloud\ExemptionCertificateDetail $detail Certificate details. 216 * @param string $certificate_id Certificate ID. 217 * 218 * @return string 219 */ 220 protected static function get_checkout_certificate_description( $detail, $certificate_id = '' ) { 221 $states = self::get_exempt_state_abbreviations( $detail ); 222 $state_label = $states ? implode( ', ', $states ) : __( 'States not specified', 'simple-sales-tax' ); 223 $created_time = strtotime( $detail->getCreatedDate() ); 224 $short_id = self::get_short_certificate_id( $certificate_id ); 225 $parts = array( 226 $state_label, 227 self::format_checkout_certificate_datetime( $created_time ), 228 ); 229 230 if ( $short_id ) { 231 /* translators: %s: first characters of the certificate ID. */ 232 $parts[] = sprintf( __( '#%s', 'simple-sales-tax' ), $short_id ); 233 } 234 235 return implode( ' · ', $parts ); 236 } 237 238 /** 239 * Format a compact certificate creation time for checkout selectors. 240 * 241 * The current year is omitted to keep frequently used options concise. 242 * 243 * @param int $timestamp Unix timestamp. 244 * 245 * @return string 246 */ 247 protected static function format_checkout_certificate_datetime( $timestamp ) { 248 if ( ! $timestamp ) { 249 return __( 'Date unavailable', 'simple-sales-tax' ); 250 } 251 252 $date_format = wp_date( 'Y', $timestamp ) === wp_date( 'Y' ) ? 'M j' : 'M j, Y'; 253 $time_format = get_option( 'time_format', 'g:i a' ); 254 255 return sprintf( 256 /* translators: 1: certificate creation date, 2: certificate creation time. */ 257 __( '%1$s, %2$s', 'simple-sales-tax' ), 258 wp_date( $date_format, $timestamp ), 259 wp_date( $time_format, $timestamp ) 260 ); 261 } 262 263 /** 264 * Format a certificate creation time in the WordPress site timezone. 265 * 266 * @param int $timestamp Unix timestamp. 267 * @param bool $compact Whether to use a compact date for option labels. 268 * 269 * @return string 270 */ 271 protected static function format_certificate_datetime( $timestamp, $compact = false ) { 272 if ( ! $timestamp ) { 273 return __( 'Date unavailable', 'simple-sales-tax' ); 274 } 275 276 $date_format = $compact ? 'M j, Y' : get_option( 'date_format', 'F j, Y' ); 277 $time_format = get_option( 'time_format', 'g:i a' ); 278 279 return sprintf( 280 /* translators: 1: certificate creation date, 2: certificate creation time. */ 281 __( '%1$s at %2$s', 'simple-sales-tax' ), 282 wp_date( $date_format, $timestamp ), 283 wp_date( $time_format, $timestamp ) 284 ); 285 } 286 287 /** 288 * Get the state abbreviations covered by a certificate. 289 * 160 290 * @param TaxCloud\ExemptionCertificateDetail $detail Certificate details. 161 291 * 292 * @return string[] 293 */ 294 protected static function get_exempt_state_abbreviations( $detail ) { 295 $states = array(); 296 297 foreach ( (array) $detail->getExemptStates() as $state ) { 298 if ( is_object( $state ) && method_exists( $state, 'getStateAbbr' ) ) { 299 $state_abbr = strtoupper( (string) $state->getStateAbbr() ); 300 if ( $state_abbr ) { 301 $states[] = $state_abbr; 302 } 303 } 304 } 305 306 return array_values( array_unique( $states ) ); 307 } 308 309 /** 310 * Get a compact, recognizable portion of a certificate ID. 311 * 312 * @param string $certificate_id Certificate ID. 313 * 162 314 * @return string 163 315 */ 164 protected static function get_certificate_description( $detail ) { 165 $state = current( $detail->GetExemptStates() ); 166 $state_abbr = $state->GetStateAbbr(); 167 $id_type = sst_prettify( $detail->getPurchaserTaxID()->getTaxType() ); 168 $id_number = $detail->getPurchaserTaxID()->getIDNumber(); 169 $date = gmdate( 'm/d/Y', strtotime( $detail->getCreatedDate() ) ); 170 171 return sprintf( 172 /* translators: 1 - state issued, 2 - tax id, 3 - date created */ 173 __( '%1$s - %2$s (created %3$s)', 'simple-sales-tax' ), 174 $state_abbr, 175 $id_number, 176 $date 177 ); 316 protected static function get_short_certificate_id( $certificate_id ) { 317 $certificate_id = trim( (string) $certificate_id ); 318 319 return $certificate_id ? substr( $certificate_id, 0, 8 ) : ''; 178 320 } 179 321 … … 203 345 } 204 346 205 // Sort by created date ascending.347 // Sort newest first so the most relevant certificate is easiest to find. 206 348 uasort( $certificates, function( $cert_a, $cert_b ) { 207 $date_a = isset( $cert_a['Created Date'] ) ? strtotime( $cert_a['CreatedDate'] ): 0;208 $date_b = isset( $cert_b['Created Date'] ) ? strtotime( $cert_b['CreatedDate'] ): 0;349 $date_a = isset( $cert_a['CreatedTimestamp'] ) ? (int) $cert_a['CreatedTimestamp'] : 0; 350 $date_b = isset( $cert_b['CreatedTimestamp'] ) ? (int) $cert_b['CreatedTimestamp'] : 0; 209 351 if ( $date_a === $date_b ) { 210 return 0;211 } 212 return $date_a < $date_b ? -1 :1;352 return strcmp( $cert_b['CertificateID'], $cert_a['CertificateID'] ); 353 } 354 return $date_a < $date_b ? 1 : -1; 213 355 } ); 214 356 -
simple-sales-tax/tags/8.4.16/includes/frontend/class-sst-checkout.php
r3630538 r3669483 28 28 29 29 /** 30 * Tax-inclusive total captured during a Stripe Express Checkout calculation. 31 * 32 * @var float|null 33 */ 34 private $stripe_express_checkout_total = null; 35 36 /** 30 37 * Cart validation errors. 31 38 * … … 41 48 public function __construct() { 42 49 add_filter( 'woocommerce_calculated_total', array( $this, 'calculate_tax_totals' ), 1100, 2 ); 50 add_filter( 'wc_stripe_calculated_total', array( $this, 'filter_stripe_calculated_total' ), 10, 3 ); 43 51 add_filter( 'woocommerce_cart_hide_zero_taxes', array( $this, 'hide_zero_taxes' ) ); 44 52 add_action( 'woocommerce_checkout_order_created', array( $this, 'handle_legacy_checkout' ) ); … … 103 111 $this->cart = new SST_Cart_Proxy( $cart ); 104 112 113 $is_stripe_express_checkout_request = $this->is_stripe_express_checkout_request(); 114 105 115 $should_calculate = ( 106 116 is_cart() || … … 109 119 $this->is_store_api_request() || 110 120 $this->is_edit_subscription_request() || 111 $ this->is_stripe_express_checkout_request()121 $is_stripe_express_checkout_request 112 122 ); 113 123 … … 117 127 /** 118 128 * Skip tax calculation if real-time tax calculation is disabled. [Data Import Mode] 129 * 119 130 * @since 8.4.1 120 131 */ … … 124 135 } 125 136 137 $taxes = $this->cart->get_taxes(); 138 126 139 /** 127 140 * Woo won't include the taxes calculated by SST in the total so 128 141 * we add them in here. 129 142 */ 130 foreach ( $t his->cart->get_taxes()as $rate_id => $tax ) {131 if ( (int) SST_RATE_ID === $rate_id ) {132 $tax_total += $tax;143 foreach ( $taxes as $rate_id => $tax ) { 144 if ( (int) SST_RATE_ID === (int) $rate_id ) { 145 $tax_total += (float) $tax; 133 146 } 134 147 } 135 } 136 137 $this->cart->set_total_tax( WC_Tax::get_tax_total( $this->cart->get_taxes() ) ); 138 139 return $total + $tax_total; 148 149 $this->cart->set_total_tax( WC_Tax::get_tax_total( $taxes ) ); 150 } 151 152 $calculated_total = (float) $total + $tax_total; 153 154 if ( $is_stripe_express_checkout_request ) { 155 $this->stripe_express_checkout_total = $calculated_total; 156 } 157 158 return $calculated_total; 140 159 } 141 160 … … 171 190 */ 172 191 protected function is_stripe_express_checkout_request() { 173 global $wp_query; 174 return defined( 'WC_DOING_AJAX' ) && 'wc_stripe_get_shipping_options' === $wp_query->get( 'wc-ajax' ); 192 $express_checkout_actions = array( 193 'wc_stripe_get_cart_details', 194 'wc_stripe_get_shipping_options', 195 'wc_stripe_update_shipping_method', 196 'wc_stripe_add_to_cart', 197 'wc_stripe_get_selected_product_data', 198 ); 199 200 foreach ( $express_checkout_actions as $action ) { 201 if ( doing_action( 'wc_ajax_' . $action ) ) { 202 return true; 203 } 204 } 205 206 if ( ! defined( 'WC_DOING_AJAX' ) || ! WC_DOING_AJAX ) { 207 return false; 208 } 209 210 // WC AJAX endpoints are passed in the query string. Read it directly 211 // because the query variable is not reliable throughout every AJAX lifecycle. 212 // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Reading the WooCommerce routing argument only. 213 $ajax_action = isset( $_GET['wc-ajax'] ) 214 ? sanitize_key( wp_unslash( $_GET['wc-ajax'] ) ) 215 : ''; 216 // phpcs:enable WordPress.Security.NonceVerification.Recommended 217 218 if ( '' === $ajax_action ) { 219 global $wp_query; 220 221 if ( $wp_query instanceof WP_Query ) { 222 $ajax_action = sanitize_key( $wp_query->get( 'wc-ajax' ) ); 223 } 224 } 225 226 return in_array( $ajax_action, $express_checkout_actions, true ); 227 } 228 229 /** 230 * Supply Stripe with the tax-inclusive total captured during calculation. 231 * 232 * Stripe's response builder can observe cart totals after TaxCloud's tax state 233 * has been reset. Use the value captured earlier on this request, while the 234 * TaxCloud result and WooCommerce total were synchronized. 235 * 236 * @param float $calculated_total Stripe total in the currency's smallest unit. 237 * @param float $order_total WooCommerce cart total in store currency. 238 * @param WC_Cart $cart WooCommerce cart instance. 239 * 240 * @return float 241 */ 242 public function filter_stripe_calculated_total( $calculated_total, $order_total, $cart ) { 243 if ( 244 ! $cart || 245 ! class_exists( 'WC_Stripe_Helper' ) || 246 'yes' === SST_Settings::get( 'disable_integration', 'no' ) || 247 ! $this->is_stripe_express_checkout_request() || 248 null === $this->stripe_express_checkout_total 249 ) { 250 return $calculated_total; 251 } 252 253 $stripe_total = WC_Stripe_Helper::get_stripe_amount( 254 $this->stripe_express_checkout_total, 255 get_woocommerce_currency() 256 ); 257 258 return max( 0, $stripe_total ); 175 259 } 176 260 … … 956 1040 $certificates = SST_Certificates::get_certificates_formatted(); 957 1041 $options = array( 958 'none' => __( ' Select a exemption certificate', 'simple-sales-tax' ),959 'new' => __( 'Add new certificate', 'simple-sales-tax' ),1042 'none' => __( 'No certificate — do not apply a tax exemption', 'simple-sales-tax' ), 1043 'new' => __( 'Add a new certificate', 'simple-sales-tax' ), 960 1044 ); 961 1045 962 1046 foreach ( $certificates as $cert ) { 963 $options[ $cert['CertificateID'] ] = $cert[' Description'];1047 $options[ $cert['CertificateID'] ] = $cert['CheckoutDescription']; 964 1048 } 965 1049 … … 1117 1201 */ 1118 1202 protected function is_package_valid( $package ) { 1203 if ( ! is_array( $package ) ) { 1204 return false; 1205 } 1206 1119 1207 // Check if package has required keys 1120 1208 $required_keys = array( 'cart_items', 'customer_id' ); 1121 1209 1122 1210 foreach ( $required_keys as $key ) { 1123 1211 if ( ! isset( $package[ $key ] ) ) { … … 1131 1219 } 1132 1220 1133 // Check if customer_id is valid 1134 if ( empty( $package['customer_id'] ) ) {1221 // Check if customer_id is valid (0 is valid for guest users) 1222 if ( ! is_numeric( $package['customer_id'] ) && empty( $package['customer_id'] ) ) { 1135 1223 return false; 1136 1224 } -
simple-sales-tax/tags/8.4.16/includes/frontend/views/html-checkout.php
r3326417 r3669483 42 42 'placeholder' => 'None', 43 43 'options' => $args['options'], 44 'label' => esc_html__( ' Exemption certificate', 'simple-sales-tax' ),44 'label' => esc_html__( 'Certificate to apply', 'simple-sales-tax' ), 45 45 'input_class' => array( 'sst-input' ), 46 46 ), … … 48 48 ); 49 49 ?> 50 <p class="sst-certificate-selection-help"> 51 <?php esc_html_e( 'The selected certificate will be applied to this order. Certificates are ordered newest first.', 'simple-sales-tax' ); ?> 52 </p> 50 53 51 54 <p id="exemption_certificates_link"> -
simple-sales-tax/tags/8.4.16/includes/sst-functions.php
r3655406 r3669483 480 480 'ajaxurl' => admin_url( 'admin-ajax.php' ), 481 481 'strings' => array( 482 'delete_failed' => __( 'Failed to delete certificate', 'simple-sales-tax' ), 483 'add_failed' => __( 'Failed to add certificate', 'simple-sales-tax' ), 484 'refresh_failed' => __( 'Failed to refresh certificates', 'simple-sales-tax' ), 485 'fetch_failed' => __( 'Failed to load exemption certificates', 'simple-sales-tax' ), 486 'loading' => __( 'Loading exemption certificates...', 'simple-sales-tax' ), 487 'delete_certificate' => __( 482 'delete_failed' => __( 'Failed to delete certificate', 'simple-sales-tax' ), 483 'add_failed' => __( 'Failed to add certificate', 'simple-sales-tax' ), 484 'refresh_failed' => __( 'Failed to refresh certificates', 'simple-sales-tax' ), 485 'fetch_failed' => __( 'Failed to load exemption certificates', 'simple-sales-tax' ), 486 'loading' => __( 'Loading exemption certificates...', 'simple-sales-tax' ), 487 'showing_certificates' => __( 'Showing %1$d of %2$d certificates', 'simple-sales-tax' ), 488 'delete_certificate' => __( 488 489 'Are you sure you want to delete this certificate? This action is irreversible.', 489 490 'simple-sales-tax' -
simple-sales-tax/tags/8.4.16/includes/v3/Exemptions.php
r3655406 r3669483 154 154 155 155 foreach ( $customer_ids as $cid ) { 156 $url = add_query_arg( array( 'customerId' => $cid ), $base_url ); 156 $url = add_query_arg( 157 array( 158 'customerId' => $cid, 159 'limit' => 100, 160 ), 161 $base_url 162 ); 157 163 $ch = curl_init(); 158 164 … … 202 208 // Fallback: Sequential execution 203 209 foreach ( $customer_ids as $cid ) { 204 $response = $this->get_certificates( array( 'customerId' => $cid ) ); 210 $response = $this->get_certificates( 211 array( 212 'customerId' => $cid, 213 'limit' => 100, 214 ) 215 ); 205 216 if ( ! is_wp_error( $response ) && isset( $response['items'] ) && is_array( $response['items'] ) ) { 206 217 foreach ( $response['items'] as $item ) { -
simple-sales-tax/tags/8.4.16/includes/vendor/composer/installed.php
r3655406 r3669483 2 2 'root' => array( 3 3 'name' => 'simplesalestax/simplesalestax', 4 'pretty_version' => 'v8.4.1 5',5 'version' => '8.4.1 5.0',6 'reference' => ' 833f73d80826784c9ea9745fa51254184f443f54',4 'pretty_version' => 'v8.4.16', 5 'version' => '8.4.16.0', 6 'reference' => 'e0233cce5f619d0742cdccc240ad30eb4e54183b', 7 7 'type' => 'project', 8 8 'install_path' => __DIR__ . '/../../../', … … 21 21 ), 22 22 'simplesalestax/simplesalestax' => array( 23 'pretty_version' => 'v8.4.1 5',24 'version' => '8.4.1 5.0',25 'reference' => ' 833f73d80826784c9ea9745fa51254184f443f54',23 'pretty_version' => 'v8.4.16', 24 'version' => '8.4.16.0', 25 'reference' => 'e0233cce5f619d0742cdccc240ad30eb4e54183b', 26 26 'type' => 'project', 27 27 'install_path' => __DIR__ . '/../../../', -
simple-sales-tax/tags/8.4.16/includes/views/html-certificate-list.php
r3655406 r3669483 14 14 $table_class = $args['table_class'] ?? 'shop_table'; 15 15 $show_inputs = $args['show_inputs'] ?? true; 16 $column_count = $show_inputs ? 5 : 4; 16 17 17 18 ?> … … 20 21 <tr> 21 22 <?php if ( $show_inputs ): ?> 22 <th><!-- Radio button column --></th> 23 <th class="sst-certificate-select-column"> 24 <span class="screen-reader-text"><?php esc_html_e( 'Select', 'simple-sales-tax' ); ?></span> 25 </th> 23 26 <?php endif; ?> 24 <th><?php esc_html_e( ' ID', 'simple-sales-tax' ); ?></th>27 <th><?php esc_html_e( 'Certificate', 'simple-sales-tax' ); ?></th> 25 28 <th><?php esc_html_e( 'Issued To', 'simple-sales-tax' ); ?></th> 26 <th><?php esc_html_e( ' Date', 'simple-sales-tax' ); ?></th>29 <th><?php esc_html_e( 'Added', 'simple-sales-tax' ); ?></th> 27 30 <th><?php esc_html_e( 'Actions', 'simple-sales-tax' ); ?></th> 28 31 </tr> … … 30 33 <tfoot> 31 34 <tr> 32 <td colspan="5"> 33 <a href="#" class="button sst-certificate-add"> 34 <?php esc_html_e( 'Add Certificate', 'simple-sales-tax' ); ?> 35 </a> 36 <a href="#" class="button sst-certificate-refresh" style="margin-left: 5px;"> 37 <?php esc_html_e( 'Refresh Certificates', 'simple-sales-tax' ); ?> 38 </a> 35 <td colspan="<?php echo esc_attr( $column_count ); ?>"> 36 <div class="sst-certificate-table-footer"> 37 <div class="sst-certificate-table-actions"> 38 <a href="#" class="button sst-certificate-add"> 39 <?php esc_html_e( 'Add Certificate', 'simple-sales-tax' ); ?> 40 </a> 41 <a href="#" class="button sst-certificate-refresh"> 42 <?php esc_html_e( 'Refresh Certificates', 'simple-sales-tax' ); ?> 43 </a> 44 </div> 45 <div class="sst-certificate-table-pagination" hidden> 46 <span class="sst-certificate-count" aria-live="polite"></span> 47 <button type="button" class="button-link sst-certificate-show-more"> 48 <?php esc_html_e( 'Show more', 'simple-sales-tax' ); ?> 49 </button> 50 </div> 51 </div> 39 52 </td> 40 53 </tr> … … 45 58 <script type="text/html" id="tmpl-sst-certificate-row-blank"> 46 59 <tr> 47 <td colspan=" 5">60 <td colspan="<?php echo esc_attr( $column_count ); ?>" class="sst-certificate-table-message"> 48 61 <span> 49 62 <?php … … 60 73 <script type="text/html" id="tmpl-sst-certificate-row-loading"> 61 74 <tr class="sst-certificate-row-loading"> 62 <td colspan=" 5" style="text-align: center; padding: 18px 12px; color: #666;">63 <span class="spinner is-active" style="float: none; margin: 0 8px 0 0; vertical-align: middle; visibility: visible;"></span>75 <td colspan="<?php echo esc_attr( $column_count ); ?>" class="sst-certificate-table-message"> 76 <span class="spinner is-active"></span> 64 77 <span> 65 78 <?php esc_html_e( 'Loading exemption certificates...', 'simple-sales-tax' ); ?> … … 72 85 <tr data-id="{{ data.CertificateID }}"> 73 86 <?php if ( $show_inputs ): ?> 74 <td >87 <td class="sst-certificate-select-column" data-title="<?php esc_attr_e( 'Select', 'simple-sales-tax' ); ?>"> 75 88 <input 76 89 type="radio" 77 90 name="certificate_id" 78 value="{{ data.CertificateID }}"> 91 value="{{ data.CertificateID }}" 92 aria-label="<?php esc_attr_e( 'Select certificate', 'simple-sales-tax' ); ?> {{ data.CertificateLabel }}"> 79 93 </td> 80 94 <?php endif; ?> 81 <td>{{ data.Index }}</td> 82 <td>{{ data.PurchaserName }}</td> 83 <td>{{ data.CreatedDate }}</td> 84 <td> 95 <td class="sst-certificate-summary" data-title="<?php esc_attr_e( 'Certificate', 'simple-sales-tax' ); ?>"> 96 <strong>{{ data.PurchaserExemptionReason }}</strong> 97 <span class="sst-certificate-meta"> 98 <?php esc_html_e( 'States:', 'simple-sales-tax' ); ?> {{ data.ExemptStatesLabel }} 99 </span> 100 <code>{{ data.CertificateLabel }}</code> 101 </td> 102 <td data-title="<?php esc_attr_e( 'Issued To', 'simple-sales-tax' ); ?>"> 103 <strong>{{ data.PurchaserName }}</strong> 104 <span class="sst-certificate-meta">{{ data.PurchaserBusinessType }}</span> 105 </td> 106 <td data-title="<?php esc_attr_e( 'Added', 'simple-sales-tax' ); ?>"> 107 <span>{{ data.CreatedDate }}</span> 108 </td> 109 <td data-title="<?php esc_attr_e( 'Actions', 'simple-sales-tax' ); ?>"> 85 110 <a href="#" class="sst-certificate-view" role="button"> 86 111 <?php esc_html_e( 'View', 'simple-sales-tax' ); ?> -
simple-sales-tax/tags/8.4.16/includes/views/html-select-tic-modal.php
r2970922 r3669483 53 53 </header> 54 54 <article> 55 <form action="" method="post" >55 <form action="" method="post" onsubmit="return false;"> 56 56 <input name="search" class="<?php echo esc_attr( implode( ' ', $input_classes ) ); ?>" 57 57 placeholder="<?php esc_attr_e( 'Start typing to search', 'simple-sales-tax' ); ?>" type="text" -
simple-sales-tax/tags/8.4.16/languages/simple-sales-tax.pot
r3655406 r3669483 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: simple-sales-tax 8.4.1 5\n"5 "Project-Id-Version: simple-sales-tax 8.4.16\n" 6 6 "Report-Msgid-Bugs-To: TaxCloud <EMAIL>\n" 7 7 "MIME-Version: 1.0\n" … … 9 9 "Content-Type: text/plain; charset=iso-8859-1\n" 10 10 "Plural-Forms: nplurals=2; plural=(n!=1);\n" 11 "POT-Creation-Date: 2026-08- 19T22:02:41.531Z\n"11 "POT-Creation-Date: 2026-08-27T20:30:05.011Z\n" 12 12 "PO-Revision-Date: 2026-MO-DA HO:MI+ZONE\n" 13 13 "Last-Translator: TaxCloud <EMAIL>\n" … … 76 76 #: includes/sst-functions.php:257 77 77 #: includes/views/html-select-tic-modal.php:35 78 #: includes/views/html-certificate-list.php:24 79 #: includes/views/html-certificate-list.php:87 78 80 msgid "Select" 79 81 msgstr "" … … 116 118 117 119 #: includes/sst-functions.php:486 118 #: includes/views/html-certificate-list.php: 65120 #: includes/views/html-certificate-list.php:78 119 121 msgid "Loading exemption certificates..." 120 122 msgstr "" 121 123 122 124 #: includes/sst-functions.php:487 125 msgid "Showing %1$d of %2$d certificates" 126 msgstr "" 127 128 #: includes/sst-functions.php:488 123 129 msgid "" 124 130 "Are you sure you want to delete this certificate? This action is " … … 126 132 msgstr "" 127 133 128 #: includes/sst-functions.php:57 2134 #: includes/sst-functions.php:573 129 135 msgid "Sales Tax" 130 136 msgstr "" … … 799 805 msgstr "" 800 806 801 # 1 - state issued, 2 - tax id, 3 - date created 802 #: includes/class-sst-certificates.php:173 803 msgid "%1$s - %2$s (created %3$s)" 807 #: includes/class-sst-certificates.php:145 808 #: includes/class-sst-certificates.php:206 809 msgid "ID %s?" 810 msgstr "" 811 812 #: includes/class-sst-certificates.php:146 813 msgid "ID unavailable" 814 msgstr "" 815 816 #: includes/class-sst-certificates.php:147 817 msgid "Purchaser not specified" 818 msgstr "" 819 820 #: includes/class-sst-certificates.php:153 821 #: includes/class-sst-certificates.php:186 822 #: includes/class-sst-certificates.php:222 823 msgid "States not specified" 824 msgstr "" 825 826 #: includes/class-sst-certificates.php:156 827 #: includes/class-sst-certificates.php:187 828 msgid "Exemption certificate" 829 msgstr "" 830 831 #: includes/class-sst-certificates.php:161 832 msgid "Business type not specified" 833 msgstr "" 834 835 #: includes/class-sst-certificates.php:202 836 msgid "Added %s" 837 msgstr "" 838 839 #: includes/class-sst-certificates.php:232 840 msgid "#%s" 841 msgstr "" 842 843 #: includes/class-sst-certificates.php:249 844 #: includes/class-sst-certificates.php:273 845 msgid "Date unavailable" 846 msgstr "" 847 848 # 1: certificate creation date, 2: certificate creation time. 849 #: includes/class-sst-certificates.php:257 850 msgid "%1$s, %2$s" 851 msgstr "" 852 853 # 1: certificate creation date, 2: certificate creation time. 854 #: includes/class-sst-certificates.php:281 855 msgid "%1$s at %2$s" 804 856 msgstr "" 805 857 806 858 # 1 - error message 807 #: includes/class-sst-certificates.php: 490859 #: includes/class-sst-certificates.php:632 808 860 msgid "Failed to add exemption certificate. Error was: %1$s" 809 861 msgstr "" 810 862 811 #: includes/class-sst-certificates.php: 584863 #: includes/class-sst-certificates.php:726 812 864 msgid "V3 exemption certificate payload:" 813 865 msgstr "" 814 866 815 867 # 1 - error message 816 #: includes/class-sst-certificates.php: 617868 #: includes/class-sst-certificates.php:759 817 869 msgid "Failed to add exemption certificate object. Error was: %1$s" 870 msgstr "" 871 872 #: includes/class-sst-blocks-integration.php:110 873 #: includes/frontend/class-sst-checkout.php:1043 874 msgid "Add a new certificate" 818 875 msgstr "" 819 876 … … 995 1052 996 1053 #: includes/views/html-meta-box.php:88 1054 #: includes/views/html-certificate-list.php:92 997 1055 msgid "Select certificate" 998 1056 msgstr "" … … 1006 1064 msgstr "" 1007 1065 1008 #: includes/views/html-certificate-list.php:24 1009 msgid "ID" 1010 msgstr "" 1011 1012 #: includes/views/html-certificate-list.php:25 1066 #: includes/views/html-certificate-list.php:27 1067 #: includes/views/html-certificate-list.php:95 1068 msgid "Certificate" 1069 msgstr "" 1070 1071 #: includes/views/html-certificate-list.php:28 1072 #: includes/views/html-certificate-list.php:102 1013 1073 msgid "Issued To" 1014 1074 msgstr "" 1015 1075 1016 #: includes/views/html-certificate-list.php:26 1017 msgid "Date" 1018 msgstr "" 1019 1020 #: includes/views/html-certificate-list.php:27 1076 #: includes/views/html-certificate-list.php:29 1077 #: includes/views/html-certificate-list.php:106 1078 msgid "Added" 1079 msgstr "" 1080 1081 #: includes/views/html-certificate-list.php:30 1082 #: includes/views/html-certificate-list.php:109 1021 1083 msgid "Actions" 1022 1084 msgstr "" 1023 1085 1024 #: includes/views/html-certificate-list.php:3 41086 #: includes/views/html-certificate-list.php:39 1025 1087 msgid "Add Certificate" 1026 1088 msgstr "" 1027 1089 1028 #: includes/views/html-certificate-list.php: 371090 #: includes/views/html-certificate-list.php:42 1029 1091 msgid "Refresh Certificates" 1030 1092 msgstr "" 1031 1093 1032 #: includes/views/html-certificate-list.php:50 1094 #: includes/views/html-certificate-list.php:48 1095 msgid "Show more" 1096 msgstr "" 1097 1098 #: includes/views/html-certificate-list.php:63 1033 1099 msgid "There are no certificates to display. Click 'Add Certificate' to add one." 1034 1100 msgstr "" 1035 1101 1036 #: includes/views/html-certificate-list.php:86 1102 #: includes/views/html-certificate-list.php:98 1103 msgid "States:" 1104 msgstr "" 1105 1106 #: includes/views/html-certificate-list.php:111 1037 1107 msgid "View" 1038 1108 msgstr "" 1039 1109 1040 #: includes/views/html-certificate-list.php: 901110 #: includes/views/html-certificate-list.php:115 1041 1111 msgid "Delete" 1042 1112 msgstr "" … … 1341 1411 msgstr "" 1342 1412 1343 #: includes/frontend/class-sst-checkout.php: 961413 #: includes/frontend/class-sst-checkout.php:104 1344 1414 msgid "" 1345 1415 "SST: Session not ready for tax calculation, skipping to prevent refresh " … … 1347 1417 msgstr "" 1348 1418 1349 #: includes/frontend/class-sst-checkout.php:1 221419 #: includes/frontend/class-sst-checkout.php:133 1350 1420 msgid "Data mover mode. Skipping tax calculation." 1351 1421 msgstr "" 1352 1422 1353 #: includes/frontend/class-sst-checkout.php: 2951423 #: includes/frontend/class-sst-checkout.php:379 1354 1424 msgid "Missing shipping packages" 1355 1425 msgstr "" 1356 1426 1357 #: includes/frontend/class-sst-checkout.php: 3171427 #: includes/frontend/class-sst-checkout.php:401 1358 1428 msgid "Missing virtual packages" 1359 1429 msgstr "" 1360 1430 1361 #: includes/frontend/class-sst-checkout.php: 4591431 #: includes/frontend/class-sst-checkout.php:543 1362 1432 msgid "Packages created successfully" 1363 1433 msgstr "" 1364 1434 1365 #: includes/frontend/class-sst-checkout.php: 4611435 #: includes/frontend/class-sst-checkout.php:545 1366 1436 msgid "No packages created." 1367 1437 msgstr "" 1368 1438 1369 1439 # 1 - error message 1370 #: includes/frontend/class-sst-checkout.php: 8251440 #: includes/frontend/class-sst-checkout.php:909 1371 1441 msgid "Failed to add exemption certificate during checkout. Error was: %1$s" 1372 1442 msgstr "" 1373 1443 1374 #: includes/frontend/class-sst-checkout.php:958 1375 msgid "Select a exemption certificate" 1376 msgstr "" 1377 1378 #: includes/frontend/class-sst-checkout.php:959 1379 msgid "Add new certificate" 1380 msgstr "" 1381 1382 #: includes/frontend/class-sst-checkout.php:1069 1444 #: includes/frontend/class-sst-checkout.php:1042 1445 msgid "No certificate ? do not apply a tax exemption" 1446 msgstr "" 1447 1448 #: includes/frontend/class-sst-checkout.php:1153 1383 1449 msgid "Required exemption certificate fields are missing" 1384 1450 msgstr "" 1385 1451 1386 #: includes/frontend/class-sst-checkout.php:1 2691452 #: includes/frontend/class-sst-checkout.php:1357 1387 1453 msgid "CO EXCISE TAX" 1388 1454 msgstr "" … … 1549 1615 msgstr "" 1550 1616 1551 #: includes/abstracts/class-sst-abstract-cart.php:24 31617 #: includes/abstracts/class-sst-abstract-cart.php:245 1552 1618 msgid "TaxCloud returned an invalid lookup response." 1553 1619 msgstr "" … … 1592 1658 1593 1659 #: includes/frontend/views/html-checkout.php:18 1594 #: assets/js/blocks/tax-exemption/block.js: 671660 #: assets/js/blocks/tax-exemption/block.js:83 1595 1661 msgid "Tax exemption" 1596 1662 msgstr "" … … 1607 1673 1608 1674 #: includes/frontend/views/html-checkout.php:44 1609 #: assets/js/blocks/tax-exemption/block.js:83 1610 msgid "Exemption certificate" 1611 msgstr "" 1612 1613 #: includes/frontend/views/html-checkout.php:56 1614 #: assets/js/blocks/tax-exemption/block.js:92 1675 #: assets/js/blocks/tax-exemption/block.js:99 1676 msgid "Certificate to apply" 1677 msgstr "" 1678 1679 #: includes/frontend/views/html-checkout.php:51 1680 msgid "" 1681 "The selected certificate will be applied to this order. Certificates are " 1682 "ordered newest first." 1683 msgstr "" 1684 1685 #: includes/frontend/views/html-checkout.php:59 1686 #: assets/js/blocks/tax-exemption/block.js:111 1615 1687 msgid "Manage exemption certificates ?" 1616 1688 msgstr "" 1617 1689 1618 #: includes/frontend/views/html-checkout.php:7 31619 #: assets/js/blocks/tax-exemption/block.js: 721690 #: includes/frontend/views/html-checkout.php:76 1691 #: assets/js/blocks/tax-exemption/block.js:88 1620 1692 msgid "Please log in or register to apply an exemption certificate." 1621 1693 msgstr "" … … 1681 1753 msgid "Select a reason" 1682 1754 msgstr "" 1755 1756 #: assets/js/blocks/tax-exemption/block.js:45 1757 msgid "No exemption certificate will be applied to this order." 1758 msgstr "" 1759 1760 #: assets/js/blocks/tax-exemption/block.js:51 1761 msgid "Complete the certificate details below to apply it to this order." 1762 msgstr "" 1763 1764 #: assets/js/blocks/tax-exemption/block.js:56 1765 msgid "" 1766 "This certificate will be applied to this order. Certificates are ordered " 1767 "newest first." 1768 msgstr "" -
simple-sales-tax/tags/8.4.16/readme.txt
r3655406 r3669483 4 4 Requires at least: 4.5.0 5 5 Tested up to: 7.0 6 Stable tag: 8.4.1 56 Stable tag: 8.4.16 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later -
simple-sales-tax/tags/8.4.16/simple-sales-tax.php
r3655406 r3669483 8 8 * Author URI: https://taxcloud.com 9 9 * GitHub Plugin URI: https://github.com/bporcelli/simplesalestax 10 * Version: 8.4.1 510 * Version: 8.4.16 11 11 * Text Domain: simple-sales-tax 12 12 * Domain Path: /languages/ -
simple-sales-tax/trunk/assets/css/certificate-modal.css
r3607416 r3669483 108 108 } 109 109 110 #sst-certificates th, 111 #sst-certificates td { 112 vertical-align: middle; 113 } 114 115 #sst-certificates .sst-certificate-select-column { 116 width: 32px; 117 text-align: center; 118 } 119 120 #sst-certificates strong, 121 #sst-certificates .sst-certificate-meta, 122 #sst-certificates code { 123 display: block; 124 } 125 126 #sst-certificates .sst-certificate-meta, 127 #sst-certificates code { 128 margin-top: 3px; 129 color: #646970; 130 font-size: 12px; 131 line-height: 1.35; 132 } 133 134 #sst-certificates code { 135 width: fit-content; 136 padding: 1px 5px; 137 border-radius: 3px; 138 background: #f0f0f1; 139 } 140 141 #sst-certificates .sst-certificate-table-message { 142 padding: 18px 12px; 143 color: #646970; 144 text-align: center; 145 } 146 147 #sst-certificates .sst-certificate-table-message .spinner { 148 float: none; 149 margin: 0 8px 0 0; 150 vertical-align: middle; 151 visibility: visible; 152 } 153 154 .sst-certificate-table-footer, 155 .sst-certificate-table-actions, 156 .sst-certificate-table-pagination { 157 display: flex; 158 flex-wrap: wrap; 159 align-items: center; 160 gap: 8px; 161 } 162 163 .sst-certificate-table-footer { 164 justify-content: space-between; 165 } 166 167 .sst-certificate-table-pagination { 168 color: #646970; 169 font-size: 12px; 170 } 171 172 .sst-certificate-table-pagination[hidden] { 173 display: none; 174 } 175 176 @media screen and (max-width: 782px) { 177 #sst-certificates thead { 178 display: none; 179 } 180 181 #sst-certificates tbody tr, 182 #sst-certificates tbody td { 183 display: block; 184 width: auto; 185 } 186 187 #sst-certificates tbody tr { 188 padding: 10px 12px; 189 border-bottom: 1px solid #dcdcde; 190 } 191 192 #sst-certificates tbody td { 193 padding: 7px 0; 194 border: 0; 195 } 196 197 #sst-certificates tbody td::before { 198 display: block; 199 margin-bottom: 3px; 200 color: #646970; 201 content: attr(data-title); 202 font-size: 11px; 203 font-weight: 600; 204 text-transform: uppercase; 205 } 206 207 #sst-certificates .sst-certificate-select-column { 208 text-align: left; 209 } 210 } 211 110 212 .select2-container.select2-container--open, 111 213 .sst-select2-dropdown { -
simple-sales-tax/trunk/assets/css/certificate-modal.min.css
r3607416 r3669483 1 .wc-backbone-modal .wc-backbone-modal-content.sst-certificate-modal-content{width:800px}.sst-select-tic-modal-content .wc-backbone-modal-main,.sst-view-certificate-modal-content .wc-backbone-modal-main{padding-bottom:0}.sst-certificate{background:top left no-repeat;background-image:url('../img/exemption_certificate750x600.png');clear:both;width:750px;height:600px;margin-bottom:15px;margin-left:auto;margin-right:auto;position:relative}.sst-certificate--single{background-image:url('../img/sp_exemption_certificate750x600.png')}.sst-certificate span{position:absolute;text-align:center;height:20px;line-height:20px;font-size:16px;font-weight:700;color:#000}.sst-certificate span#PurchaserName{top:205px;left:405px;width:222px}.sst-certificate span#PurchaserAddress{top:227px;left:190px;width:445px}.sst-certificate span#PurchaserState{top:296px;left:215px;width:245px}.sst-certificate span#PurchaserExemptionReason{top:318px;left:180px;width:480px}.sst-certificate span#Date{top:378px;left:445px;width:235px}.sst-certificate span#TaxType{top:407px;left:445px;width:235px}.sst-certificate span#IDNumber{top:436px;left:445px;width:235px}.sst-certificate span#PurchaserBusinessType{top:465px;left:445px;width:235px}.sst-certificate span#MerchantName{top:495px;left:445px;width:235px}.sst-certificate span#OrderID{top:353px;left:445px;width:235px}span.table-action-sep,table a.sst-certificate-delete,table a.sst-certificate-view{display:inline-block;vertical-align:middle}span.table-action-sep{margin:0 3px} .select2-container.select2-container--open,.sst-select2-dropdown{z-index:100002!important}1 .wc-backbone-modal .wc-backbone-modal-content.sst-certificate-modal-content{width:800px}.sst-select-tic-modal-content .wc-backbone-modal-main,.sst-view-certificate-modal-content .wc-backbone-modal-main{padding-bottom:0}.sst-certificate{background:top left no-repeat;background-image:url('../img/exemption_certificate750x600.png');clear:both;width:750px;height:600px;margin-bottom:15px;margin-left:auto;margin-right:auto;position:relative}.sst-certificate--single{background-image:url('../img/sp_exemption_certificate750x600.png')}.sst-certificate span{position:absolute;text-align:center;height:20px;line-height:20px;font-size:16px;font-weight:700;color:#000}.sst-certificate span#PurchaserName{top:205px;left:405px;width:222px}.sst-certificate span#PurchaserAddress{top:227px;left:190px;width:445px}.sst-certificate span#PurchaserState{top:296px;left:215px;width:245px}.sst-certificate span#PurchaserExemptionReason{top:318px;left:180px;width:480px}.sst-certificate span#Date{top:378px;left:445px;width:235px}.sst-certificate span#TaxType{top:407px;left:445px;width:235px}.sst-certificate span#IDNumber{top:436px;left:445px;width:235px}.sst-certificate span#PurchaserBusinessType{top:465px;left:445px;width:235px}.sst-certificate span#MerchantName{top:495px;left:445px;width:235px}.sst-certificate span#OrderID{top:353px;left:445px;width:235px}span.table-action-sep,table a.sst-certificate-delete,table a.sst-certificate-view{display:inline-block;vertical-align:middle}span.table-action-sep{margin:0 3px}#sst-certificates td,#sst-certificates th{vertical-align:middle}#sst-certificates .sst-certificate-select-column{width:32px;text-align:center}#sst-certificates .sst-certificate-meta,#sst-certificates code,#sst-certificates strong{display:block}#sst-certificates .sst-certificate-meta,#sst-certificates code{margin-top:3px;color:#646970;font-size:12px;line-height:1.35}#sst-certificates code{width:fit-content;padding:1px 5px;border-radius:3px;background:#f0f0f1}#sst-certificates .sst-certificate-table-message{padding:18px 12px;color:#646970;text-align:center}#sst-certificates .sst-certificate-table-message .spinner{float:none;margin:0 8px 0 0;vertical-align:middle;visibility:visible}.sst-certificate-table-actions,.sst-certificate-table-footer,.sst-certificate-table-pagination{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.sst-certificate-table-footer{justify-content:space-between}.sst-certificate-table-pagination{color:#646970;font-size:12px}.sst-certificate-table-pagination[hidden]{display:none}@media screen and (max-width:782px){#sst-certificates thead{display:none}#sst-certificates tbody td,#sst-certificates tbody tr{display:block;width:auto}#sst-certificates tbody tr{padding:10px 12px;border-bottom:1px solid #dcdcde}#sst-certificates tbody td{padding:7px 0;border:0}#sst-certificates tbody td::before{display:block;margin-bottom:3px;color:#646970;content:attr(data-title);font-size:11px;font-weight:600;text-transform:uppercase}#sst-certificates .sst-certificate-select-column{text-align:left}}.select2-container.select2-container--open,.sst-select2-dropdown{z-index:100002!important} -
simple-sales-tax/trunk/assets/css/checkout.css
r2970922 r3669483 2 2 border-bottom: 1px solid #aaa; 3 3 } 4 5 .sst-certificate-selection-help { 6 margin-top: -0.5em; 7 color: #646970; 8 font-size: 0.875em; 9 line-height: 1.45; 10 } -
simple-sales-tax/trunk/assets/css/checkout.min.css
r2970922 r3669483 1 #select2-certificate_id-results li:first-of-type:not(:last-of-type){border-bottom:1px solid #aaa} 1 #select2-certificate_id-results li:first-of-type:not(:last-of-type){border-bottom:1px solid #aaa}.sst-certificate-selection-help{margin-top:-.5em;color:#646970;font-size:.875em;line-height:1.45} -
simple-sales-tax/trunk/assets/js/blocks/tax-exemption/block.js
r3151104 r3669483 32 32 33 33 const Block = ( { className, children } ) => { 34 if ( !showExemptionForm) {34 if ( ! showExemptionForm ) { 35 35 return null; 36 36 } … … 43 43 const { __internalIncrementCalculating, __internalDecrementCalculating } = 44 44 useDispatch( CHECKOUT_STORE_KEY ); 45 let selectionHelp = __( 46 'No exemption certificate will be applied to this order.', 47 'simple-sales-tax' 48 ); 49 50 if ( certificateId === 'new' ) { 51 selectionHelp = __( 52 'Complete the certificate details below to apply it to this order.', 53 'simple-sales-tax' 54 ); 55 } else if ( certificateId ) { 56 selectionHelp = __( 57 'This certificate will be applied to this order. Certificates are ordered newest first.', 58 'simple-sales-tax' 59 ); 60 } 45 61 46 62 const onChangeCertificate = ( value ) => { … … 82 98 id="exemption-certificate-input" 83 99 label={ __( 84 ' Exemption certificate',100 'Certificate to apply', 85 101 'simple-sales-tax' 86 102 ) } … … 89 105 value={ certificateId } 90 106 /> 107 <p className="sst-certificate-selection-help"> 108 { selectionHelp } 109 </p> 91 110 <a href={ myAccountEndpointUrl } target="_blank"> 92 111 { __( -
simple-sales-tax/trunk/assets/js/blocks/tax-exemption/style.scss
r3151104 r3669483 8 8 .wc-block-components-text-input { 9 9 margin-top: 1em; 10 } 11 12 .sst-certificate-selection-help { 13 margin: 0.5em 0 0; 14 color: #5f6368; 15 font-size: 0.875em; 16 line-height: 1.45; 10 17 } 11 18 -
simple-sales-tax/trunk/assets/js/certificate-table.js
r3655406 r3669483 4 4 var $blank_template = wp.template( 'sst-certificate-row-blank' ); 5 5 var $loading_template = wp.template( 'sst-certificate-row-loading' ); 6 var pageSize = 20; 6 7 7 8 // Backbone model … … 17 18 fetchOnLoad: false, 18 19 isLoading: false, 20 visibleCount: pageSize, 19 21 initialize: function( options ) { 20 22 this.userId = options.user_id ? +options.user_id : 0; … … 22 24 this.fetchOnLoad = !! options.fetch_on_load; 23 25 this.isLoading = false; 24 25 this.listenTo( this.model, 'change:certificates', this.render ); 26 this.visibleCount = pageSize; 27 this.$table = this.$el.closest( 'table' ); 28 29 this.listenTo( this.model, 'change:certificates', this.resetAndRender ); 26 30 this.listenTo( this.model, 'change:selected', this.fireChangeHook ); 27 31 … … 40 44 ); 41 45 46 this.$table.on( 47 'click', 48 '.sst-certificate-show-more', 49 { view: this }, 50 this.onShowMore 51 ); 52 42 53 if ( this.fetchOnLoad ) { 43 54 this.fetchCertificates(); 44 55 } 56 }, 57 resetAndRender: function() { 58 this.visibleCount = pageSize; 59 this.render(); 45 60 }, 46 61 render: function() { 47 62 if ( this.isLoading ) { 48 63 this.$el.empty(); 64 this.updateTableStatus( 0 ); 49 65 if ( typeof $loading_template === 'function' ) { 50 66 this.$el.append( $loading_template() ); … … 53 69 } 54 70 55 var certificates = _. indexBy( this.model.get( 'certificates' ), 'CertificateID'),71 var certificates = _.values( this.model.get( 'certificates' ) ), 56 72 selected = this.model.get( 'selected' ), 57 view = this, 58 index = 1; 73 view = this; 59 74 60 75 // Blank out the contents. 61 76 this.$el.empty(); 62 77 63 if ( _.size( certificates )) {78 if ( certificates.length ) { 64 79 // Populate $tbody with the current certificates 65 $.each( certificates, function( id, rowData ) { 66 rowData.Index = index++; 80 $.each( certificates.slice( 0, this.visibleCount ), function( index, rowData ) { 67 81 view.$el.append( $row_template( rowData ) ); 68 82 } ); 83 this.updateTableStatus( certificates.length ); 69 84 70 85 // Make the rows function … … 75 90 // Select certificate (first certificate selected by default) 76 91 if ( selected ) { 77 $( 'input[name="certificate_id"][value="' + selected + '"]' ).prop( 'checked', true );92 view.$el.find( 'input[name="certificate_id"][value="' + selected + '"]' ).prop( 'checked', true ); 78 93 } else { 79 var first = $( 'input[name="certificate_id"]' ).first();80 if ( first ) {94 var first = view.$el.find( 'input[name="certificate_id"]' ).first(); 95 if ( first.length ) { 81 96 first.prop( 'checked', true ); 82 97 this.model.set( 'selected', first.val() ); … … 84 99 } 85 100 } else { 101 this.updateTableStatus( 0 ); 86 102 view.$el.append( $blank_template ); 87 103 } 104 }, 105 updateTableStatus: function( total ) { 106 var $pagination = this.$table.find( '.sst-certificate-table-pagination' ); 107 108 if ( ! total ) { 109 $pagination.prop( 'hidden', true ); 110 return; 111 } 112 113 var shown = Math.min( this.visibleCount, total ); 114 var countText = script_data.strings.showing_certificates || 'Showing %1$d of %2$d certificates'; 115 countText = countText.replace( '%1$d', shown ).replace( '%2$d', total ); 116 117 $pagination.prop( 'hidden', false ); 118 $pagination.find( '.sst-certificate-count' ).text( countText ); 119 $pagination.find( '.sst-certificate-show-more' ).toggle( shown < total ); 120 }, 121 onShowMore: function( event ) { 122 event.preventDefault(); 123 124 var view = event.data.view; 125 view.visibleCount += pageSize; 126 view.render(); 88 127 }, 89 128 fetchCertificates: function() { … … 171 210 172 211 view.model.set( 'certificates', response.data.certificates ); 173 view.model.trigger( 'change:certificates' );174 212 } ) 175 213 .fail( function() { … … 285 323 view.model.set( 'selected', response.data.certificate_id ); 286 324 view.model.set( 'certificates', response.data.certificates ); 287 view.model.trigger( 'change:certificates' );288 325 } ) 289 326 .fail( function( jqXHR ) { -
simple-sales-tax/trunk/assets/js/certificate-table.min.js
r3655406 r3669483 1 jQuery(function( c){var n=window.SST_Certificate_Table_Data||{strings:{},certificates:{},user_id:0},a=wp.template("sst-certificate-row"),d=wp.template("sst-certificate-row-blank"),r=wp.template("sst-certificate-row-loading"),e=Backbone.Model.extend({certificates:{},selected:""}),t=Backbone.View.extend({userId:0,addressFields:{},fetchOnLoad:!1,isLoading:!1,initialize:function(e){this.userId=e.user_id?+e.user_id:0,this.addressFields=e.address_fields||{},this.fetchOnLoad=!!e.fetch_on_load,this.isLoading=!1,this.listenTo(this.model,"change:certificates",this.render),this.listenTo(this.model,"change:selected",this.fireChangeHook),c(document.body).on("click",".sst-certificate-add",{view:this},this.onAddCertificate),c(document.body).on("click",".sst-certificate-refresh",{view:this},this.onRefreshCertificates),this.fetchOnLoad&&this.fetchCertificates()},render:function(){var e,i,s,t;this.isLoading?(this.$el.empty(),"function"==typeof r&&this.$el.append(r())):(t=_.indexBy(this.model.get("certificates"),"CertificateID"),e=this.model.get("selected"),s=1,(i=this).$el.empty(),_.size(t)?(c.each(t,function(e,t){t.Index=s++,i.$el.append(a(t))}),i.$el.find(".sst-certificate-delete").on("click",{view:this},this.onDeleteRow),i.$el.find(".sst-certificate-view").on("click",{view:this},this.onViewCertificate),i.$el.find('input[name="certificate_id"]').on("change",this.updateSelected.bind(this)),e?c('input[name="certificate_id"][value="'+e+'"]').prop("checked",!0):(t=c('input[name="certificate_id"]').first())&&(t.prop("checked",!0),this.model.set("selected",t.val()))):i.$el.append(d))},fetchCertificates:function(){var t=this,e=(t.isLoading=!0,t.render(),{nonce:n.get_certificates_nonce});t.userId&&(e.customerId=t.userId,e.user_id=t.userId),c.post(n.ajaxurl+"?action=sst_get_certificates",e).then(function(e){t.isLoading=!1,e.success&&e.data?t.model.set("certificates",e.data):t.render()}).fail(function(){t.isLoading=!1,t.render()})},fireChangeHook:function(){var e=this.model.get("selected");wp.hooks.doAction("sst_certificate_changed",e)},block:function(){c(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){c(this.el).unblock()},updateSelected:function(e){this.model.set("selected",c(e.target).val())},onDeleteRow:function(e){var t=e.data.view,i=t.model,s=(_.indexBy(i.get("certificates"),"CertificateID"),t.model.get("selected")),a=c(this).closest("tr").data("id");e.preventDefault(),confirm(n.strings.delete_certificate)&&(t.block(),i={nonce:n.delete_certificate_nonce,certificate_id:a},t.userId&&(i.user_id=t.userId),c.post(n.ajaxurl+"?action=sst_delete_certificate",i).then(function(e){if(!e.success)throw new Error(e.data);s==a&&t.model.set("selected",""),t.model.set("certificates",e.data.certificates),t.model.trigger("change:certificates")}).fail(function(){alert(n.strings.delete_failed)}).always(function(){t.unblock()}))},onViewCertificate:function(e){var t=e.data.view.model,t=_.indexBy(t.get("certificates"),"CertificateID")[c(this).closest("tr").data("id")];e.preventDefault(),t&&c(this).SSTBackboneModal({template:"sst-modal-view-certificate",variable:t})},onAddCertificate:function(e){e.preventDefault();e=e.data.view;SST_Add_Certificate_Modal.open({address:e.getBillingAddress(),onAddCertificate:e.addCertificateHandler.bind(e)})},onRefreshCertificates:function(e){var t=e.data.view,e=(e.preventDefault(),t.block(),{nonce:n.refresh_certificates_nonce});t.userId&&(e.user_id=t.userId),c.post(n.ajaxurl+"?action=sst_refresh_certificates",e).then(function(e){if(!e.success)throw new Error(e.data);e.data&&e.data.certificates?t.model.set("certificates",e.data.certificates):window.location.reload()}).fail(function(){alert(n.strings.refresh_failed||"Failed to refresh certificates")}).always(function(){t.unblock()})},getBillingAddress:function(){var e,t,i=n.billing_address,s=this.addressFields;for(e in i)i.hasOwnProperty(e)&&e in s&&(t=s[e],(t=c('[name="'+t+'"]')).length&&(i[e]=t.val()));return i},addCertificateHandler:function(e){var t=this,e=(t.block(),{nonce:SST_Add_Certificate_Data.nonce,address:t.getBillingAddress(),...e});t.userId&&(e.user_id=t.userId),c.post(n.ajaxurl+"?action=sst_add_certificate",e).then(function(e){e.success?(t.model.set("selected",e.data.certificate_id),t.model.set("certificates",e.data.certificates),t.model.trigger("change:certificates")):(e=e.data?n.strings.add_failed+": "+e.data:n.strings.add_failed,alert(e))}).fail(function(e){var t=n.strings.add_failed;e.responseJSON&&e.responseJSON.data?t+=": "+e.responseJSON.data:e.responseText&&(t+=": "+e.responseText),alert(t)}).always(function(){t.unblock()})}});var i={user_id:n.user_id,certificates:n.certificates,fetch_on_load:n.fetch_on_load};i=i||{};var s,o={selector:"#sst-certificates",address_fields:{first_name:"billing_first_name",last_name:"billing_last_name",address_1:"billing_address_1",address_2:"billing_address_2",country:"billing_country",city:"billing_city",state:"billing_state",postcode:"billing_postcode"},certificates:{},selected:"",user_id:0,fetch_on_load:!1};for(s in o)o.hasOwnProperty(s)&&!i.hasOwnProperty(s)&&(i[s]=o[s]);i.model=new e({certificates:i.certificates,selected:i.selected}),i.el=c(i.selector).find("tbody"),new t(i).render()});1 jQuery(function(n){var c=window.SST_Certificate_Table_Data||{strings:{},certificates:{},user_id:0},s=wp.template("sst-certificate-row"),a=wp.template("sst-certificate-row-blank"),d=wp.template("sst-certificate-row-loading"),e=Backbone.Model.extend({certificates:{},selected:""}),t=Backbone.View.extend({userId:0,addressFields:{},fetchOnLoad:!1,isLoading:!1,visibleCount:20,initialize:function(e){this.userId=e.user_id?+e.user_id:0,this.addressFields=e.address_fields||{},this.fetchOnLoad=!!e.fetch_on_load,this.isLoading=!1,this.visibleCount=20,this.$table=this.$el.closest("table"),this.listenTo(this.model,"change:certificates",this.resetAndRender),this.listenTo(this.model,"change:selected",this.fireChangeHook),n(document.body).on("click",".sst-certificate-add",{view:this},this.onAddCertificate),n(document.body).on("click",".sst-certificate-refresh",{view:this},this.onRefreshCertificates),this.$table.on("click",".sst-certificate-show-more",{view:this},this.onShowMore),this.fetchOnLoad&&this.fetchCertificates()},resetAndRender:function(){this.visibleCount=20,this.render()},render:function(){var e,i,t;this.isLoading?(this.$el.empty(),this.updateTableStatus(0),"function"==typeof d&&this.$el.append(d())):(t=_.values(this.model.get("certificates")),e=this.model.get("selected"),(i=this).$el.empty(),t.length?(n.each(t.slice(0,this.visibleCount),function(e,t){i.$el.append(s(t))}),this.updateTableStatus(t.length),i.$el.find(".sst-certificate-delete").on("click",{view:this},this.onDeleteRow),i.$el.find(".sst-certificate-view").on("click",{view:this},this.onViewCertificate),i.$el.find('input[name="certificate_id"]').on("change",this.updateSelected.bind(this)),e?i.$el.find('input[name="certificate_id"][value="'+e+'"]').prop("checked",!0):(t=i.$el.find('input[name="certificate_id"]').first()).length&&(t.prop("checked",!0),this.model.set("selected",t.val()))):(this.updateTableStatus(0),i.$el.append(a)))},updateTableStatus:function(e){var t,i,s=this.$table.find(".sst-certificate-table-pagination");e?(t=Math.min(this.visibleCount,e),i=(i=c.strings.showing_certificates||"Showing %1$d of %2$d certificates").replace("%1$d",t).replace("%2$d",e),s.prop("hidden",!1),s.find(".sst-certificate-count").text(i),s.find(".sst-certificate-show-more").toggle(t<e)):s.prop("hidden",!0)},onShowMore:function(e){e.preventDefault();e=e.data.view;e.visibleCount+=20,e.render()},fetchCertificates:function(){var t=this,e=(t.isLoading=!0,t.render(),{nonce:c.get_certificates_nonce});t.userId&&(e.customerId=t.userId,e.user_id=t.userId),n.post(c.ajaxurl+"?action=sst_get_certificates",e).then(function(e){t.isLoading=!1,e.success&&e.data?t.model.set("certificates",e.data):t.render()}).fail(function(){t.isLoading=!1,t.render()})},fireChangeHook:function(){var e=this.model.get("selected");wp.hooks.doAction("sst_certificate_changed",e)},block:function(){n(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){n(this.el).unblock()},updateSelected:function(e){this.model.set("selected",n(e.target).val())},onDeleteRow:function(e){var t=e.data.view,i=t.model,s=(_.indexBy(i.get("certificates"),"CertificateID"),t.model.get("selected")),a=n(this).closest("tr").data("id");e.preventDefault(),confirm(c.strings.delete_certificate)&&(t.block(),i={nonce:c.delete_certificate_nonce,certificate_id:a},t.userId&&(i.user_id=t.userId),n.post(c.ajaxurl+"?action=sst_delete_certificate",i).then(function(e){if(!e.success)throw new Error(e.data);s==a&&t.model.set("selected",""),t.model.set("certificates",e.data.certificates)}).fail(function(){alert(c.strings.delete_failed)}).always(function(){t.unblock()}))},onViewCertificate:function(e){var t=e.data.view.model,t=_.indexBy(t.get("certificates"),"CertificateID")[n(this).closest("tr").data("id")];e.preventDefault(),t&&n(this).SSTBackboneModal({template:"sst-modal-view-certificate",variable:t})},onAddCertificate:function(e){e.preventDefault();e=e.data.view;SST_Add_Certificate_Modal.open({address:e.getBillingAddress(),onAddCertificate:e.addCertificateHandler.bind(e)})},onRefreshCertificates:function(e){var t=e.data.view,e=(e.preventDefault(),t.block(),{nonce:c.refresh_certificates_nonce});t.userId&&(e.user_id=t.userId),n.post(c.ajaxurl+"?action=sst_refresh_certificates",e).then(function(e){if(!e.success)throw new Error(e.data);e.data&&e.data.certificates?t.model.set("certificates",e.data.certificates):window.location.reload()}).fail(function(){alert(c.strings.refresh_failed||"Failed to refresh certificates")}).always(function(){t.unblock()})},getBillingAddress:function(){var e,t,i=c.billing_address,s=this.addressFields;for(e in i)i.hasOwnProperty(e)&&e in s&&(t=s[e],(t=n('[name="'+t+'"]')).length&&(i[e]=t.val()));return i},addCertificateHandler:function(e){var t=this,e=(t.block(),{nonce:SST_Add_Certificate_Data.nonce,address:t.getBillingAddress(),...e});t.userId&&(e.user_id=t.userId),n.post(c.ajaxurl+"?action=sst_add_certificate",e).then(function(e){e.success?(t.model.set("selected",e.data.certificate_id),t.model.set("certificates",e.data.certificates)):(e=e.data?c.strings.add_failed+": "+e.data:c.strings.add_failed,alert(e))}).fail(function(e){var t=c.strings.add_failed;e.responseJSON&&e.responseJSON.data?t+=": "+e.responseJSON.data:e.responseText&&(t+=": "+e.responseText),alert(t)}).always(function(){t.unblock()})}});var i={user_id:c.user_id,certificates:c.certificates,fetch_on_load:c.fetch_on_load};i=i||{};var r,o={selector:"#sst-certificates",address_fields:{first_name:"billing_first_name",last_name:"billing_last_name",address_1:"billing_address_1",address_2:"billing_address_2",country:"billing_country",city:"billing_city",state:"billing_state",postcode:"billing_postcode"},certificates:{},selected:"",user_id:0,fetch_on_load:!1};for(r in o)o.hasOwnProperty(r)&&!i.hasOwnProperty(r)&&(i[r]=o[r]);i.model=new e({certificates:i.certificates,selected:i.selected}),i.el=n(i.selector).find("tbody"),new t(i).render()}); -
simple-sales-tax/trunk/assets/js/tic-select.js
r2766600 r3669483 52 52 }, 53 53 updateSelection: function( event ) { 54 event.preventDefault(); 54 55 var $target = $( event.target ), 55 56 $tr = $target.closest( 'tr' ); … … 70 71 var tic_id = this.input.val(); 71 72 72 if ( '' == tic_id ) {73 if ( '' == tic_id || undefined === tic_id ) { 73 74 this.readout.text( this.readout.data( 'default' ) ); 74 75 } else { 75 var tic = data.tic_list[ parseInt( tic_id ) ]; 76 this.readout.text( tic['description'] + ' (' + tic['id'] + ')' ); 76 var tic = data.tic_list ? data.tic_list[ parseInt( tic_id ) ] : null; 77 if ( tic && tic['description'] ) { 78 this.readout.text( tic['description'] + ' (' + tic['id'] + ')' ); 79 } else { 80 this.readout.text( this.readout.data( 'default' ) || ( 'TIC ' + tic_id ) ); 81 } 77 82 } 78 83 }, -
simple-sales-tax/trunk/assets/js/tic-select.min.js
r2490188 r3669483 1 !function(s, c){s(function(){var t=wp.template("sst-tic-row"),e=Backbone.View.extend({rowTemplate:t,input:null,readout:null,initialize:function(){this.input=this.$el.siblings(".sst-tic-input"),this.readout=this.$el.siblings(".sst-selected-tic"),this.handleInputChange=this.handleInputChange.bind(this),this.$el.on("click",{view:this},this.openModal),this.input.on("change",this.handleInputChange)},render:function(){this.selectTIC(this.input.val())},bindEvents:function(){s(document.body).on("click",".sst-select-done",{view:this},this.updateSelection),s(document.body).on("wc_backbone_modal_response",{view:this},this.completeSelection)},unbindEvents:function(){s(document.body).off("click",".sst-select-done",this.updateSelection),s(document.body).off("wc_backbone_modal_response",this.completeSelection)},openModal:function(t){var e=t.data.view;t.preventDefault(),s(this).SSTBackboneModal({template:"sst-tic-select-modal"}),e.bindEvents(),e.initModal()},initModal:function(t){var i=this,n=s(".sst-tic-list");n.empty(),_.each(c.tic_list,function(t,e){n.append(i.rowTemplate(t))}),s(".sst-tic-search").hideseek()},updateSelection:function(t){t=s(t.target).closest("tr");s('input[name="tic"]').val(t.data("id")),s("#btn-ok").trigger("click")},completeSelection:function(t,e,i){"sst-tic-select-modal"===e&&(t.data.view.selectTIC(i.tic),t.data.view.unbindEvents())},selectTIC:function(t){this.input.val(t).trigger("change")},handleInputChange:function(){var t=this.input.val();""==t?this.readout.text(this.readout.data("default")):(t=c.tic_list[parseInt(t)],this.readout.text(t.description+" ("+t.id+")"))},remove:function(){Backbone.View.prototype.remove.call(this),this.input.off("change")}});function i(){s(".sst-select-tic:not(.initialized)").each(function(){new e({el:s(this)}).render(),s(this).addClass("initialized")})}i(),s(document.body).on(c.tic_select_init_events,i)})}(jQuery,ticSelectLocalizeScript);1 !function(s,o){s(function(){var t=wp.template("sst-tic-row"),e=Backbone.View.extend({rowTemplate:t,input:null,readout:null,initialize:function(){this.input=this.$el.siblings(".sst-tic-input"),this.readout=this.$el.siblings(".sst-selected-tic"),this.handleInputChange=this.handleInputChange.bind(this),this.$el.on("click",{view:this},this.openModal),this.input.on("change",this.handleInputChange)},render:function(){this.selectTIC(this.input.val())},bindEvents:function(){s(document.body).on("click",".sst-select-done",{view:this},this.updateSelection),s(document.body).on("wc_backbone_modal_response",{view:this},this.completeSelection)},unbindEvents:function(){s(document.body).off("click",".sst-select-done",this.updateSelection),s(document.body).off("wc_backbone_modal_response",this.completeSelection)},openModal:function(t){var e=t.data.view;t.preventDefault(),s(this).SSTBackboneModal({template:"sst-tic-select-modal"}),e.bindEvents(),e.initModal()},initModal:function(t){var i=this,n=s(".sst-tic-list");n.empty(),_.each(o.tic_list,function(t,e){n.append(i.rowTemplate(t))}),s(".sst-tic-search").hideseek()},updateSelection:function(t){t.preventDefault();t=s(t.target).closest("tr");s('input[name="tic"]').val(t.data("id")),s("#btn-ok").trigger("click")},completeSelection:function(t,e,i){"sst-tic-select-modal"===e&&(t.data.view.selectTIC(i.tic),t.data.view.unbindEvents())},selectTIC:function(t){this.input.val(t).trigger("change")},handleInputChange:function(){var t,e=this.input.val();""==e||void 0===e?this.readout.text(this.readout.data("default")):(t=o.tic_list?o.tic_list[parseInt(e)]:null)&&t.description?this.readout.text(t.description+" ("+t.id+")"):this.readout.text(this.readout.data("default")||"TIC "+e)},remove:function(){Backbone.View.prototype.remove.call(this),this.input.off("change")}});function i(){s(".sst-select-tic:not(.initialized)").each(function(){new e({el:s(this)}).render(),s(this).addClass("initialized")})}i(),s(document.body).on(o.tic_select_init_events,i)})}(jQuery,ticSelectLocalizeScript); -
simple-sales-tax/trunk/build/style-tax-exemption-block-rtl.css
r3175018 r3669483 1 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(-360deg)}}@keyframes loading__animation{100%{transform:translateX(-100%)}}.wp-block-simple-sales-tax-tax-exemption{margin:1.5em 0}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-title.wc-block-components-title{margin-bottom:1em}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-text-input{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst- radio-group{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group label{display:block;margin-bottom:.5em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label{padding-right:2em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label input{right:0}.wp-block-simple-sales-tax-tax-exemption a{display:block;margin:1em 0}1 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(-360deg)}}@keyframes loading__animation{100%{transform:translateX(-100%)}}.wp-block-simple-sales-tax-tax-exemption{margin:1.5em 0}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-title.wc-block-components-title{margin-bottom:1em}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-text-input{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst-certificate-selection-help{margin:.5em 0 0;color:#5f6368;font-size:.875em;line-height:1.45}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group label{display:block;margin-bottom:.5em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label{padding-right:2em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label input{right:0}.wp-block-simple-sales-tax-tax-exemption a{display:block;margin:1em 0} 2 2 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(-360deg)}}@keyframes loading__animation{100%{transform:translateX(-100%)}}.wc-blocks-components-select{width:100%}.wc-blocks-components-select .wc-blocks-components-select__container{border-radius:4px;box-sizing:border-box;background:#fff;width:100%;height:3.125em;position:relative}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__container{background-color:rgba(0,0,0,.1);color:#fff}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__container:focus{background-color:rgba(0,0,0,.1);color:#fff}.has-error .wc-blocks-components-select .wc-blocks-components-select__container{border-color:#cc1818}.wc-blocks-components-select .wc-blocks-components-select__select{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-decoration:inherit;text-transform:inherit;font-size:1em;border-radius:4px;width:100%;height:100%;appearance:none;background:none;padding:1em .5em 0;color:#2b2d2f;border:1px solid rgba(17,17,17,.8)}.wc-blocks-components-select .wc-blocks-components-select__select:focus{border-color:currentColor;border-width:1.5px}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__select{border-color:rgba(255,255,255,.4);color:#fff}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__select:focus{border-color:currentColor}.has-error .wc-blocks-components-select .wc-blocks-components-select__select{color:#cc1818}.wc-blocks-components-select .wc-blocks-components-select__label{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-decoration:inherit;text-transform:inherit;font-size:1em;position:absolute;line-height:1.25;right:.5em;top:2px;transform-origin:top right;transition:all 200ms ease;color:#2b2d2f;z-index:1;margin:0;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 32px);white-space:nowrap;transform:translateY(15%) scale(0.75)}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__label{color:rgba(255,255,255,.6)}.has-error .wc-blocks-components-select .wc-blocks-components-select__label{color:#cc1818}@media screen and (prefers-reduced-motion: reduce){.wc-blocks-components-select .wc-blocks-components-select__label{transition:none}}.wc-blocks-components-select .wc-blocks-components-select__expand{position:absolute;transform:translate(0%, -50%);top:50%;left:12px;pointer-events:none;fill:#2b2d2f}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__expand{fill:#fff}.has-error .wc-blocks-components-select .wc-blocks-components-select__expand{fill:#cc1818} 3 3 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(-360deg)}}@keyframes loading__animation{100%{transform:translateX(-100%)}}.wc-blocks-components-select__container{margin-top:16px} -
simple-sales-tax/trunk/build/style-tax-exemption-block.css
r3175018 r3669483 1 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes loading__animation{100%{transform:translateX(100%)}}.wp-block-simple-sales-tax-tax-exemption{margin:1.5em 0}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-title.wc-block-components-title{margin-bottom:1em}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-text-input{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst- radio-group{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group label{display:block;margin-bottom:.5em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label{padding-left:2em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label input{left:0}.wp-block-simple-sales-tax-tax-exemption a{display:block;margin:1em 0}1 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes loading__animation{100%{transform:translateX(100%)}}.wp-block-simple-sales-tax-tax-exemption{margin:1.5em 0}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-title.wc-block-components-title{margin-bottom:1em}.wp-block-simple-sales-tax-tax-exemption .wc-block-components-text-input{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst-certificate-selection-help{margin:.5em 0 0;color:#5f6368;font-size:.875em;line-height:1.45}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group{margin-top:1em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group label{display:block;margin-bottom:.5em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label{padding-left:2em}.wp-block-simple-sales-tax-tax-exemption .sst-radio-group .wc-block-components-radio-control label input{left:0}.wp-block-simple-sales-tax-tax-exemption a{display:block;margin:1em 0} 2 2 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes loading__animation{100%{transform:translateX(100%)}}.wc-blocks-components-select{width:100%}.wc-blocks-components-select .wc-blocks-components-select__container{border-radius:4px;box-sizing:border-box;background:#fff;width:100%;height:3.125em;position:relative}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__container{background-color:rgba(0,0,0,.1);color:#fff}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__container:focus{background-color:rgba(0,0,0,.1);color:#fff}.has-error .wc-blocks-components-select .wc-blocks-components-select__container{border-color:#cc1818}.wc-blocks-components-select .wc-blocks-components-select__select{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-decoration:inherit;text-transform:inherit;font-size:1em;border-radius:4px;width:100%;height:100%;appearance:none;background:none;padding:1em .5em 0;color:#2b2d2f;border:1px solid rgba(17,17,17,.8)}.wc-blocks-components-select .wc-blocks-components-select__select:focus{border-color:currentColor;border-width:1.5px}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__select{border-color:rgba(255,255,255,.4);color:#fff}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__select:focus{border-color:currentColor}.has-error .wc-blocks-components-select .wc-blocks-components-select__select{color:#cc1818}.wc-blocks-components-select .wc-blocks-components-select__label{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-decoration:inherit;text-transform:inherit;font-size:1em;position:absolute;line-height:1.25;left:.5em;top:2px;transform-origin:top left;transition:all 200ms ease;color:#2b2d2f;z-index:1;margin:0;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 32px);white-space:nowrap;transform:translateY(15%) scale(0.75)}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__label{color:rgba(255,255,255,.6)}.has-error .wc-blocks-components-select .wc-blocks-components-select__label{color:#cc1818}@media screen and (prefers-reduced-motion: reduce){.wc-blocks-components-select .wc-blocks-components-select__label{transition:none}}.wc-blocks-components-select .wc-blocks-components-select__expand{position:absolute;transform:translate(0%, -50%);top:50%;right:12px;pointer-events:none;fill:#2b2d2f}.has-dark-controls .wc-blocks-components-select .wc-blocks-components-select__expand{fill:#fff}.has-error .wc-blocks-components-select .wc-blocks-components-select__expand{fill:#cc1818} 3 3 @keyframes spinner__animation{0%{animation-timing-function:cubic-bezier(0.5856, 0.0703, 0.4143, 0.9297);transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes loading__animation{100%{transform:translateX(100%)}}.wc-blocks-components-select__container{margin-top:16px} -
simple-sales-tax/trunk/build/tax-exemption-block-frontend.asset.php
r3326417 r3669483 1 <?php return array('dependencies' => array('react', 'wc-blocks-checkout', 'wc-blocks-components', 'wc-blocks-data-store', 'wc-settings', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-primitives'), 'version' => ' ae6e300ebc3116c74d20');1 <?php return array('dependencies' => array('react', 'wc-blocks-checkout', 'wc-blocks-components', 'wc-blocks-data-store', 'wc-settings', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-primitives'), 'version' => '70508e420fb3ab445162'); -
simple-sales-tax/trunk/build/tax-exemption-block-frontend.js
r3326417 r3669483 1 (()=>{"use strict";var e,a={728:()=>{const e=window.wc.blocksCheckout,a=window.React,t=window.wp.data,l=window.wp.i18n,s=window.wc.wcSettings,r=window.wp.element,i=(0,r.forwardRef)((function({icon:e,size:a=24,...t},l){return(0,r.cloneElement)(e,{width:a,height:a,...t,ref:l})})),n=window.wp.primitives,o=(0,a.createElement)(n.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(n.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));function c(e){var a,t,l="";if("string"==typeof e||"number"==typeof e)l+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(a=0;a<s;a++)e[a]&&(t=c(e[a]))&&(l&&(l+=" "),l+=t)}else for(t in e)e[t]&&(l&&(l+=" "),l+=t);return l}function u(){for(var e,a,t=0,l="",s=arguments.length;t<s;t++)(e=arguments[t])&&(a=c(e))&&(l&&(l+=" "),l+=a);return l}const p=u,m=window.wc.wcBlocksData,d=window.wc.blocksComponents,_=e=>{var s;const{onChange:n,options:c,label:u,value:_="",className: x,size:h,errorId:g,required:b,errorMessage:v=(0,l.__)("Please select a valid option","woocommerce"),placeholder:E,...f}=e,S=(0,r.useCallback)((e=>{n(e.target.value)}),[n]),y=(0,l.getLocaleData)(),O=["de","de_AT","de_CH"].includes(null!==(s=y?.[""]?.lang)&&void 0!==s?s:"en"),w=(0,r.useMemo)((()=>({value:"",label:null!=E?E:(0,l.sprintf)(1 (()=>{"use strict";var e,a={728:()=>{const e=window.wc.blocksCheckout,a=window.React,t=window.wp.data,l=window.wp.i18n,s=window.wc.wcSettings,r=window.wp.element,i=(0,r.forwardRef)((function({icon:e,size:a=24,...t},l){return(0,r.cloneElement)(e,{width:a,height:a,...t,ref:l})})),n=window.wp.primitives,o=(0,a.createElement)(n.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(n.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));function c(e){var a,t,l="";if("string"==typeof e||"number"==typeof e)l+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(a=0;a<s;a++)e[a]&&(t=c(e[a]))&&(l&&(l+=" "),l+=t)}else for(t in e)e[t]&&(l&&(l+=" "),l+=t);return l}function u(){for(var e,a,t=0,l="",s=arguments.length;t<s;t++)(e=arguments[t])&&(a=c(e))&&(l&&(l+=" "),l+=a);return l}const p=u,m=window.wc.wcBlocksData,d=window.wc.blocksComponents,_=e=>{var s;const{onChange:n,options:c,label:u,value:_="",className:h,size:x,errorId:g,required:b,errorMessage:v=(0,l.__)("Please select a valid option","woocommerce"),placeholder:E,...f}=e,S=(0,r.useCallback)((e=>{n(e.target.value)}),[n]),y=(0,l.getLocaleData)(),w=["de","de_AT","de_CH"].includes(null!==(s=y?.[""]?.lang)&&void 0!==s?s:"en"),O=(0,r.useMemo)((()=>({value:"",label:null!=E?E:(0,l.sprintf)( 2 2 // translators: %s will be label of the field. For example "country/region". 3 3 // translators: %s will be label of the field. For example "country/region". 4 (0,l.__)("Select a %s","woocommerce"), O?u:u?.toLowerCase()),disabled:!!b})),[u,E,b,O]),C=(0,r.useId)(),T=f.id||`wc-blocks-components-select-${C}`,P=g||T,k=(0,r.useMemo)((()=>b&&_?c:[w].concat(c)),[b,_,w,c]),{setValidationErrors:R,clearValidationError:I}=(0,t.useDispatch)(m.validationStore),{error:A,validationErrorId:N}=(0,t.useSelect)((e=>{const a=e(m.validationStore);return{error:a.getValidationError(P),validationErrorId:a.getValidationErrorId(P)}}));(0,r.useEffect)((()=>(!b||_?I(P):R({[P]:{message:v,hidden:!0}}),()=>{I(P)})),[I,_,P,v,b,R]);const D=(0,t.useSelect)((e=>e(m.validationStore).getValidationError(P||"")||{hidden:!0}));return(0,a.createElement)("div",{className:p(x,{"has-error":!D.hidden})},(0,a.createElement)("div",{className:"wc-blocks-components-select"},(0,a.createElement)("div",{className:"wc-blocks-components-select__container"},(0,a.createElement)("label",{htmlFor:T,className:"wc-blocks-components-select__label"},u),(0,a.createElement)("select",{className:"wc-blocks-components-select__select",id:T,size:void 0!==h?h:1,onChange:S,value:_,"aria-invalid":!(!A?.message||A?.hidden),"aria-errormessage":N,...f},k.map((e=>(0,a.createElement)("option",{key:e.value,value:e.value,"data-alternate-values":`[${e.label}]`,disabled:void 0!==e.disabled&&e.disabled},e.label)))),(0,a.createElement)(i,{className:"wc-blocks-components-select__expand",icon:o}))),(0,a.createElement)(d.ValidationInputError,{propertyName:P}))},x=window.wp.htmlEntities,h=(e,a)=>{const t=a.find((a=>a.label.toLocaleUpperCase()===e.toLocaleUpperCase()||a.value.toLocaleUpperCase()===e.toLocaleUpperCase()));return t?t.value:""},g=({className:e,id:t,states:l,country:s,label:i,onChange:n,autoComplete:o="off",value:c="",required:p=!1})=>{const m=l[s],g=(0,r.useMemo)((()=>m&&Object.keys(m).length>0?Object.keys(m).map((e=>({value:e,label:(0,x.decodeEntities)(m[e])}))):[]),[m]),b=(0,r.useCallback)((e=>{const a=g.length>0?h(e,g):e;a!==c&&n(a)}),[n,g,c]),v=(0,r.useRef)(c);return(0,r.useEffect)((()=>{v.current!==c&&(v.current=c)}),[c]),(0,r.useEffect)((()=>{if(g.length>0&&v.current){const e=h(v.current,g);e!==v.current&&b(e)}}),[g,b]),g.length>0?(0,a.createElement)(_,{className:u(e,"wc-block-components-state-input"),options:g,label:i||"",id:t,onChange:b,value:c,autoComplete:o,required:p}):(0,a.createElement)(d.ValidatedTextInput,{className:e,id:t,label:i,onChange:b,autoComplete:o,value:c,required:p})},b=(0,s.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),v=(b.pluginUrl,b.pluginUrl,s.STORE_PAGES.shop,s.STORE_PAGES.checkout,s.STORE_PAGES.checkout,s.STORE_PAGES.privacy,s.STORE_PAGES.privacy,s.STORE_PAGES.terms,s.STORE_PAGES.terms,s.STORE_PAGES.cart,s.STORE_PAGES.cart,s.STORE_PAGES.myaccount?.permalink?s.STORE_PAGES.myaccount.permalink:(0,s.getSetting)("wpLoginUrl","/wp-login.php"),(0,s.getSetting)("localPickupEnabled",!1),(0,s.getSetting)("shippingMethodsExist",!1),(0,s.getSetting)("countries",{})),E=(0,s.getSetting)("countryData",{}),f=(Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowBilling)).map((e=>[e,v[e]||""]))),Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowBilling)).map((e=>[e,E[e].states||[]])))),S=(Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowShipping)).map((e=>[e,v[e]||""]))),Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowShipping)).map((e=>[e,E[e].states||[]]))),Object.fromEntries(Object.keys(E).map((e=>[e,E[e].locale||[]]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),y=((0,s.getSetting)("addressFieldsLocations",S).address,(0,s.getSetting)("addressFieldsLocations",S).contact,(0,s.getSetting)("addressFieldsLocations",S).order,(0,s.getSetting)("additionalOrderFields",{}),(0,s.getSetting)("additionalContactFields",{}),(0,s.getSetting)("additionalAddressFields",{}),[{value:"",label:(0,l.__)("Select a business type","simple-sales-tax"),disabled:!0},{value:"AccommodationAndFoodServices",label:(0,l.__)("Accommodation And Food Services","simple-sales-tax")},{value:"Agricultural_Forestry_Fishing_Hunting",label:(0,l.__)("Agricultural/Forestry/Fishing/Hunting","simple-sales-tax")},{value:"Construction",label:(0,l.__)("Construction","simple-sales-tax")},{value:"FinanceAndInsurance",label:(0,l.__)("Finance or Insurance","simple-sales-tax")},{value:"Information_PublishingAndCommunications",label:(0,l.__)("Information Publishing and Communications","simple-sales-tax")},{value:"Manufacturing",label:(0,l.__)("Manufacturing","simple-sales-tax")},{value:"Mining",label:(0,l.__)("Mining","simple-sales-tax")},{value:"RealEstate",label:(0,l.__)("Real Estate","simple-sales-tax")},{value:"RentalAndLeasing",label:(0,l.__)("Rental and Leasing","simple-sales-tax")},{value:"RetailTrade",label:(0,l.__)("Retail Trade","simple-sales-tax")},{value:"TransportationAndWarehousing",label:(0,l.__)("Transportation and Warehousing","simple-sales-tax")},{value:"Utilities",label:(0,l.__)("Utilities","simple-sales-tax")},{value:"WholesaleTrade",label:(0,l.__)("Wholesale Trade","simple-sales-tax")},{value:"BusinessServices",label:(0,l.__)("Business Services","simple-sales-tax")},{value:"ProfessionalServices",label:(0,l.__)("Professional Services","simple-sales-tax")},{value:"EducationAndHealthCareServices",label:(0,l.__)("Education and Health Care Services","simple-sales-tax")},{value:"NonprofitOrganization",label:(0,l.__)("Nonprofit Organization","simple-sales-tax")},{value:"Government",label:(0,l.__)("Government","simple-sales-tax")},{value:"NotABusiness",label:(0,l.__)("Not a Business","simple-sales-tax")},{value:"Other",label:(0,l.__)("Other","simple-sales-tax")}]),O=[{value:"",label:(0,l.__)("Select a reason","simple-sales-tax"),disabled:!0},{value:"FederalGovernmentDepartment",label:(0,l.__)("Federal Government Department","simple-sales-tax")},{value:"StateOrLocalGovernmentName",label:(0,l.__)("State Or Local Government","simple-sales-tax")},{value:"TribalGovernmentName",label:(0,l.__)("Tribal Government","simple-sales-tax")},{value:"ForeignDiplomat",label:(0,l.__)("Foreign Diplomat","simple-sales-tax")},{value:"CharitableOrganization",label:(0,l.__)("Charitable Organization","simple-sales-tax")},{value:"ReligiousOrEducationalOrganization",label:(0,l.__)("Religious or Educational Organization","simple-sales-tax")},{value:"Resale",label:(0,l.__)("Resale","simple-sales-tax")},{value:"AgriculturalProduction",label:(0,l.__)("Agricultural Production","simple-sales-tax")},{value:"IndustrialProductionOrManufacturing",label:(0,l.__)("Industrial Production or Manufacturing","simple-sales-tax")},{value:"DirectPayPermit",label:(0,l.__)("Direct Pay Permit","simple-sales-tax")},{value:"DirectMail",label:(0,l.__)("Direct Mail","simple-sales-tax")},{value:"Other",label:(0,l.__)("Other","simple-sales-tax")}],w="simple-sales-tax",C=(e,a)=>{const{__internalSetExtensionData:l}=(0,t.useDispatch)(m.CHECKOUT_STORE_KEY),s=(0,t.useSelect)((t=>{var l;const s=t(m.CHECKOUT_STORE_KEY).getExtensionData();return null!==(l=s[w]?.[e])&&void 0!==l?l:a})),i=(0,r.useCallback)((a=>{l(w,{[e]:a})}),[l]);return(0,r.useEffect)((()=>{i(a)}),[a,i]),[s,i]},T={SinglePurchase:!1,ExemptState:"",TaxType:"StateIssued",StateOfIssue:"",IDNumber:"",PurchaserBusinessType:"",PurchaserBusinessTypeOtherValue:"",PurchaserExemptionReason:"",PurchaserExemptionReasonOtherValue:""},P=()=>{const[s,r]=C("certificate",T),i=(e,a)=>{r({...s,[e]:a})},{businessTypeOtherError:n,exemptionReasonOtherError:o}=(0,t.useSelect)((e=>{const a=e(m.VALIDATION_STORE_KEY);return{businessTypeOtherError:a.getValidationError("purchase_business_type_other_value_error"),exemptionReasonOtherError:a.getValidationError("purchaser_exemption_reason_value_error")}})),c=e=>!!e?.message&&!e?.hidden;return(0,a.createElement)("div",{className:"sst-tax-exemption__form"},(0,a.createElement)("p",{class:"sst-tax-exemption__form-disclaimer"},(0,a.createElement)("strong",null,(0,l.__)("WARNING:","simple-sales-tax")),(0,l.__)("You are responsible for knowing if you qualify to claim exemption from tax in the state that is due tax on this sale. You will be held liable for any tax and interest, as well as civil and criminal penalties imposed by the member state, if you are not eligible to claim this exemption.","simple-sales-tax")),(0,a.createElement)(e.CheckboxControl,{id:"single_purchase",checked:s.SinglePurchase,onChange:e=>i("SinglePurchase",e)},(0,l.__)("This is a single-purchase exemption certificate","simple-sales-tax")),(0,a.createElement)(g,{id:"exempt_state",label:(0,l.__)("Exempt state","simple-sales-tax"),country:"US",states:f,value:s.ExemptState,onChange:e=>i("ExemptState",e),required:!0}),(0,a.createElement)("div",{className:"sst-radio-group",role:"radiogroup",id:"tax_type",ariaLabelledBy:"tax_type_label"},(0,a.createElement)("label",{id:"tax_type_label"},(0,l.__)("Tax ID type","simple-sales-tax")),(0,a.createElement)(d.RadioControl,{id:"tax_type",selected:s.TaxType,options:[{label:(0,l.__)("State Issued Exemption ID or Drivers License","simple-sales-tax"),value:"StateIssued"},{label:(0,l.__)("Federal Employer ID","simple-sales-tax"),value:"FEIN"}],onChange:e=>i("TaxType",e)})),"StateIssued"===s.TaxType&&(0,a.createElement)(g,{id:"state_of_issue",label:(0,l.__)("Issuing state","simple-sales-tax"),country:"US",states:f,value:s.StateOfIssue,onChange:e=>i("StateOfIssue",e),required:!0}),(0,a.createElement)(d.ValidatedTextInput,{id:"id_number",errorId:"id_number_error",label:(0,l.__)("Tax ID","simple-sales-tax"),required:!0,type:"text",value:s.IDNumber,onChange:e=>i("IDNumber",e)}),(0,a.createElement)(_,{id:"purchaser_business_type",label:(0,l.__)("Business type","simple-sales-tax"),onChange:e=>i("PurchaserBusinessType",e),options:y,value:s.PurchaserBusinessType,required:!0}),"Other"===s.PurchaserBusinessType&&(0,a.createElement)(d.ValidatedTextInput,{id:"purchase_business_type_other_value",errorId:"purchase_business_type_other_value_error",label:(0,l.__)("Explain the nature of your business","simple-sales-tax"),required:!0,type:"text",value:s.PurchaserBusinessTypeOtherValue,onChange:e=>i("PurchaserBusinessTypeOtherValue",e),showError:c(n),errorMessage:(0,l.__)("Please explain the nature of your business","simple-sales-tax")}),(0,a.createElement)(_,{id:"purchaser_exemption_reason",label:(0,l.__)("Reason for exemption","simple-sales-tax"),onChange:e=>i("PurchaserExemptionReason",e),options:O,value:s.PurchaserExemptionReason,required:!0}),"Other"===s.PurchaserExemptionReason&&(0,a.createElement)(d.ValidatedTextInput,{id:"purchaser_exemption_reason_value",errorId:"purchaser_exemption_reason_value_error",label:(0,l.__)("Please explain","simple-sales-tax"),required:!0,type:"text",value:s.PurchaserExemptionReasonOtherValue,onChange:e=>i("PurchaserExemptionReasonOtherValue",e),showError:c(o),errorMessage:(0,l.__)("Please explain why you are tax exempt","simple-sales-tax")}))},{showExemptionForm:k,certificateOptions:R,selectedCertificate:I,isUserLoggedIn:A,myAccountEndpointUrl:N}=(0,s.getSetting)("simple-sales-tax_data",""),D=Object.entries(R).map((([e,a])=>({value:e,label:a}))),F=JSON.parse('{"apiVersion":3,"name":"simple-sales-tax/tax-exemption","version":"1.0.0","title":"Tax Exemption Block","category":"woocommerce","description":"Adds a tax exemption form to the checkout.","supports":{"html":false,"align":false,"multiple":false,"reusable":false},"parent":["woocommerce/checkout-fields-block"],"textdomain":"simple-sales-tax","attributes":{},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}');(0,e.registerCheckoutBlock)({metadata:F,component:({className:s,children:r})=>{if(!k)return null;const[i,n]=C("certificate_id",I),{__internalIncrementCalculating:o,__internalDecrementCalculating:c}=(0,t.useDispatch)(m.CHECKOUT_STORE_KEY);return(0,a.createElement)("div",{className:s},(0,a.createElement)(d.Title,{headingLevel:"2"},(0,l.__)("Tax exemption","simple-sales-tax")),!A&&(0,a.createElement)("p",null,(0,l.__)("Please log in or register to apply an exemption certificate.","simple-sales-tax")),A&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(_,{id:"exemption-certificate-input",label:(0,l.__)("Exemption certificate","simple-sales-tax"),onChange:a=>{n(a),o(),(0,e.extensionCartUpdate)({namespace:"simple-sales-tax",data:{action:"set_certificate_id",certificate_id:a}}).finally((()=>{c()}))},options:D,value:i}),(0,a.createElement)("a",{href:N,target:"_blank"},(0,l.__)("Manage exemption certificates →","simple-sales-tax")),"new"===i&&(0,a.createElement)(P,null)))}})}},t={};function l(e){var s=t[e];if(void 0!==s)return s.exports;var r=t[e]={exports:{}};return a[e](r,r.exports,l),r.exports}l.m=a,e=[],l.O=(a,t,s,r)=>{if(!t){var i=1/0;for(u=0;u<e.length;u++){t=e[u][0],s=e[u][1],r=e[u][2];for(var n=!0,o=0;o<t.length;o++)(!1&r||i>=r)&&Object.keys(l.O).every((e=>l.O[e](t[o])))?t.splice(o--,1):(n=!1,r<i&&(i=r));if(n){e.splice(u--,1);var c=s();void 0!==c&&(a=c)}}return a}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[t,s,r]},l.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={293:0,575:0};l.O.j=a=>0===e[a];var a=(a,t)=>{var s,r,i=t[0],n=t[1],o=t[2],c=0;if(i.some((a=>0!==e[a]))){for(s in n)l.o(n,s)&&(l.m[s]=n[s]);if(o)var u=o(l)}for(a&&a(t);c<i.length;c++)r=i[c],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(u)},t=self.webpackChunksimplesalestax=self.webpackChunksimplesalestax||[];t.forEach(a.bind(null,0)),t.push=a.bind(null,t.push.bind(t))})();var s=l.O(void 0,[575],(()=>l(728)));s=l.O(s)})();4 (0,l.__)("Select a %s","woocommerce"),w?u:u?.toLowerCase()),disabled:!!b})),[u,E,b,w]),C=(0,r.useId)(),T=f.id||`wc-blocks-components-select-${C}`,P=g||T,k=(0,r.useMemo)((()=>b&&_?c:[O].concat(c)),[b,_,O,c]),{setValidationErrors:R,clearValidationError:I}=(0,t.useDispatch)(m.validationStore),{error:A,validationErrorId:N}=(0,t.useSelect)((e=>{const a=e(m.validationStore);return{error:a.getValidationError(P),validationErrorId:a.getValidationErrorId(P)}}));(0,r.useEffect)((()=>(!b||_?I(P):R({[P]:{message:v,hidden:!0}}),()=>{I(P)})),[I,_,P,v,b,R]);const D=(0,t.useSelect)((e=>e(m.validationStore).getValidationError(P||"")||{hidden:!0}));return(0,a.createElement)("div",{className:p(h,{"has-error":!D.hidden})},(0,a.createElement)("div",{className:"wc-blocks-components-select"},(0,a.createElement)("div",{className:"wc-blocks-components-select__container"},(0,a.createElement)("label",{htmlFor:T,className:"wc-blocks-components-select__label"},u),(0,a.createElement)("select",{className:"wc-blocks-components-select__select",id:T,size:void 0!==x?x:1,onChange:S,value:_,"aria-invalid":!(!A?.message||A?.hidden),"aria-errormessage":N,...f},k.map((e=>(0,a.createElement)("option",{key:e.value,value:e.value,"data-alternate-values":`[${e.label}]`,disabled:void 0!==e.disabled&&e.disabled},e.label)))),(0,a.createElement)(i,{className:"wc-blocks-components-select__expand",icon:o}))),(0,a.createElement)(d.ValidationInputError,{propertyName:P}))},h=window.wp.htmlEntities,x=(e,a)=>{const t=a.find((a=>a.label.toLocaleUpperCase()===e.toLocaleUpperCase()||a.value.toLocaleUpperCase()===e.toLocaleUpperCase()));return t?t.value:""},g=({className:e,id:t,states:l,country:s,label:i,onChange:n,autoComplete:o="off",value:c="",required:p=!1})=>{const m=l[s],g=(0,r.useMemo)((()=>m&&Object.keys(m).length>0?Object.keys(m).map((e=>({value:e,label:(0,h.decodeEntities)(m[e])}))):[]),[m]),b=(0,r.useCallback)((e=>{const a=g.length>0?x(e,g):e;a!==c&&n(a)}),[n,g,c]),v=(0,r.useRef)(c);return(0,r.useEffect)((()=>{v.current!==c&&(v.current=c)}),[c]),(0,r.useEffect)((()=>{if(g.length>0&&v.current){const e=x(v.current,g);e!==v.current&&b(e)}}),[g,b]),g.length>0?(0,a.createElement)(_,{className:u(e,"wc-block-components-state-input"),options:g,label:i||"",id:t,onChange:b,value:c,autoComplete:o,required:p}):(0,a.createElement)(d.ValidatedTextInput,{className:e,id:t,label:i,onChange:b,autoComplete:o,value:c,required:p})},b=(0,s.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),v=(b.pluginUrl,b.pluginUrl,s.STORE_PAGES.shop,s.STORE_PAGES.checkout,s.STORE_PAGES.checkout,s.STORE_PAGES.privacy,s.STORE_PAGES.privacy,s.STORE_PAGES.terms,s.STORE_PAGES.terms,s.STORE_PAGES.cart,s.STORE_PAGES.cart,s.STORE_PAGES.myaccount?.permalink?s.STORE_PAGES.myaccount.permalink:(0,s.getSetting)("wpLoginUrl","/wp-login.php"),(0,s.getSetting)("localPickupEnabled",!1),(0,s.getSetting)("shippingMethodsExist",!1),(0,s.getSetting)("countries",{})),E=(0,s.getSetting)("countryData",{}),f=(Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowBilling)).map((e=>[e,v[e]||""]))),Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowBilling)).map((e=>[e,E[e].states||[]])))),S=(Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowShipping)).map((e=>[e,v[e]||""]))),Object.fromEntries(Object.keys(E).filter((e=>!0===E[e].allowShipping)).map((e=>[e,E[e].states||[]]))),Object.fromEntries(Object.keys(E).map((e=>[e,E[e].locale||[]]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),y=((0,s.getSetting)("addressFieldsLocations",S).address,(0,s.getSetting)("addressFieldsLocations",S).contact,(0,s.getSetting)("addressFieldsLocations",S).order,(0,s.getSetting)("additionalOrderFields",{}),(0,s.getSetting)("additionalContactFields",{}),(0,s.getSetting)("additionalAddressFields",{}),[{value:"",label:(0,l.__)("Select a business type","simple-sales-tax"),disabled:!0},{value:"AccommodationAndFoodServices",label:(0,l.__)("Accommodation And Food Services","simple-sales-tax")},{value:"Agricultural_Forestry_Fishing_Hunting",label:(0,l.__)("Agricultural/Forestry/Fishing/Hunting","simple-sales-tax")},{value:"Construction",label:(0,l.__)("Construction","simple-sales-tax")},{value:"FinanceAndInsurance",label:(0,l.__)("Finance or Insurance","simple-sales-tax")},{value:"Information_PublishingAndCommunications",label:(0,l.__)("Information Publishing and Communications","simple-sales-tax")},{value:"Manufacturing",label:(0,l.__)("Manufacturing","simple-sales-tax")},{value:"Mining",label:(0,l.__)("Mining","simple-sales-tax")},{value:"RealEstate",label:(0,l.__)("Real Estate","simple-sales-tax")},{value:"RentalAndLeasing",label:(0,l.__)("Rental and Leasing","simple-sales-tax")},{value:"RetailTrade",label:(0,l.__)("Retail Trade","simple-sales-tax")},{value:"TransportationAndWarehousing",label:(0,l.__)("Transportation and Warehousing","simple-sales-tax")},{value:"Utilities",label:(0,l.__)("Utilities","simple-sales-tax")},{value:"WholesaleTrade",label:(0,l.__)("Wholesale Trade","simple-sales-tax")},{value:"BusinessServices",label:(0,l.__)("Business Services","simple-sales-tax")},{value:"ProfessionalServices",label:(0,l.__)("Professional Services","simple-sales-tax")},{value:"EducationAndHealthCareServices",label:(0,l.__)("Education and Health Care Services","simple-sales-tax")},{value:"NonprofitOrganization",label:(0,l.__)("Nonprofit Organization","simple-sales-tax")},{value:"Government",label:(0,l.__)("Government","simple-sales-tax")},{value:"NotABusiness",label:(0,l.__)("Not a Business","simple-sales-tax")},{value:"Other",label:(0,l.__)("Other","simple-sales-tax")}]),w=[{value:"",label:(0,l.__)("Select a reason","simple-sales-tax"),disabled:!0},{value:"FederalGovernmentDepartment",label:(0,l.__)("Federal Government Department","simple-sales-tax")},{value:"StateOrLocalGovernmentName",label:(0,l.__)("State Or Local Government","simple-sales-tax")},{value:"TribalGovernmentName",label:(0,l.__)("Tribal Government","simple-sales-tax")},{value:"ForeignDiplomat",label:(0,l.__)("Foreign Diplomat","simple-sales-tax")},{value:"CharitableOrganization",label:(0,l.__)("Charitable Organization","simple-sales-tax")},{value:"ReligiousOrEducationalOrganization",label:(0,l.__)("Religious or Educational Organization","simple-sales-tax")},{value:"Resale",label:(0,l.__)("Resale","simple-sales-tax")},{value:"AgriculturalProduction",label:(0,l.__)("Agricultural Production","simple-sales-tax")},{value:"IndustrialProductionOrManufacturing",label:(0,l.__)("Industrial Production or Manufacturing","simple-sales-tax")},{value:"DirectPayPermit",label:(0,l.__)("Direct Pay Permit","simple-sales-tax")},{value:"DirectMail",label:(0,l.__)("Direct Mail","simple-sales-tax")},{value:"Other",label:(0,l.__)("Other","simple-sales-tax")}],O="simple-sales-tax",C=(e,a)=>{const{__internalSetExtensionData:l}=(0,t.useDispatch)(m.CHECKOUT_STORE_KEY),s=(0,t.useSelect)((t=>{var l;const s=t(m.CHECKOUT_STORE_KEY).getExtensionData();return null!==(l=s[O]?.[e])&&void 0!==l?l:a})),i=(0,r.useCallback)((a=>{l(O,{[e]:a})}),[l]);return(0,r.useEffect)((()=>{i(a)}),[a,i]),[s,i]},T={SinglePurchase:!1,ExemptState:"",TaxType:"StateIssued",StateOfIssue:"",IDNumber:"",PurchaserBusinessType:"",PurchaserBusinessTypeOtherValue:"",PurchaserExemptionReason:"",PurchaserExemptionReasonOtherValue:""},P=()=>{const[s,r]=C("certificate",T),i=(e,a)=>{r({...s,[e]:a})},{businessTypeOtherError:n,exemptionReasonOtherError:o}=(0,t.useSelect)((e=>{const a=e(m.VALIDATION_STORE_KEY);return{businessTypeOtherError:a.getValidationError("purchase_business_type_other_value_error"),exemptionReasonOtherError:a.getValidationError("purchaser_exemption_reason_value_error")}})),c=e=>!!e?.message&&!e?.hidden;return(0,a.createElement)("div",{className:"sst-tax-exemption__form"},(0,a.createElement)("p",{class:"sst-tax-exemption__form-disclaimer"},(0,a.createElement)("strong",null,(0,l.__)("WARNING:","simple-sales-tax")),(0,l.__)("You are responsible for knowing if you qualify to claim exemption from tax in the state that is due tax on this sale. You will be held liable for any tax and interest, as well as civil and criminal penalties imposed by the member state, if you are not eligible to claim this exemption.","simple-sales-tax")),(0,a.createElement)(e.CheckboxControl,{id:"single_purchase",checked:s.SinglePurchase,onChange:e=>i("SinglePurchase",e)},(0,l.__)("This is a single-purchase exemption certificate","simple-sales-tax")),(0,a.createElement)(g,{id:"exempt_state",label:(0,l.__)("Exempt state","simple-sales-tax"),country:"US",states:f,value:s.ExemptState,onChange:e=>i("ExemptState",e),required:!0}),(0,a.createElement)("div",{className:"sst-radio-group",role:"radiogroup",id:"tax_type",ariaLabelledBy:"tax_type_label"},(0,a.createElement)("label",{id:"tax_type_label"},(0,l.__)("Tax ID type","simple-sales-tax")),(0,a.createElement)(d.RadioControl,{id:"tax_type",selected:s.TaxType,options:[{label:(0,l.__)("State Issued Exemption ID or Drivers License","simple-sales-tax"),value:"StateIssued"},{label:(0,l.__)("Federal Employer ID","simple-sales-tax"),value:"FEIN"}],onChange:e=>i("TaxType",e)})),"StateIssued"===s.TaxType&&(0,a.createElement)(g,{id:"state_of_issue",label:(0,l.__)("Issuing state","simple-sales-tax"),country:"US",states:f,value:s.StateOfIssue,onChange:e=>i("StateOfIssue",e),required:!0}),(0,a.createElement)(d.ValidatedTextInput,{id:"id_number",errorId:"id_number_error",label:(0,l.__)("Tax ID","simple-sales-tax"),required:!0,type:"text",value:s.IDNumber,onChange:e=>i("IDNumber",e)}),(0,a.createElement)(_,{id:"purchaser_business_type",label:(0,l.__)("Business type","simple-sales-tax"),onChange:e=>i("PurchaserBusinessType",e),options:y,value:s.PurchaserBusinessType,required:!0}),"Other"===s.PurchaserBusinessType&&(0,a.createElement)(d.ValidatedTextInput,{id:"purchase_business_type_other_value",errorId:"purchase_business_type_other_value_error",label:(0,l.__)("Explain the nature of your business","simple-sales-tax"),required:!0,type:"text",value:s.PurchaserBusinessTypeOtherValue,onChange:e=>i("PurchaserBusinessTypeOtherValue",e),showError:c(n),errorMessage:(0,l.__)("Please explain the nature of your business","simple-sales-tax")}),(0,a.createElement)(_,{id:"purchaser_exemption_reason",label:(0,l.__)("Reason for exemption","simple-sales-tax"),onChange:e=>i("PurchaserExemptionReason",e),options:w,value:s.PurchaserExemptionReason,required:!0}),"Other"===s.PurchaserExemptionReason&&(0,a.createElement)(d.ValidatedTextInput,{id:"purchaser_exemption_reason_value",errorId:"purchaser_exemption_reason_value_error",label:(0,l.__)("Please explain","simple-sales-tax"),required:!0,type:"text",value:s.PurchaserExemptionReasonOtherValue,onChange:e=>i("PurchaserExemptionReasonOtherValue",e),showError:c(o),errorMessage:(0,l.__)("Please explain why you are tax exempt","simple-sales-tax")}))},{showExemptionForm:k,certificateOptions:R,selectedCertificate:I,isUserLoggedIn:A,myAccountEndpointUrl:N}=(0,s.getSetting)("simple-sales-tax_data",""),D=Object.entries(R).map((([e,a])=>({value:e,label:a}))),F=JSON.parse('{"apiVersion":3,"name":"simple-sales-tax/tax-exemption","version":"1.0.0","title":"Tax Exemption Block","category":"woocommerce","description":"Adds a tax exemption form to the checkout.","supports":{"html":false,"align":false,"multiple":false,"reusable":false},"parent":["woocommerce/checkout-fields-block"],"textdomain":"simple-sales-tax","attributes":{},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}');(0,e.registerCheckoutBlock)({metadata:F,component:({className:s,children:r})=>{if(!k)return null;const[i,n]=C("certificate_id",I),{__internalIncrementCalculating:o,__internalDecrementCalculating:c}=(0,t.useDispatch)(m.CHECKOUT_STORE_KEY);let u=(0,l.__)("No exemption certificate will be applied to this order.","simple-sales-tax");return"new"===i?u=(0,l.__)("Complete the certificate details below to apply it to this order.","simple-sales-tax"):i&&(u=(0,l.__)("This certificate will be applied to this order. Certificates are ordered newest first.","simple-sales-tax")),(0,a.createElement)("div",{className:s},(0,a.createElement)(d.Title,{headingLevel:"2"},(0,l.__)("Tax exemption","simple-sales-tax")),!A&&(0,a.createElement)("p",null,(0,l.__)("Please log in or register to apply an exemption certificate.","simple-sales-tax")),A&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(_,{id:"exemption-certificate-input",label:(0,l.__)("Certificate to apply","simple-sales-tax"),onChange:a=>{n(a),o(),(0,e.extensionCartUpdate)({namespace:"simple-sales-tax",data:{action:"set_certificate_id",certificate_id:a}}).finally((()=>{c()}))},options:D,value:i}),(0,a.createElement)("p",{className:"sst-certificate-selection-help"},u),(0,a.createElement)("a",{href:N,target:"_blank"},(0,l.__)("Manage exemption certificates →","simple-sales-tax")),"new"===i&&(0,a.createElement)(P,null)))}})}},t={};function l(e){var s=t[e];if(void 0!==s)return s.exports;var r=t[e]={exports:{}};return a[e](r,r.exports,l),r.exports}l.m=a,e=[],l.O=(a,t,s,r)=>{if(!t){var i=1/0;for(u=0;u<e.length;u++){t=e[u][0],s=e[u][1],r=e[u][2];for(var n=!0,o=0;o<t.length;o++)(!1&r||i>=r)&&Object.keys(l.O).every((e=>l.O[e](t[o])))?t.splice(o--,1):(n=!1,r<i&&(i=r));if(n){e.splice(u--,1);var c=s();void 0!==c&&(a=c)}}return a}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[t,s,r]},l.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={293:0,575:0};l.O.j=a=>0===e[a];var a=(a,t)=>{var s,r,i=t[0],n=t[1],o=t[2],c=0;if(i.some((a=>0!==e[a]))){for(s in n)l.o(n,s)&&(l.m[s]=n[s]);if(o)var u=o(l)}for(a&&a(t);c<i.length;c++)r=i[c],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(u)},t=self.webpackChunksimplesalestax=self.webpackChunksimplesalestax||[];t.forEach(a.bind(null,0)),t.push=a.bind(null,t.push.bind(t))})();var s=l.O(void 0,[575],(()=>l(728)));s=l.O(s)})(); -
simple-sales-tax/trunk/build/tax-exemption-block.asset.php
r3326417 r3669483 1 <?php return array('dependencies' => array('react', 'wc-blocks-checkout', 'wc-blocks-components', 'wc-blocks-data-store', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-primitives'), 'version' => ' 87afb26bfc240c967e00');1 <?php return array('dependencies' => array('react', 'wc-blocks-checkout', 'wc-blocks-components', 'wc-blocks-data-store', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-primitives'), 'version' => '45531217e6a53f629eb4'); -
simple-sales-tax/trunk/build/tax-exemption-block.js
r3326417 r3669483 1 (()=>{"use strict";var e,a={959:()=>{const e=window.React,a=window.wp.element,t=(0,a.forwardRef)((function({icon:e,size:t=24,...l},s){return(0,a.cloneElement)(e,{width:t,height:t,...l,ref:s})})),l=window.wp.primitives,s=(0,e.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(l.Path,{fillRule:"evenodd",d:"M6.5 8a1.5 1.5 0 103 0 1.5 1.5 0 00-3 0zM8 5a3 3 0 100 6 3 3 0 000-6zm6.5 11a1.5 1.5 0 103 0 1.5 1.5 0 00-3 0zm1.5-3a3 3 0 100 6 3 3 0 000-6zM5.47 17.41a.75.75 0 001.06 1.06L18.47 6.53a.75.75 0 10-1.06-1.06L5.47 17.41z",clipRule:"evenodd"})),r=window.wp.blocks,i=window.wp.blockEditor,n=window.wp.components,o=window.wp.data,c=window.wp.i18n,u=window.wc.wcSettings,p=(0,e.createElement)(l.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(l.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));function m(e){var a,t,l="";if("string"==typeof e||"number"==typeof e)l+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(a=0;a<s;a++)e[a]&&(t=m(e[a]))&&(l&&(l+=" "),l+=t)}else for(t in e)e[t]&&(l&&(l+=" "),l+=t);return l}function d(){for(var e,a,t=0,l="",s=arguments.length;t<s;t++)(e=arguments[t])&&(a=m(e))&&(l&&(l+=" "),l+=a);return l}const _=d,x=window.wc.wcBlocksData,h=window.wc.blocksComponents, g=l=>{var s;const{onChange:r,options:i,label:n,value:u="",className:m,size:d,errorId:g,required:b,errorMessage:v=(0,c.__)("Please select a valid option","woocommerce"),placeholder:E,...f}=l,w=(0,a.useCallback)((e=>{r(e.target.value)}),[r]),S=(0,c.getLocaleData)(),y=["de","de_AT","de_CH"].includes(null!==(s=S?.[""]?.lang)&&void 0!==s?s:"en"),O=(0,a.useMemo)((()=>({value:"",label:null!=E?E:(0,c.sprintf)(1 (()=>{"use strict";var e,a={959:()=>{const e=window.React,a=window.wp.element,t=(0,a.forwardRef)((function({icon:e,size:t=24,...l},s){return(0,a.cloneElement)(e,{width:t,height:t,...l,ref:s})})),l=window.wp.primitives,s=(0,e.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(l.Path,{fillRule:"evenodd",d:"M6.5 8a1.5 1.5 0 103 0 1.5 1.5 0 00-3 0zM8 5a3 3 0 100 6 3 3 0 000-6zm6.5 11a1.5 1.5 0 103 0 1.5 1.5 0 00-3 0zm1.5-3a3 3 0 100 6 3 3 0 000-6zM5.47 17.41a.75.75 0 001.06 1.06L18.47 6.53a.75.75 0 10-1.06-1.06L5.47 17.41z",clipRule:"evenodd"})),r=window.wp.blocks,i=window.wp.blockEditor,n=window.wp.components,o=window.wp.data,c=window.wp.i18n,u=window.wc.wcSettings,p=(0,e.createElement)(l.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(l.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));function m(e){var a,t,l="";if("string"==typeof e||"number"==typeof e)l+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(a=0;a<s;a++)e[a]&&(t=m(e[a]))&&(l&&(l+=" "),l+=t)}else for(t in e)e[t]&&(l&&(l+=" "),l+=t);return l}function d(){for(var e,a,t=0,l="",s=arguments.length;t<s;t++)(e=arguments[t])&&(a=m(e))&&(l&&(l+=" "),l+=a);return l}const _=d,x=window.wc.wcBlocksData,h=window.wc.blocksComponents,b=l=>{var s;const{onChange:r,options:i,label:n,value:u="",className:m,size:d,errorId:b,required:g,errorMessage:v=(0,c.__)("Please select a valid option","woocommerce"),placeholder:E,...f}=l,w=(0,a.useCallback)((e=>{r(e.target.value)}),[r]),S=(0,c.getLocaleData)(),y=["de","de_AT","de_CH"].includes(null!==(s=S?.[""]?.lang)&&void 0!==s?s:"en"),O=(0,a.useMemo)((()=>({value:"",label:null!=E?E:(0,c.sprintf)( 2 2 // translators: %s will be label of the field. For example "country/region". 3 3 // translators: %s will be label of the field. For example "country/region". 4 (0,c.__)("Select a %s","woocommerce"),y?n:n?.toLowerCase()),disabled:!! b})),[n,E,b,y]),T=(0,a.useId)(),C=f.id||`wc-blocks-components-select-${T}`,P=g||C,k=(0,a.useMemo)((()=>b&&u?i:[O].concat(i)),[b,u,O,i]),{setValidationErrors:R,clearValidationError:I}=(0,o.useDispatch)(x.validationStore),{error:A,validationErrorId:N}=(0,o.useSelect)((e=>{const a=e(x.validationStore);return{error:a.getValidationError(P),validationErrorId:a.getValidationErrorId(P)}}));(0,a.useEffect)((()=>(!b||u?I(P):R({[P]:{message:v,hidden:!0}}),()=>{I(P)})),[I,u,P,v,b,R]);const D=(0,o.useSelect)((e=>e(x.validationStore).getValidationError(P||"")||{hidden:!0}));return(0,e.createElement)("div",{className:_(m,{"has-error":!D.hidden})},(0,e.createElement)("div",{className:"wc-blocks-components-select"},(0,e.createElement)("div",{className:"wc-blocks-components-select__container"},(0,e.createElement)("label",{htmlFor:C,className:"wc-blocks-components-select__label"},n),(0,e.createElement)("select",{className:"wc-blocks-components-select__select",id:C,size:void 0!==d?d:1,onChange:w,value:u,"aria-invalid":!(!A?.message||A?.hidden),"aria-errormessage":N,...f},k.map((a=>(0,e.createElement)("option",{key:a.value,value:a.value,"data-alternate-values":`[${a.label}]`,disabled:void 0!==a.disabled&&a.disabled},a.label)))),(0,e.createElement)(t,{className:"wc-blocks-components-select__expand",icon:p}))),(0,e.createElement)(h.ValidationInputError,{propertyName:P}))},b=window.wc.blocksCheckout,v=window.wp.htmlEntities,E=(e,a)=>{const t=a.find((a=>a.label.toLocaleUpperCase()===e.toLocaleUpperCase()||a.value.toLocaleUpperCase()===e.toLocaleUpperCase()));return t?t.value:""},f=({className:t,id:l,states:s,country:r,label:i,onChange:n,autoComplete:o="off",value:c="",required:u=!1})=>{const p=s[r],m=(0,a.useMemo)((()=>p&&Object.keys(p).length>0?Object.keys(p).map((e=>({value:e,label:(0,v.decodeEntities)(p[e])}))):[]),[p]),_=(0,a.useCallback)((e=>{const a=m.length>0?E(e,m):e;a!==c&&n(a)}),[n,m,c]),x=(0,a.useRef)(c);return(0,a.useEffect)((()=>{x.current!==c&&(x.current=c)}),[c]),(0,a.useEffect)((()=>{if(m.length>0&&x.current){const e=E(x.current,m);e!==x.current&&_(e)}}),[m,_]),m.length>0?(0,e.createElement)(g,{className:d(t,"wc-block-components-state-input"),options:m,label:i||"",id:l,onChange:_,value:c,autoComplete:o,required:u}):(0,e.createElement)(h.ValidatedTextInput,{className:t,id:l,label:i,onChange:_,autoComplete:o,value:c,required:u})},w=(0,u.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),S=(w.pluginUrl,w.pluginUrl,u.STORE_PAGES.shop,u.STORE_PAGES.checkout,u.STORE_PAGES.checkout,u.STORE_PAGES.privacy,u.STORE_PAGES.privacy,u.STORE_PAGES.terms,u.STORE_PAGES.terms,u.STORE_PAGES.cart,u.STORE_PAGES.cart,u.STORE_PAGES.myaccount?.permalink?u.STORE_PAGES.myaccount.permalink:(0,u.getSetting)("wpLoginUrl","/wp-login.php"),(0,u.getSetting)("localPickupEnabled",!1),(0,u.getSetting)("shippingMethodsExist",!1),(0,u.getSetting)("countries",{})),y=(0,u.getSetting)("countryData",{}),O=(Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowBilling)).map((e=>[e,S[e]||""]))),Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowBilling)).map((e=>[e,y[e].states||[]])))),T=(Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowShipping)).map((e=>[e,S[e]||""]))),Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowShipping)).map((e=>[e,y[e].states||[]]))),Object.fromEntries(Object.keys(y).map((e=>[e,y[e].locale||[]]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),C=((0,u.getSetting)("addressFieldsLocations",T).address,(0,u.getSetting)("addressFieldsLocations",T).contact,(0,u.getSetting)("addressFieldsLocations",T).order,(0,u.getSetting)("additionalOrderFields",{}),(0,u.getSetting)("additionalContactFields",{}),(0,u.getSetting)("additionalAddressFields",{}),[{value:"",label:(0,c.__)("Select a business type","simple-sales-tax"),disabled:!0},{value:"AccommodationAndFoodServices",label:(0,c.__)("Accommodation And Food Services","simple-sales-tax")},{value:"Agricultural_Forestry_Fishing_Hunting",label:(0,c.__)("Agricultural/Forestry/Fishing/Hunting","simple-sales-tax")},{value:"Construction",label:(0,c.__)("Construction","simple-sales-tax")},{value:"FinanceAndInsurance",label:(0,c.__)("Finance or Insurance","simple-sales-tax")},{value:"Information_PublishingAndCommunications",label:(0,c.__)("Information Publishing and Communications","simple-sales-tax")},{value:"Manufacturing",label:(0,c.__)("Manufacturing","simple-sales-tax")},{value:"Mining",label:(0,c.__)("Mining","simple-sales-tax")},{value:"RealEstate",label:(0,c.__)("Real Estate","simple-sales-tax")},{value:"RentalAndLeasing",label:(0,c.__)("Rental and Leasing","simple-sales-tax")},{value:"RetailTrade",label:(0,c.__)("Retail Trade","simple-sales-tax")},{value:"TransportationAndWarehousing",label:(0,c.__)("Transportation and Warehousing","simple-sales-tax")},{value:"Utilities",label:(0,c.__)("Utilities","simple-sales-tax")},{value:"WholesaleTrade",label:(0,c.__)("Wholesale Trade","simple-sales-tax")},{value:"BusinessServices",label:(0,c.__)("Business Services","simple-sales-tax")},{value:"ProfessionalServices",label:(0,c.__)("Professional Services","simple-sales-tax")},{value:"EducationAndHealthCareServices",label:(0,c.__)("Education and Health Care Services","simple-sales-tax")},{value:"NonprofitOrganization",label:(0,c.__)("Nonprofit Organization","simple-sales-tax")},{value:"Government",label:(0,c.__)("Government","simple-sales-tax")},{value:"NotABusiness",label:(0,c.__)("Not a Business","simple-sales-tax")},{value:"Other",label:(0,c.__)("Other","simple-sales-tax")}]),P=[{value:"",label:(0,c.__)("Select a reason","simple-sales-tax"),disabled:!0},{value:"FederalGovernmentDepartment",label:(0,c.__)("Federal Government Department","simple-sales-tax")},{value:"StateOrLocalGovernmentName",label:(0,c.__)("State Or Local Government","simple-sales-tax")},{value:"TribalGovernmentName",label:(0,c.__)("Tribal Government","simple-sales-tax")},{value:"ForeignDiplomat",label:(0,c.__)("Foreign Diplomat","simple-sales-tax")},{value:"CharitableOrganization",label:(0,c.__)("Charitable Organization","simple-sales-tax")},{value:"ReligiousOrEducationalOrganization",label:(0,c.__)("Religious or Educational Organization","simple-sales-tax")},{value:"Resale",label:(0,c.__)("Resale","simple-sales-tax")},{value:"AgriculturalProduction",label:(0,c.__)("Agricultural Production","simple-sales-tax")},{value:"IndustrialProductionOrManufacturing",label:(0,c.__)("Industrial Production or Manufacturing","simple-sales-tax")},{value:"DirectPayPermit",label:(0,c.__)("Direct Pay Permit","simple-sales-tax")},{value:"DirectMail",label:(0,c.__)("Direct Mail","simple-sales-tax")},{value:"Other",label:(0,c.__)("Other","simple-sales-tax")}],k="simple-sales-tax",R=(e,t)=>{const{__internalSetExtensionData:l}=(0,o.useDispatch)(x.CHECKOUT_STORE_KEY),s=(0,o.useSelect)((a=>{var l;const s=a(x.CHECKOUT_STORE_KEY).getExtensionData();return null!==(l=s[k]?.[e])&&void 0!==l?l:t})),r=(0,a.useCallback)((a=>{l(k,{[e]:a})}),[l]);return(0,a.useEffect)((()=>{r(t)}),[t,r]),[s,r]},I={SinglePurchase:!1,ExemptState:"",TaxType:"StateIssued",StateOfIssue:"",IDNumber:"",PurchaserBusinessType:"",PurchaserBusinessTypeOtherValue:"",PurchaserExemptionReason:"",PurchaserExemptionReasonOtherValue:""},A=()=>{const[a,t]=R("certificate",I),l=(e,l)=>{t({...a,[e]:l})},{businessTypeOtherError:s,exemptionReasonOtherError:r}=(0,o.useSelect)((e=>{const a=e(x.VALIDATION_STORE_KEY);return{businessTypeOtherError:a.getValidationError("purchase_business_type_other_value_error"),exemptionReasonOtherError:a.getValidationError("purchaser_exemption_reason_value_error")}})),i=e=>!!e?.message&&!e?.hidden;return(0,e.createElement)("div",{className:"sst-tax-exemption__form"},(0,e.createElement)("p",{class:"sst-tax-exemption__form-disclaimer"},(0,e.createElement)("strong",null,(0,c.__)("WARNING:","simple-sales-tax")),(0,c.__)("You are responsible for knowing if you qualify to claim exemption from tax in the state that is due tax on this sale. You will be held liable for any tax and interest, as well as civil and criminal penalties imposed by the member state, if you are not eligible to claim this exemption.","simple-sales-tax")),(0,e.createElement)(b.CheckboxControl,{id:"single_purchase",checked:a.SinglePurchase,onChange:e=>l("SinglePurchase",e)},(0,c.__)("This is a single-purchase exemption certificate","simple-sales-tax")),(0,e.createElement)(f,{id:"exempt_state",label:(0,c.__)("Exempt state","simple-sales-tax"),country:"US",states:O,value:a.ExemptState,onChange:e=>l("ExemptState",e),required:!0}),(0,e.createElement)("div",{className:"sst-radio-group",role:"radiogroup",id:"tax_type",ariaLabelledBy:"tax_type_label"},(0,e.createElement)("label",{id:"tax_type_label"},(0,c.__)("Tax ID type","simple-sales-tax")),(0,e.createElement)(h.RadioControl,{id:"tax_type",selected:a.TaxType,options:[{label:(0,c.__)("State Issued Exemption ID or Drivers License","simple-sales-tax"),value:"StateIssued"},{label:(0,c.__)("Federal Employer ID","simple-sales-tax"),value:"FEIN"}],onChange:e=>l("TaxType",e)})),"StateIssued"===a.TaxType&&(0,e.createElement)(f,{id:"state_of_issue",label:(0,c.__)("Issuing state","simple-sales-tax"),country:"US",states:O,value:a.StateOfIssue,onChange:e=>l("StateOfIssue",e),required:!0}),(0,e.createElement)(h.ValidatedTextInput,{id:"id_number",errorId:"id_number_error",label:(0,c.__)("Tax ID","simple-sales-tax"),required:!0,type:"text",value:a.IDNumber,onChange:e=>l("IDNumber",e)}),(0,e.createElement)(g,{id:"purchaser_business_type",label:(0,c.__)("Business type","simple-sales-tax"),onChange:e=>l("PurchaserBusinessType",e),options:C,value:a.PurchaserBusinessType,required:!0}),"Other"===a.PurchaserBusinessType&&(0,e.createElement)(h.ValidatedTextInput,{id:"purchase_business_type_other_value",errorId:"purchase_business_type_other_value_error",label:(0,c.__)("Explain the nature of your business","simple-sales-tax"),required:!0,type:"text",value:a.PurchaserBusinessTypeOtherValue,onChange:e=>l("PurchaserBusinessTypeOtherValue",e),showError:i(s),errorMessage:(0,c.__)("Please explain the nature of your business","simple-sales-tax")}),(0,e.createElement)(g,{id:"purchaser_exemption_reason",label:(0,c.__)("Reason for exemption","simple-sales-tax"),onChange:e=>l("PurchaserExemptionReason",e),options:P,value:a.PurchaserExemptionReason,required:!0}),"Other"===a.PurchaserExemptionReason&&(0,e.createElement)(h.ValidatedTextInput,{id:"purchaser_exemption_reason_value",errorId:"purchaser_exemption_reason_value_error",label:(0,c.__)("Please explain","simple-sales-tax"),required:!0,type:"text",value:a.PurchaserExemptionReasonOtherValue,onChange:e=>l("PurchaserExemptionReasonOtherValue",e),showError:i(r),errorMessage:(0,c.__)("Please explain why you are tax exempt","simple-sales-tax")}))},{showExemptionForm:N,certificateOptions:D,selectedCertificate:B,isUserLoggedIn:F,myAccountEndpointUrl:L}=(0,u.getSetting)("simple-sales-tax_data",""),G=Object.entries(D).map((([e,a])=>({value:e,label:a}))),V=({className:a,children:t})=>{if(!N)return null;const[l,s]=R("certificate_id",B),{__internalIncrementCalculating:r,__internalDecrementCalculating:i}=(0,o.useDispatch)(x.CHECKOUT_STORE_KEY);return(0,e.createElement)("div",{className:a},(0,e.createElement)(h.Title,{headingLevel:"2"},(0,c.__)("Tax exemption","simple-sales-tax")),!F&&(0,e.createElement)("p",null,(0,c.__)("Please log in or register to apply an exemption certificate.","simple-sales-tax")),F&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(g,{id:"exemption-certificate-input",label:(0,c.__)("Exemption certificate","simple-sales-tax"),onChange:e=>{s(e),r(),(0,b.extensionCartUpdate)({namespace:"simple-sales-tax",data:{action:"set_certificate_id",certificate_id:e}}).finally((()=>{i()}))},options:G,value:l}),(0,e.createElement)("a",{href:L,target:"_blank"},(0,c.__)("Manage exemption certificates →","simple-sales-tax")),"new"===l&&(0,e.createElement)(A,null)))},M=JSON.parse('{"apiVersion":3,"name":"simple-sales-tax/tax-exemption","version":"1.0.0","title":"Tax Exemption Block","category":"woocommerce","description":"Adds a tax exemption form to the checkout.","supports":{"html":false,"align":false,"multiple":false,"reusable":false},"parent":["woocommerce/checkout-fields-block"],"textdomain":"simple-sales-tax","attributes":{},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}');(0,r.registerBlockType)(M,{icon:{src:(0,e.createElement)(t,{icon:s,className:"wc-block-editor-components-block-icon"})},edit:()=>{const a=(0,i.useBlockProps)();return(0,e.createElement)("div",{...a},(0,e.createElement)(n.Disabled,null,(0,e.createElement)(V,null)))},save:()=>(0,e.createElement)("div",{"data-block-name":"simple-sales-tax/tax-exemption",...i.useBlockProps.save()})})}},t={};function l(e){var s=t[e];if(void 0!==s)return s.exports;var r=t[e]={exports:{}};return a[e](r,r.exports,l),r.exports}l.m=a,e=[],l.O=(a,t,s,r)=>{if(!t){var i=1/0;for(u=0;u<e.length;u++){t=e[u][0],s=e[u][1],r=e[u][2];for(var n=!0,o=0;o<t.length;o++)(!1&r||i>=r)&&Object.keys(l.O).every((e=>l.O[e](t[o])))?t.splice(o--,1):(n=!1,r<i&&(i=r));if(n){e.splice(u--,1);var c=s();void 0!==c&&(a=c)}}return a}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[t,s,r]},l.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={476:0,575:0};l.O.j=a=>0===e[a];var a=(a,t)=>{var s,r,i=t[0],n=t[1],o=t[2],c=0;if(i.some((a=>0!==e[a]))){for(s in n)l.o(n,s)&&(l.m[s]=n[s]);if(o)var u=o(l)}for(a&&a(t);c<i.length;c++)r=i[c],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(u)},t=self.webpackChunksimplesalestax=self.webpackChunksimplesalestax||[];t.forEach(a.bind(null,0)),t.push=a.bind(null,t.push.bind(t))})();var s=l.O(void 0,[575],(()=>l(959)));s=l.O(s)})();4 (0,c.__)("Select a %s","woocommerce"),y?n:n?.toLowerCase()),disabled:!!g})),[n,E,g,y]),C=(0,a.useId)(),T=f.id||`wc-blocks-components-select-${C}`,P=b||T,k=(0,a.useMemo)((()=>g&&u?i:[O].concat(i)),[g,u,O,i]),{setValidationErrors:R,clearValidationError:I}=(0,o.useDispatch)(x.validationStore),{error:A,validationErrorId:N}=(0,o.useSelect)((e=>{const a=e(x.validationStore);return{error:a.getValidationError(P),validationErrorId:a.getValidationErrorId(P)}}));(0,a.useEffect)((()=>(!g||u?I(P):R({[P]:{message:v,hidden:!0}}),()=>{I(P)})),[I,u,P,v,g,R]);const D=(0,o.useSelect)((e=>e(x.validationStore).getValidationError(P||"")||{hidden:!0}));return(0,e.createElement)("div",{className:_(m,{"has-error":!D.hidden})},(0,e.createElement)("div",{className:"wc-blocks-components-select"},(0,e.createElement)("div",{className:"wc-blocks-components-select__container"},(0,e.createElement)("label",{htmlFor:T,className:"wc-blocks-components-select__label"},n),(0,e.createElement)("select",{className:"wc-blocks-components-select__select",id:T,size:void 0!==d?d:1,onChange:w,value:u,"aria-invalid":!(!A?.message||A?.hidden),"aria-errormessage":N,...f},k.map((a=>(0,e.createElement)("option",{key:a.value,value:a.value,"data-alternate-values":`[${a.label}]`,disabled:void 0!==a.disabled&&a.disabled},a.label)))),(0,e.createElement)(t,{className:"wc-blocks-components-select__expand",icon:p}))),(0,e.createElement)(h.ValidationInputError,{propertyName:P}))},g=window.wc.blocksCheckout,v=window.wp.htmlEntities,E=(e,a)=>{const t=a.find((a=>a.label.toLocaleUpperCase()===e.toLocaleUpperCase()||a.value.toLocaleUpperCase()===e.toLocaleUpperCase()));return t?t.value:""},f=({className:t,id:l,states:s,country:r,label:i,onChange:n,autoComplete:o="off",value:c="",required:u=!1})=>{const p=s[r],m=(0,a.useMemo)((()=>p&&Object.keys(p).length>0?Object.keys(p).map((e=>({value:e,label:(0,v.decodeEntities)(p[e])}))):[]),[p]),_=(0,a.useCallback)((e=>{const a=m.length>0?E(e,m):e;a!==c&&n(a)}),[n,m,c]),x=(0,a.useRef)(c);return(0,a.useEffect)((()=>{x.current!==c&&(x.current=c)}),[c]),(0,a.useEffect)((()=>{if(m.length>0&&x.current){const e=E(x.current,m);e!==x.current&&_(e)}}),[m,_]),m.length>0?(0,e.createElement)(b,{className:d(t,"wc-block-components-state-input"),options:m,label:i||"",id:l,onChange:_,value:c,autoComplete:o,required:u}):(0,e.createElement)(h.ValidatedTextInput,{className:t,id:l,label:i,onChange:_,autoComplete:o,value:c,required:u})},w=(0,u.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),S=(w.pluginUrl,w.pluginUrl,u.STORE_PAGES.shop,u.STORE_PAGES.checkout,u.STORE_PAGES.checkout,u.STORE_PAGES.privacy,u.STORE_PAGES.privacy,u.STORE_PAGES.terms,u.STORE_PAGES.terms,u.STORE_PAGES.cart,u.STORE_PAGES.cart,u.STORE_PAGES.myaccount?.permalink?u.STORE_PAGES.myaccount.permalink:(0,u.getSetting)("wpLoginUrl","/wp-login.php"),(0,u.getSetting)("localPickupEnabled",!1),(0,u.getSetting)("shippingMethodsExist",!1),(0,u.getSetting)("countries",{})),y=(0,u.getSetting)("countryData",{}),O=(Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowBilling)).map((e=>[e,S[e]||""]))),Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowBilling)).map((e=>[e,y[e].states||[]])))),C=(Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowShipping)).map((e=>[e,S[e]||""]))),Object.fromEntries(Object.keys(y).filter((e=>!0===y[e].allowShipping)).map((e=>[e,y[e].states||[]]))),Object.fromEntries(Object.keys(y).map((e=>[e,y[e].locale||[]]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]}),T=((0,u.getSetting)("addressFieldsLocations",C).address,(0,u.getSetting)("addressFieldsLocations",C).contact,(0,u.getSetting)("addressFieldsLocations",C).order,(0,u.getSetting)("additionalOrderFields",{}),(0,u.getSetting)("additionalContactFields",{}),(0,u.getSetting)("additionalAddressFields",{}),[{value:"",label:(0,c.__)("Select a business type","simple-sales-tax"),disabled:!0},{value:"AccommodationAndFoodServices",label:(0,c.__)("Accommodation And Food Services","simple-sales-tax")},{value:"Agricultural_Forestry_Fishing_Hunting",label:(0,c.__)("Agricultural/Forestry/Fishing/Hunting","simple-sales-tax")},{value:"Construction",label:(0,c.__)("Construction","simple-sales-tax")},{value:"FinanceAndInsurance",label:(0,c.__)("Finance or Insurance","simple-sales-tax")},{value:"Information_PublishingAndCommunications",label:(0,c.__)("Information Publishing and Communications","simple-sales-tax")},{value:"Manufacturing",label:(0,c.__)("Manufacturing","simple-sales-tax")},{value:"Mining",label:(0,c.__)("Mining","simple-sales-tax")},{value:"RealEstate",label:(0,c.__)("Real Estate","simple-sales-tax")},{value:"RentalAndLeasing",label:(0,c.__)("Rental and Leasing","simple-sales-tax")},{value:"RetailTrade",label:(0,c.__)("Retail Trade","simple-sales-tax")},{value:"TransportationAndWarehousing",label:(0,c.__)("Transportation and Warehousing","simple-sales-tax")},{value:"Utilities",label:(0,c.__)("Utilities","simple-sales-tax")},{value:"WholesaleTrade",label:(0,c.__)("Wholesale Trade","simple-sales-tax")},{value:"BusinessServices",label:(0,c.__)("Business Services","simple-sales-tax")},{value:"ProfessionalServices",label:(0,c.__)("Professional Services","simple-sales-tax")},{value:"EducationAndHealthCareServices",label:(0,c.__)("Education and Health Care Services","simple-sales-tax")},{value:"NonprofitOrganization",label:(0,c.__)("Nonprofit Organization","simple-sales-tax")},{value:"Government",label:(0,c.__)("Government","simple-sales-tax")},{value:"NotABusiness",label:(0,c.__)("Not a Business","simple-sales-tax")},{value:"Other",label:(0,c.__)("Other","simple-sales-tax")}]),P=[{value:"",label:(0,c.__)("Select a reason","simple-sales-tax"),disabled:!0},{value:"FederalGovernmentDepartment",label:(0,c.__)("Federal Government Department","simple-sales-tax")},{value:"StateOrLocalGovernmentName",label:(0,c.__)("State Or Local Government","simple-sales-tax")},{value:"TribalGovernmentName",label:(0,c.__)("Tribal Government","simple-sales-tax")},{value:"ForeignDiplomat",label:(0,c.__)("Foreign Diplomat","simple-sales-tax")},{value:"CharitableOrganization",label:(0,c.__)("Charitable Organization","simple-sales-tax")},{value:"ReligiousOrEducationalOrganization",label:(0,c.__)("Religious or Educational Organization","simple-sales-tax")},{value:"Resale",label:(0,c.__)("Resale","simple-sales-tax")},{value:"AgriculturalProduction",label:(0,c.__)("Agricultural Production","simple-sales-tax")},{value:"IndustrialProductionOrManufacturing",label:(0,c.__)("Industrial Production or Manufacturing","simple-sales-tax")},{value:"DirectPayPermit",label:(0,c.__)("Direct Pay Permit","simple-sales-tax")},{value:"DirectMail",label:(0,c.__)("Direct Mail","simple-sales-tax")},{value:"Other",label:(0,c.__)("Other","simple-sales-tax")}],k="simple-sales-tax",R=(e,t)=>{const{__internalSetExtensionData:l}=(0,o.useDispatch)(x.CHECKOUT_STORE_KEY),s=(0,o.useSelect)((a=>{var l;const s=a(x.CHECKOUT_STORE_KEY).getExtensionData();return null!==(l=s[k]?.[e])&&void 0!==l?l:t})),r=(0,a.useCallback)((a=>{l(k,{[e]:a})}),[l]);return(0,a.useEffect)((()=>{r(t)}),[t,r]),[s,r]},I={SinglePurchase:!1,ExemptState:"",TaxType:"StateIssued",StateOfIssue:"",IDNumber:"",PurchaserBusinessType:"",PurchaserBusinessTypeOtherValue:"",PurchaserExemptionReason:"",PurchaserExemptionReasonOtherValue:""},A=()=>{const[a,t]=R("certificate",I),l=(e,l)=>{t({...a,[e]:l})},{businessTypeOtherError:s,exemptionReasonOtherError:r}=(0,o.useSelect)((e=>{const a=e(x.VALIDATION_STORE_KEY);return{businessTypeOtherError:a.getValidationError("purchase_business_type_other_value_error"),exemptionReasonOtherError:a.getValidationError("purchaser_exemption_reason_value_error")}})),i=e=>!!e?.message&&!e?.hidden;return(0,e.createElement)("div",{className:"sst-tax-exemption__form"},(0,e.createElement)("p",{class:"sst-tax-exemption__form-disclaimer"},(0,e.createElement)("strong",null,(0,c.__)("WARNING:","simple-sales-tax")),(0,c.__)("You are responsible for knowing if you qualify to claim exemption from tax in the state that is due tax on this sale. You will be held liable for any tax and interest, as well as civil and criminal penalties imposed by the member state, if you are not eligible to claim this exemption.","simple-sales-tax")),(0,e.createElement)(g.CheckboxControl,{id:"single_purchase",checked:a.SinglePurchase,onChange:e=>l("SinglePurchase",e)},(0,c.__)("This is a single-purchase exemption certificate","simple-sales-tax")),(0,e.createElement)(f,{id:"exempt_state",label:(0,c.__)("Exempt state","simple-sales-tax"),country:"US",states:O,value:a.ExemptState,onChange:e=>l("ExemptState",e),required:!0}),(0,e.createElement)("div",{className:"sst-radio-group",role:"radiogroup",id:"tax_type",ariaLabelledBy:"tax_type_label"},(0,e.createElement)("label",{id:"tax_type_label"},(0,c.__)("Tax ID type","simple-sales-tax")),(0,e.createElement)(h.RadioControl,{id:"tax_type",selected:a.TaxType,options:[{label:(0,c.__)("State Issued Exemption ID or Drivers License","simple-sales-tax"),value:"StateIssued"},{label:(0,c.__)("Federal Employer ID","simple-sales-tax"),value:"FEIN"}],onChange:e=>l("TaxType",e)})),"StateIssued"===a.TaxType&&(0,e.createElement)(f,{id:"state_of_issue",label:(0,c.__)("Issuing state","simple-sales-tax"),country:"US",states:O,value:a.StateOfIssue,onChange:e=>l("StateOfIssue",e),required:!0}),(0,e.createElement)(h.ValidatedTextInput,{id:"id_number",errorId:"id_number_error",label:(0,c.__)("Tax ID","simple-sales-tax"),required:!0,type:"text",value:a.IDNumber,onChange:e=>l("IDNumber",e)}),(0,e.createElement)(b,{id:"purchaser_business_type",label:(0,c.__)("Business type","simple-sales-tax"),onChange:e=>l("PurchaserBusinessType",e),options:T,value:a.PurchaserBusinessType,required:!0}),"Other"===a.PurchaserBusinessType&&(0,e.createElement)(h.ValidatedTextInput,{id:"purchase_business_type_other_value",errorId:"purchase_business_type_other_value_error",label:(0,c.__)("Explain the nature of your business","simple-sales-tax"),required:!0,type:"text",value:a.PurchaserBusinessTypeOtherValue,onChange:e=>l("PurchaserBusinessTypeOtherValue",e),showError:i(s),errorMessage:(0,c.__)("Please explain the nature of your business","simple-sales-tax")}),(0,e.createElement)(b,{id:"purchaser_exemption_reason",label:(0,c.__)("Reason for exemption","simple-sales-tax"),onChange:e=>l("PurchaserExemptionReason",e),options:P,value:a.PurchaserExemptionReason,required:!0}),"Other"===a.PurchaserExemptionReason&&(0,e.createElement)(h.ValidatedTextInput,{id:"purchaser_exemption_reason_value",errorId:"purchaser_exemption_reason_value_error",label:(0,c.__)("Please explain","simple-sales-tax"),required:!0,type:"text",value:a.PurchaserExemptionReasonOtherValue,onChange:e=>l("PurchaserExemptionReasonOtherValue",e),showError:i(r),errorMessage:(0,c.__)("Please explain why you are tax exempt","simple-sales-tax")}))},{showExemptionForm:N,certificateOptions:D,selectedCertificate:B,isUserLoggedIn:F,myAccountEndpointUrl:L}=(0,u.getSetting)("simple-sales-tax_data",""),G=Object.entries(D).map((([e,a])=>({value:e,label:a}))),V=({className:a,children:t})=>{if(!N)return null;const[l,s]=R("certificate_id",B),{__internalIncrementCalculating:r,__internalDecrementCalculating:i}=(0,o.useDispatch)(x.CHECKOUT_STORE_KEY);let n=(0,c.__)("No exemption certificate will be applied to this order.","simple-sales-tax");return"new"===l?n=(0,c.__)("Complete the certificate details below to apply it to this order.","simple-sales-tax"):l&&(n=(0,c.__)("This certificate will be applied to this order. Certificates are ordered newest first.","simple-sales-tax")),(0,e.createElement)("div",{className:a},(0,e.createElement)(h.Title,{headingLevel:"2"},(0,c.__)("Tax exemption","simple-sales-tax")),!F&&(0,e.createElement)("p",null,(0,c.__)("Please log in or register to apply an exemption certificate.","simple-sales-tax")),F&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(b,{id:"exemption-certificate-input",label:(0,c.__)("Certificate to apply","simple-sales-tax"),onChange:e=>{s(e),r(),(0,g.extensionCartUpdate)({namespace:"simple-sales-tax",data:{action:"set_certificate_id",certificate_id:e}}).finally((()=>{i()}))},options:G,value:l}),(0,e.createElement)("p",{className:"sst-certificate-selection-help"},n),(0,e.createElement)("a",{href:L,target:"_blank"},(0,c.__)("Manage exemption certificates →","simple-sales-tax")),"new"===l&&(0,e.createElement)(A,null)))},M=JSON.parse('{"apiVersion":3,"name":"simple-sales-tax/tax-exemption","version":"1.0.0","title":"Tax Exemption Block","category":"woocommerce","description":"Adds a tax exemption form to the checkout.","supports":{"html":false,"align":false,"multiple":false,"reusable":false},"parent":["woocommerce/checkout-fields-block"],"textdomain":"simple-sales-tax","attributes":{},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}');(0,r.registerBlockType)(M,{icon:{src:(0,e.createElement)(t,{icon:s,className:"wc-block-editor-components-block-icon"})},edit:()=>{const a=(0,i.useBlockProps)();return(0,e.createElement)("div",{...a},(0,e.createElement)(n.Disabled,null,(0,e.createElement)(V,null)))},save:()=>(0,e.createElement)("div",{"data-block-name":"simple-sales-tax/tax-exemption",...i.useBlockProps.save()})})}},t={};function l(e){var s=t[e];if(void 0!==s)return s.exports;var r=t[e]={exports:{}};return a[e](r,r.exports,l),r.exports}l.m=a,e=[],l.O=(a,t,s,r)=>{if(!t){var i=1/0;for(u=0;u<e.length;u++){t=e[u][0],s=e[u][1],r=e[u][2];for(var n=!0,o=0;o<t.length;o++)(!1&r||i>=r)&&Object.keys(l.O).every((e=>l.O[e](t[o])))?t.splice(o--,1):(n=!1,r<i&&(i=r));if(n){e.splice(u--,1);var c=s();void 0!==c&&(a=c)}}return a}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[t,s,r]},l.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={476:0,575:0};l.O.j=a=>0===e[a];var a=(a,t)=>{var s,r,i=t[0],n=t[1],o=t[2],c=0;if(i.some((a=>0!==e[a]))){for(s in n)l.o(n,s)&&(l.m[s]=n[s]);if(o)var u=o(l)}for(a&&a(t);c<i.length;c++)r=i[c],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(u)},t=self.webpackChunksimplesalestax=self.webpackChunksimplesalestax||[];t.forEach(a.bind(null,0)),t.push=a.bind(null,t.push.bind(t))})();var s=l.O(void 0,[575],(()=>l(959)));s=l.O(s)})(); -
simple-sales-tax/trunk/changelog.txt
r3655406 r3669483 2 2 3 3 Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 4 5 - [8.4.16] - 2026-08-27 = 6 7 Added: 8 - [DEV-9165] - Improve exemption certificate fetching and selection UX (#460) 9 10 Fixed: 11 - Fix: Prevent page form submission during TIC selection (#459) 12 - [DEV-8729] - Fix: Capture and filter Stripe Express Checkout totals to ensure tax-inclusive accuracy during AJAX requests (#457) 13 - [DEV-9333] - Fix rate limit trigger (#456) 14 - [DEV-9333] - Fix: Optimize API calls by fixing guest package caching and address verification (#455) 15 4 16 5 17 - [8.4.15] - 2026-08-20 = -
simple-sales-tax/trunk/includes/abstracts/class-sst-abstract-cart.php
r3630538 r3669483 237 237 238 238 try { 239 $rate_limit->increment_count(); 240 239 241 $package['response'] = TaxCloud()->Lookup( $package['request'] ); 240 242 … … 246 248 247 249 $package['cart_id'] = key( $package['response'] ); 248 249 $rate_limit->increment_count();250 250 251 251 SST_Logger::debug( __( 'Tax lookup response:', 'simple-sales-tax' ), $package ); -
simple-sales-tax/trunk/includes/class-simplesalestax.php
r3655406 r3669483 21 21 * @var string 22 22 */ 23 public $version = '8.4.1 5';23 public $version = '8.4.16'; 24 24 25 25 /** -
simple-sales-tax/trunk/includes/class-sst-addresses.php
r3530282 r3669483 87 87 */ 88 88 public static function verify_address( $address ) { 89 if ( is_null( $address ) || ! is_a( $address, 'TaxCloud\Address' ) ) { 90 return $address; 91 } 92 93 // TaxCloud VerifyAddress requires a street address (Address1) and Zip5. 94 // If either is missing, skip the API call to avoid 400 Bad Request errors. 95 if ( empty( $address->getAddress1() ) || empty( $address->getZip5() ) ) { 96 return $address; 97 } 98 89 99 $addresses = get_transient( 'sst_verified_addresses' ); 90 100 … … 115 125 } 116 126 127 $rate_limit->increment_count(); 128 117 129 $request = new TaxCloud\Request\VerifyAddress( 118 130 SST_Settings::get( 'tc_id' ), … … 122 134 $address = TaxCloud()->VerifyAddress( $request ); 123 135 124 $rate_limit->increment_count();125 126 136 // Cache verified address. 127 137 $addresses[ $md5_hash ] = wp_json_encode( $address ); 128 138 129 // Cache validated addresses for 3days.139 // Cache validated addresses for 2 days. 130 140 set_transient( 'sst_verified_addresses', $addresses, 2 * DAY_IN_SECONDS ); 131 141 } catch ( Exception $ex ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch 132 142 SST_Logger::add( 'Failed to verify address: ' . $ex->getMessage() ); 133 // Leave address as-is. 143 // Cache unverified address as-is to avoid repeated failed API requests. 144 $addresses[ $md5_hash ] = wp_json_encode( $address ); 145 set_transient( 'sst_verified_addresses', $addresses, 2 * DAY_IN_SECONDS ); 134 146 } 135 147 -
simple-sales-tax/trunk/includes/class-sst-blocks-integration.php
r3630538 r3669483 108 108 $certificates = SST_Certificates::get_certificates_formatted(); 109 109 $options = array( 110 'new' => 'Add new certificate',110 'new' => __( 'Add a new certificate', 'simple-sales-tax' ), 111 111 ); 112 112 113 113 foreach ( $certificates as $cert ) { 114 $options[ $cert['CertificateID'] ] = $cert[' Description'];114 $options[ $cert['CertificateID'] ] = $cert['CheckoutDescription']; 115 115 } 116 116 -
simple-sales-tax/trunk/includes/class-sst-certificates.php
r3655406 r3669483 133 133 */ 134 134 public static function format_certificate( $certificate ) { 135 $detail = $certificate->getDetail(); 136 $formatted = array( 137 'CertificateID' => $certificate->getCertificateID(), 138 'PurchaserName' => $detail->getPurchaserFirstName() . ' ' . $detail->getPurchaserLastName(), 139 'CreatedDate' => gmdate( 'm/d/Y', strtotime( $detail->getCreatedDate() ) ), 135 $detail = $certificate->getDetail(); 136 $certificate_id = $certificate->getCertificateID(); 137 $created_date = $detail->getCreatedDate(); 138 $created_time = strtotime( $created_date ); 139 $exempt_states = self::get_exempt_state_abbreviations( $detail ); 140 $purchaser_name = trim( $detail->getPurchaserFirstName() . ' ' . $detail->getPurchaserLastName() ); 141 $short_id = self::get_short_certificate_id( $certificate_id ); 142 $formatted = array( 143 'CertificateID' => $certificate_id, 144 'CertificateLabel' => $short_id 145 ? sprintf( __( 'ID %s…', 'simple-sales-tax' ), $short_id ) 146 : __( 'ID unavailable', 'simple-sales-tax' ), 147 'PurchaserName' => $purchaser_name ?: __( 'Purchaser not specified', 'simple-sales-tax' ), 148 'CreatedDate' => self::format_certificate_datetime( $created_time ), 149 'CreatedTimestamp' => $created_time ?: 0, 150 'ExemptStates' => $exempt_states, 151 'ExemptStatesLabel' => $exempt_states 152 ? implode( ', ', $exempt_states ) 153 : __( 'States not specified', 'simple-sales-tax' ), 140 154 'PurchaserAddress' => $detail->getPurchaserAddress1(), 141 155 'PurchaserState' => sst_prettify( $detail->getPurchaserState() ), 142 'PurchaserExemptionReason' => sst_prettify( $detail->getPurchaserExemptionReason() ) ,156 'PurchaserExemptionReason' => sst_prettify( $detail->getPurchaserExemptionReason() ) ?: __( 'Exemption certificate', 'simple-sales-tax' ), 143 157 'SinglePurchase' => $detail->getSinglePurchase(), 144 158 'SinglePurchaserOrderNumber' => $detail->getSinglePurchaseOrderNumber(), 145 159 'TaxType' => sst_prettify( $detail->getPurchaserTaxID()->getTaxType() ), 146 160 'IDNumber' => $detail->getPurchaserTaxID()->getIDNumber(), 147 'PurchaserBusinessType' => sst_prettify( $detail->getPurchaserBusinessType() ) ,161 'PurchaserBusinessType' => sst_prettify( $detail->getPurchaserBusinessType() ) ?: __( 'Business type not specified', 'simple-sales-tax' ), 148 162 'Description' => self::get_certificate_description( 149 $detail 163 $detail, 164 $certificate_id 165 ), 166 'CheckoutDescription' => self::get_checkout_certificate_description( 167 $detail, 168 $certificate_id 150 169 ), 151 170 'SellerName' => SST_Settings::get( 'company_name' ), … … 158 177 * Get a text description of a certificate. 159 178 * 179 * @param TaxCloud\ExemptionCertificateDetail $detail Certificate details. 180 * @param string $certificate_id Certificate ID. 181 * 182 * @return string 183 */ 184 protected static function get_certificate_description( $detail, $certificate_id = '' ) { 185 $states = self::get_exempt_state_abbreviations( $detail ); 186 $state_label = $states ? implode( ', ', $states ) : __( 'States not specified', 'simple-sales-tax' ); 187 $reason = sst_prettify( $detail->getPurchaserExemptionReason() ) ?: __( 'Exemption certificate', 'simple-sales-tax' ); 188 $purchaser_name = trim( $detail->getPurchaserFirstName() . ' ' . $detail->getPurchaserLastName() ); 189 $created_time = strtotime( $detail->getCreatedDate() ); 190 $created_date = self::format_certificate_datetime( $created_time, true ); 191 $short_id = self::get_short_certificate_id( $certificate_id ); 192 $parts = array( 193 $state_label, 194 $reason, 195 ); 196 197 if ( $purchaser_name ) { 198 $parts[] = $purchaser_name; 199 } 200 201 /* translators: %s: certificate creation date. */ 202 $parts[] = sprintf( __( 'Added %s', 'simple-sales-tax' ), $created_date ); 203 204 if ( $short_id ) { 205 /* translators: %s: first characters of the certificate ID. */ 206 $parts[] = sprintf( __( 'ID %s…', 'simple-sales-tax' ), $short_id ); 207 } 208 209 return implode( ' • ', $parts ); 210 } 211 212 /** 213 * Get a concise certificate description for checkout selectors. 214 * 215 * @param TaxCloud\ExemptionCertificateDetail $detail Certificate details. 216 * @param string $certificate_id Certificate ID. 217 * 218 * @return string 219 */ 220 protected static function get_checkout_certificate_description( $detail, $certificate_id = '' ) { 221 $states = self::get_exempt_state_abbreviations( $detail ); 222 $state_label = $states ? implode( ', ', $states ) : __( 'States not specified', 'simple-sales-tax' ); 223 $created_time = strtotime( $detail->getCreatedDate() ); 224 $short_id = self::get_short_certificate_id( $certificate_id ); 225 $parts = array( 226 $state_label, 227 self::format_checkout_certificate_datetime( $created_time ), 228 ); 229 230 if ( $short_id ) { 231 /* translators: %s: first characters of the certificate ID. */ 232 $parts[] = sprintf( __( '#%s', 'simple-sales-tax' ), $short_id ); 233 } 234 235 return implode( ' · ', $parts ); 236 } 237 238 /** 239 * Format a compact certificate creation time for checkout selectors. 240 * 241 * The current year is omitted to keep frequently used options concise. 242 * 243 * @param int $timestamp Unix timestamp. 244 * 245 * @return string 246 */ 247 protected static function format_checkout_certificate_datetime( $timestamp ) { 248 if ( ! $timestamp ) { 249 return __( 'Date unavailable', 'simple-sales-tax' ); 250 } 251 252 $date_format = wp_date( 'Y', $timestamp ) === wp_date( 'Y' ) ? 'M j' : 'M j, Y'; 253 $time_format = get_option( 'time_format', 'g:i a' ); 254 255 return sprintf( 256 /* translators: 1: certificate creation date, 2: certificate creation time. */ 257 __( '%1$s, %2$s', 'simple-sales-tax' ), 258 wp_date( $date_format, $timestamp ), 259 wp_date( $time_format, $timestamp ) 260 ); 261 } 262 263 /** 264 * Format a certificate creation time in the WordPress site timezone. 265 * 266 * @param int $timestamp Unix timestamp. 267 * @param bool $compact Whether to use a compact date for option labels. 268 * 269 * @return string 270 */ 271 protected static function format_certificate_datetime( $timestamp, $compact = false ) { 272 if ( ! $timestamp ) { 273 return __( 'Date unavailable', 'simple-sales-tax' ); 274 } 275 276 $date_format = $compact ? 'M j, Y' : get_option( 'date_format', 'F j, Y' ); 277 $time_format = get_option( 'time_format', 'g:i a' ); 278 279 return sprintf( 280 /* translators: 1: certificate creation date, 2: certificate creation time. */ 281 __( '%1$s at %2$s', 'simple-sales-tax' ), 282 wp_date( $date_format, $timestamp ), 283 wp_date( $time_format, $timestamp ) 284 ); 285 } 286 287 /** 288 * Get the state abbreviations covered by a certificate. 289 * 160 290 * @param TaxCloud\ExemptionCertificateDetail $detail Certificate details. 161 291 * 292 * @return string[] 293 */ 294 protected static function get_exempt_state_abbreviations( $detail ) { 295 $states = array(); 296 297 foreach ( (array) $detail->getExemptStates() as $state ) { 298 if ( is_object( $state ) && method_exists( $state, 'getStateAbbr' ) ) { 299 $state_abbr = strtoupper( (string) $state->getStateAbbr() ); 300 if ( $state_abbr ) { 301 $states[] = $state_abbr; 302 } 303 } 304 } 305 306 return array_values( array_unique( $states ) ); 307 } 308 309 /** 310 * Get a compact, recognizable portion of a certificate ID. 311 * 312 * @param string $certificate_id Certificate ID. 313 * 162 314 * @return string 163 315 */ 164 protected static function get_certificate_description( $detail ) { 165 $state = current( $detail->GetExemptStates() ); 166 $state_abbr = $state->GetStateAbbr(); 167 $id_type = sst_prettify( $detail->getPurchaserTaxID()->getTaxType() ); 168 $id_number = $detail->getPurchaserTaxID()->getIDNumber(); 169 $date = gmdate( 'm/d/Y', strtotime( $detail->getCreatedDate() ) ); 170 171 return sprintf( 172 /* translators: 1 - state issued, 2 - tax id, 3 - date created */ 173 __( '%1$s - %2$s (created %3$s)', 'simple-sales-tax' ), 174 $state_abbr, 175 $id_number, 176 $date 177 ); 316 protected static function get_short_certificate_id( $certificate_id ) { 317 $certificate_id = trim( (string) $certificate_id ); 318 319 return $certificate_id ? substr( $certificate_id, 0, 8 ) : ''; 178 320 } 179 321 … … 203 345 } 204 346 205 // Sort by created date ascending.347 // Sort newest first so the most relevant certificate is easiest to find. 206 348 uasort( $certificates, function( $cert_a, $cert_b ) { 207 $date_a = isset( $cert_a['Created Date'] ) ? strtotime( $cert_a['CreatedDate'] ): 0;208 $date_b = isset( $cert_b['Created Date'] ) ? strtotime( $cert_b['CreatedDate'] ): 0;349 $date_a = isset( $cert_a['CreatedTimestamp'] ) ? (int) $cert_a['CreatedTimestamp'] : 0; 350 $date_b = isset( $cert_b['CreatedTimestamp'] ) ? (int) $cert_b['CreatedTimestamp'] : 0; 209 351 if ( $date_a === $date_b ) { 210 return 0;211 } 212 return $date_a < $date_b ? -1 :1;352 return strcmp( $cert_b['CertificateID'], $cert_a['CertificateID'] ); 353 } 354 return $date_a < $date_b ? 1 : -1; 213 355 } ); 214 356 -
simple-sales-tax/trunk/includes/frontend/class-sst-checkout.php
r3630538 r3669483 28 28 29 29 /** 30 * Tax-inclusive total captured during a Stripe Express Checkout calculation. 31 * 32 * @var float|null 33 */ 34 private $stripe_express_checkout_total = null; 35 36 /** 30 37 * Cart validation errors. 31 38 * … … 41 48 public function __construct() { 42 49 add_filter( 'woocommerce_calculated_total', array( $this, 'calculate_tax_totals' ), 1100, 2 ); 50 add_filter( 'wc_stripe_calculated_total', array( $this, 'filter_stripe_calculated_total' ), 10, 3 ); 43 51 add_filter( 'woocommerce_cart_hide_zero_taxes', array( $this, 'hide_zero_taxes' ) ); 44 52 add_action( 'woocommerce_checkout_order_created', array( $this, 'handle_legacy_checkout' ) ); … … 103 111 $this->cart = new SST_Cart_Proxy( $cart ); 104 112 113 $is_stripe_express_checkout_request = $this->is_stripe_express_checkout_request(); 114 105 115 $should_calculate = ( 106 116 is_cart() || … … 109 119 $this->is_store_api_request() || 110 120 $this->is_edit_subscription_request() || 111 $ this->is_stripe_express_checkout_request()121 $is_stripe_express_checkout_request 112 122 ); 113 123 … … 117 127 /** 118 128 * Skip tax calculation if real-time tax calculation is disabled. [Data Import Mode] 129 * 119 130 * @since 8.4.1 120 131 */ … … 124 135 } 125 136 137 $taxes = $this->cart->get_taxes(); 138 126 139 /** 127 140 * Woo won't include the taxes calculated by SST in the total so 128 141 * we add them in here. 129 142 */ 130 foreach ( $t his->cart->get_taxes()as $rate_id => $tax ) {131 if ( (int) SST_RATE_ID === $rate_id ) {132 $tax_total += $tax;143 foreach ( $taxes as $rate_id => $tax ) { 144 if ( (int) SST_RATE_ID === (int) $rate_id ) { 145 $tax_total += (float) $tax; 133 146 } 134 147 } 135 } 136 137 $this->cart->set_total_tax( WC_Tax::get_tax_total( $this->cart->get_taxes() ) ); 138 139 return $total + $tax_total; 148 149 $this->cart->set_total_tax( WC_Tax::get_tax_total( $taxes ) ); 150 } 151 152 $calculated_total = (float) $total + $tax_total; 153 154 if ( $is_stripe_express_checkout_request ) { 155 $this->stripe_express_checkout_total = $calculated_total; 156 } 157 158 return $calculated_total; 140 159 } 141 160 … … 171 190 */ 172 191 protected function is_stripe_express_checkout_request() { 173 global $wp_query; 174 return defined( 'WC_DOING_AJAX' ) && 'wc_stripe_get_shipping_options' === $wp_query->get( 'wc-ajax' ); 192 $express_checkout_actions = array( 193 'wc_stripe_get_cart_details', 194 'wc_stripe_get_shipping_options', 195 'wc_stripe_update_shipping_method', 196 'wc_stripe_add_to_cart', 197 'wc_stripe_get_selected_product_data', 198 ); 199 200 foreach ( $express_checkout_actions as $action ) { 201 if ( doing_action( 'wc_ajax_' . $action ) ) { 202 return true; 203 } 204 } 205 206 if ( ! defined( 'WC_DOING_AJAX' ) || ! WC_DOING_AJAX ) { 207 return false; 208 } 209 210 // WC AJAX endpoints are passed in the query string. Read it directly 211 // because the query variable is not reliable throughout every AJAX lifecycle. 212 // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Reading the WooCommerce routing argument only. 213 $ajax_action = isset( $_GET['wc-ajax'] ) 214 ? sanitize_key( wp_unslash( $_GET['wc-ajax'] ) ) 215 : ''; 216 // phpcs:enable WordPress.Security.NonceVerification.Recommended 217 218 if ( '' === $ajax_action ) { 219 global $wp_query; 220 221 if ( $wp_query instanceof WP_Query ) { 222 $ajax_action = sanitize_key( $wp_query->get( 'wc-ajax' ) ); 223 } 224 } 225 226 return in_array( $ajax_action, $express_checkout_actions, true ); 227 } 228 229 /** 230 * Supply Stripe with the tax-inclusive total captured during calculation. 231 * 232 * Stripe's response builder can observe cart totals after TaxCloud's tax state 233 * has been reset. Use the value captured earlier on this request, while the 234 * TaxCloud result and WooCommerce total were synchronized. 235 * 236 * @param float $calculated_total Stripe total in the currency's smallest unit. 237 * @param float $order_total WooCommerce cart total in store currency. 238 * @param WC_Cart $cart WooCommerce cart instance. 239 * 240 * @return float 241 */ 242 public function filter_stripe_calculated_total( $calculated_total, $order_total, $cart ) { 243 if ( 244 ! $cart || 245 ! class_exists( 'WC_Stripe_Helper' ) || 246 'yes' === SST_Settings::get( 'disable_integration', 'no' ) || 247 ! $this->is_stripe_express_checkout_request() || 248 null === $this->stripe_express_checkout_total 249 ) { 250 return $calculated_total; 251 } 252 253 $stripe_total = WC_Stripe_Helper::get_stripe_amount( 254 $this->stripe_express_checkout_total, 255 get_woocommerce_currency() 256 ); 257 258 return max( 0, $stripe_total ); 175 259 } 176 260 … … 956 1040 $certificates = SST_Certificates::get_certificates_formatted(); 957 1041 $options = array( 958 'none' => __( ' Select a exemption certificate', 'simple-sales-tax' ),959 'new' => __( 'Add new certificate', 'simple-sales-tax' ),1042 'none' => __( 'No certificate — do not apply a tax exemption', 'simple-sales-tax' ), 1043 'new' => __( 'Add a new certificate', 'simple-sales-tax' ), 960 1044 ); 961 1045 962 1046 foreach ( $certificates as $cert ) { 963 $options[ $cert['CertificateID'] ] = $cert[' Description'];1047 $options[ $cert['CertificateID'] ] = $cert['CheckoutDescription']; 964 1048 } 965 1049 … … 1117 1201 */ 1118 1202 protected function is_package_valid( $package ) { 1203 if ( ! is_array( $package ) ) { 1204 return false; 1205 } 1206 1119 1207 // Check if package has required keys 1120 1208 $required_keys = array( 'cart_items', 'customer_id' ); 1121 1209 1122 1210 foreach ( $required_keys as $key ) { 1123 1211 if ( ! isset( $package[ $key ] ) ) { … … 1131 1219 } 1132 1220 1133 // Check if customer_id is valid 1134 if ( empty( $package['customer_id'] ) ) {1221 // Check if customer_id is valid (0 is valid for guest users) 1222 if ( ! is_numeric( $package['customer_id'] ) && empty( $package['customer_id'] ) ) { 1135 1223 return false; 1136 1224 } -
simple-sales-tax/trunk/includes/frontend/views/html-checkout.php
r3326417 r3669483 42 42 'placeholder' => 'None', 43 43 'options' => $args['options'], 44 'label' => esc_html__( ' Exemption certificate', 'simple-sales-tax' ),44 'label' => esc_html__( 'Certificate to apply', 'simple-sales-tax' ), 45 45 'input_class' => array( 'sst-input' ), 46 46 ), … … 48 48 ); 49 49 ?> 50 <p class="sst-certificate-selection-help"> 51 <?php esc_html_e( 'The selected certificate will be applied to this order. Certificates are ordered newest first.', 'simple-sales-tax' ); ?> 52 </p> 50 53 51 54 <p id="exemption_certificates_link"> -
simple-sales-tax/trunk/includes/sst-functions.php
r3655406 r3669483 480 480 'ajaxurl' => admin_url( 'admin-ajax.php' ), 481 481 'strings' => array( 482 'delete_failed' => __( 'Failed to delete certificate', 'simple-sales-tax' ), 483 'add_failed' => __( 'Failed to add certificate', 'simple-sales-tax' ), 484 'refresh_failed' => __( 'Failed to refresh certificates', 'simple-sales-tax' ), 485 'fetch_failed' => __( 'Failed to load exemption certificates', 'simple-sales-tax' ), 486 'loading' => __( 'Loading exemption certificates...', 'simple-sales-tax' ), 487 'delete_certificate' => __( 482 'delete_failed' => __( 'Failed to delete certificate', 'simple-sales-tax' ), 483 'add_failed' => __( 'Failed to add certificate', 'simple-sales-tax' ), 484 'refresh_failed' => __( 'Failed to refresh certificates', 'simple-sales-tax' ), 485 'fetch_failed' => __( 'Failed to load exemption certificates', 'simple-sales-tax' ), 486 'loading' => __( 'Loading exemption certificates...', 'simple-sales-tax' ), 487 'showing_certificates' => __( 'Showing %1$d of %2$d certificates', 'simple-sales-tax' ), 488 'delete_certificate' => __( 488 489 'Are you sure you want to delete this certificate? This action is irreversible.', 489 490 'simple-sales-tax' -
simple-sales-tax/trunk/includes/v3/Exemptions.php
r3655406 r3669483 154 154 155 155 foreach ( $customer_ids as $cid ) { 156 $url = add_query_arg( array( 'customerId' => $cid ), $base_url ); 156 $url = add_query_arg( 157 array( 158 'customerId' => $cid, 159 'limit' => 100, 160 ), 161 $base_url 162 ); 157 163 $ch = curl_init(); 158 164 … … 202 208 // Fallback: Sequential execution 203 209 foreach ( $customer_ids as $cid ) { 204 $response = $this->get_certificates( array( 'customerId' => $cid ) ); 210 $response = $this->get_certificates( 211 array( 212 'customerId' => $cid, 213 'limit' => 100, 214 ) 215 ); 205 216 if ( ! is_wp_error( $response ) && isset( $response['items'] ) && is_array( $response['items'] ) ) { 206 217 foreach ( $response['items'] as $item ) { -
simple-sales-tax/trunk/includes/vendor/composer/installed.php
r3655406 r3669483 2 2 'root' => array( 3 3 'name' => 'simplesalestax/simplesalestax', 4 'pretty_version' => 'v8.4.1 5',5 'version' => '8.4.1 5.0',6 'reference' => ' 833f73d80826784c9ea9745fa51254184f443f54',4 'pretty_version' => 'v8.4.16', 5 'version' => '8.4.16.0', 6 'reference' => 'e0233cce5f619d0742cdccc240ad30eb4e54183b', 7 7 'type' => 'project', 8 8 'install_path' => __DIR__ . '/../../../', … … 21 21 ), 22 22 'simplesalestax/simplesalestax' => array( 23 'pretty_version' => 'v8.4.1 5',24 'version' => '8.4.1 5.0',25 'reference' => ' 833f73d80826784c9ea9745fa51254184f443f54',23 'pretty_version' => 'v8.4.16', 24 'version' => '8.4.16.0', 25 'reference' => 'e0233cce5f619d0742cdccc240ad30eb4e54183b', 26 26 'type' => 'project', 27 27 'install_path' => __DIR__ . '/../../../', -
simple-sales-tax/trunk/includes/views/html-certificate-list.php
r3655406 r3669483 14 14 $table_class = $args['table_class'] ?? 'shop_table'; 15 15 $show_inputs = $args['show_inputs'] ?? true; 16 $column_count = $show_inputs ? 5 : 4; 16 17 17 18 ?> … … 20 21 <tr> 21 22 <?php if ( $show_inputs ): ?> 22 <th><!-- Radio button column --></th> 23 <th class="sst-certificate-select-column"> 24 <span class="screen-reader-text"><?php esc_html_e( 'Select', 'simple-sales-tax' ); ?></span> 25 </th> 23 26 <?php endif; ?> 24 <th><?php esc_html_e( ' ID', 'simple-sales-tax' ); ?></th>27 <th><?php esc_html_e( 'Certificate', 'simple-sales-tax' ); ?></th> 25 28 <th><?php esc_html_e( 'Issued To', 'simple-sales-tax' ); ?></th> 26 <th><?php esc_html_e( ' Date', 'simple-sales-tax' ); ?></th>29 <th><?php esc_html_e( 'Added', 'simple-sales-tax' ); ?></th> 27 30 <th><?php esc_html_e( 'Actions', 'simple-sales-tax' ); ?></th> 28 31 </tr> … … 30 33 <tfoot> 31 34 <tr> 32 <td colspan="5"> 33 <a href="#" class="button sst-certificate-add"> 34 <?php esc_html_e( 'Add Certificate', 'simple-sales-tax' ); ?> 35 </a> 36 <a href="#" class="button sst-certificate-refresh" style="margin-left: 5px;"> 37 <?php esc_html_e( 'Refresh Certificates', 'simple-sales-tax' ); ?> 38 </a> 35 <td colspan="<?php echo esc_attr( $column_count ); ?>"> 36 <div class="sst-certificate-table-footer"> 37 <div class="sst-certificate-table-actions"> 38 <a href="#" class="button sst-certificate-add"> 39 <?php esc_html_e( 'Add Certificate', 'simple-sales-tax' ); ?> 40 </a> 41 <a href="#" class="button sst-certificate-refresh"> 42 <?php esc_html_e( 'Refresh Certificates', 'simple-sales-tax' ); ?> 43 </a> 44 </div> 45 <div class="sst-certificate-table-pagination" hidden> 46 <span class="sst-certificate-count" aria-live="polite"></span> 47 <button type="button" class="button-link sst-certificate-show-more"> 48 <?php esc_html_e( 'Show more', 'simple-sales-tax' ); ?> 49 </button> 50 </div> 51 </div> 39 52 </td> 40 53 </tr> … … 45 58 <script type="text/html" id="tmpl-sst-certificate-row-blank"> 46 59 <tr> 47 <td colspan=" 5">60 <td colspan="<?php echo esc_attr( $column_count ); ?>" class="sst-certificate-table-message"> 48 61 <span> 49 62 <?php … … 60 73 <script type="text/html" id="tmpl-sst-certificate-row-loading"> 61 74 <tr class="sst-certificate-row-loading"> 62 <td colspan=" 5" style="text-align: center; padding: 18px 12px; color: #666;">63 <span class="spinner is-active" style="float: none; margin: 0 8px 0 0; vertical-align: middle; visibility: visible;"></span>75 <td colspan="<?php echo esc_attr( $column_count ); ?>" class="sst-certificate-table-message"> 76 <span class="spinner is-active"></span> 64 77 <span> 65 78 <?php esc_html_e( 'Loading exemption certificates...', 'simple-sales-tax' ); ?> … … 72 85 <tr data-id="{{ data.CertificateID }}"> 73 86 <?php if ( $show_inputs ): ?> 74 <td >87 <td class="sst-certificate-select-column" data-title="<?php esc_attr_e( 'Select', 'simple-sales-tax' ); ?>"> 75 88 <input 76 89 type="radio" 77 90 name="certificate_id" 78 value="{{ data.CertificateID }}"> 91 value="{{ data.CertificateID }}" 92 aria-label="<?php esc_attr_e( 'Select certificate', 'simple-sales-tax' ); ?> {{ data.CertificateLabel }}"> 79 93 </td> 80 94 <?php endif; ?> 81 <td>{{ data.Index }}</td> 82 <td>{{ data.PurchaserName }}</td> 83 <td>{{ data.CreatedDate }}</td> 84 <td> 95 <td class="sst-certificate-summary" data-title="<?php esc_attr_e( 'Certificate', 'simple-sales-tax' ); ?>"> 96 <strong>{{ data.PurchaserExemptionReason }}</strong> 97 <span class="sst-certificate-meta"> 98 <?php esc_html_e( 'States:', 'simple-sales-tax' ); ?> {{ data.ExemptStatesLabel }} 99 </span> 100 <code>{{ data.CertificateLabel }}</code> 101 </td> 102 <td data-title="<?php esc_attr_e( 'Issued To', 'simple-sales-tax' ); ?>"> 103 <strong>{{ data.PurchaserName }}</strong> 104 <span class="sst-certificate-meta">{{ data.PurchaserBusinessType }}</span> 105 </td> 106 <td data-title="<?php esc_attr_e( 'Added', 'simple-sales-tax' ); ?>"> 107 <span>{{ data.CreatedDate }}</span> 108 </td> 109 <td data-title="<?php esc_attr_e( 'Actions', 'simple-sales-tax' ); ?>"> 85 110 <a href="#" class="sst-certificate-view" role="button"> 86 111 <?php esc_html_e( 'View', 'simple-sales-tax' ); ?> -
simple-sales-tax/trunk/includes/views/html-select-tic-modal.php
r2970922 r3669483 53 53 </header> 54 54 <article> 55 <form action="" method="post" >55 <form action="" method="post" onsubmit="return false;"> 56 56 <input name="search" class="<?php echo esc_attr( implode( ' ', $input_classes ) ); ?>" 57 57 placeholder="<?php esc_attr_e( 'Start typing to search', 'simple-sales-tax' ); ?>" type="text" -
simple-sales-tax/trunk/languages/simple-sales-tax.pot
r3655406 r3669483 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: simple-sales-tax 8.4.1 5\n"5 "Project-Id-Version: simple-sales-tax 8.4.16\n" 6 6 "Report-Msgid-Bugs-To: TaxCloud <EMAIL>\n" 7 7 "MIME-Version: 1.0\n" … … 9 9 "Content-Type: text/plain; charset=iso-8859-1\n" 10 10 "Plural-Forms: nplurals=2; plural=(n!=1);\n" 11 "POT-Creation-Date: 2026-08- 19T22:02:41.531Z\n"11 "POT-Creation-Date: 2026-08-27T20:30:05.011Z\n" 12 12 "PO-Revision-Date: 2026-MO-DA HO:MI+ZONE\n" 13 13 "Last-Translator: TaxCloud <EMAIL>\n" … … 76 76 #: includes/sst-functions.php:257 77 77 #: includes/views/html-select-tic-modal.php:35 78 #: includes/views/html-certificate-list.php:24 79 #: includes/views/html-certificate-list.php:87 78 80 msgid "Select" 79 81 msgstr "" … … 116 118 117 119 #: includes/sst-functions.php:486 118 #: includes/views/html-certificate-list.php: 65120 #: includes/views/html-certificate-list.php:78 119 121 msgid "Loading exemption certificates..." 120 122 msgstr "" 121 123 122 124 #: includes/sst-functions.php:487 125 msgid "Showing %1$d of %2$d certificates" 126 msgstr "" 127 128 #: includes/sst-functions.php:488 123 129 msgid "" 124 130 "Are you sure you want to delete this certificate? This action is " … … 126 132 msgstr "" 127 133 128 #: includes/sst-functions.php:57 2134 #: includes/sst-functions.php:573 129 135 msgid "Sales Tax" 130 136 msgstr "" … … 799 805 msgstr "" 800 806 801 # 1 - state issued, 2 - tax id, 3 - date created 802 #: includes/class-sst-certificates.php:173 803 msgid "%1$s - %2$s (created %3$s)" 807 #: includes/class-sst-certificates.php:145 808 #: includes/class-sst-certificates.php:206 809 msgid "ID %s?" 810 msgstr "" 811 812 #: includes/class-sst-certificates.php:146 813 msgid "ID unavailable" 814 msgstr "" 815 816 #: includes/class-sst-certificates.php:147 817 msgid "Purchaser not specified" 818 msgstr "" 819 820 #: includes/class-sst-certificates.php:153 821 #: includes/class-sst-certificates.php:186 822 #: includes/class-sst-certificates.php:222 823 msgid "States not specified" 824 msgstr "" 825 826 #: includes/class-sst-certificates.php:156 827 #: includes/class-sst-certificates.php:187 828 msgid "Exemption certificate" 829 msgstr "" 830 831 #: includes/class-sst-certificates.php:161 832 msgid "Business type not specified" 833 msgstr "" 834 835 #: includes/class-sst-certificates.php:202 836 msgid "Added %s" 837 msgstr "" 838 839 #: includes/class-sst-certificates.php:232 840 msgid "#%s" 841 msgstr "" 842 843 #: includes/class-sst-certificates.php:249 844 #: includes/class-sst-certificates.php:273 845 msgid "Date unavailable" 846 msgstr "" 847 848 # 1: certificate creation date, 2: certificate creation time. 849 #: includes/class-sst-certificates.php:257 850 msgid "%1$s, %2$s" 851 msgstr "" 852 853 # 1: certificate creation date, 2: certificate creation time. 854 #: includes/class-sst-certificates.php:281 855 msgid "%1$s at %2$s" 804 856 msgstr "" 805 857 806 858 # 1 - error message 807 #: includes/class-sst-certificates.php: 490859 #: includes/class-sst-certificates.php:632 808 860 msgid "Failed to add exemption certificate. Error was: %1$s" 809 861 msgstr "" 810 862 811 #: includes/class-sst-certificates.php: 584863 #: includes/class-sst-certificates.php:726 812 864 msgid "V3 exemption certificate payload:" 813 865 msgstr "" 814 866 815 867 # 1 - error message 816 #: includes/class-sst-certificates.php: 617868 #: includes/class-sst-certificates.php:759 817 869 msgid "Failed to add exemption certificate object. Error was: %1$s" 870 msgstr "" 871 872 #: includes/class-sst-blocks-integration.php:110 873 #: includes/frontend/class-sst-checkout.php:1043 874 msgid "Add a new certificate" 818 875 msgstr "" 819 876 … … 995 1052 996 1053 #: includes/views/html-meta-box.php:88 1054 #: includes/views/html-certificate-list.php:92 997 1055 msgid "Select certificate" 998 1056 msgstr "" … … 1006 1064 msgstr "" 1007 1065 1008 #: includes/views/html-certificate-list.php:24 1009 msgid "ID" 1010 msgstr "" 1011 1012 #: includes/views/html-certificate-list.php:25 1066 #: includes/views/html-certificate-list.php:27 1067 #: includes/views/html-certificate-list.php:95 1068 msgid "Certificate" 1069 msgstr "" 1070 1071 #: includes/views/html-certificate-list.php:28 1072 #: includes/views/html-certificate-list.php:102 1013 1073 msgid "Issued To" 1014 1074 msgstr "" 1015 1075 1016 #: includes/views/html-certificate-list.php:26 1017 msgid "Date" 1018 msgstr "" 1019 1020 #: includes/views/html-certificate-list.php:27 1076 #: includes/views/html-certificate-list.php:29 1077 #: includes/views/html-certificate-list.php:106 1078 msgid "Added" 1079 msgstr "" 1080 1081 #: includes/views/html-certificate-list.php:30 1082 #: includes/views/html-certificate-list.php:109 1021 1083 msgid "Actions" 1022 1084 msgstr "" 1023 1085 1024 #: includes/views/html-certificate-list.php:3 41086 #: includes/views/html-certificate-list.php:39 1025 1087 msgid "Add Certificate" 1026 1088 msgstr "" 1027 1089 1028 #: includes/views/html-certificate-list.php: 371090 #: includes/views/html-certificate-list.php:42 1029 1091 msgid "Refresh Certificates" 1030 1092 msgstr "" 1031 1093 1032 #: includes/views/html-certificate-list.php:50 1094 #: includes/views/html-certificate-list.php:48 1095 msgid "Show more" 1096 msgstr "" 1097 1098 #: includes/views/html-certificate-list.php:63 1033 1099 msgid "There are no certificates to display. Click 'Add Certificate' to add one." 1034 1100 msgstr "" 1035 1101 1036 #: includes/views/html-certificate-list.php:86 1102 #: includes/views/html-certificate-list.php:98 1103 msgid "States:" 1104 msgstr "" 1105 1106 #: includes/views/html-certificate-list.php:111 1037 1107 msgid "View" 1038 1108 msgstr "" 1039 1109 1040 #: includes/views/html-certificate-list.php: 901110 #: includes/views/html-certificate-list.php:115 1041 1111 msgid "Delete" 1042 1112 msgstr "" … … 1341 1411 msgstr "" 1342 1412 1343 #: includes/frontend/class-sst-checkout.php: 961413 #: includes/frontend/class-sst-checkout.php:104 1344 1414 msgid "" 1345 1415 "SST: Session not ready for tax calculation, skipping to prevent refresh " … … 1347 1417 msgstr "" 1348 1418 1349 #: includes/frontend/class-sst-checkout.php:1 221419 #: includes/frontend/class-sst-checkout.php:133 1350 1420 msgid "Data mover mode. Skipping tax calculation." 1351 1421 msgstr "" 1352 1422 1353 #: includes/frontend/class-sst-checkout.php: 2951423 #: includes/frontend/class-sst-checkout.php:379 1354 1424 msgid "Missing shipping packages" 1355 1425 msgstr "" 1356 1426 1357 #: includes/frontend/class-sst-checkout.php: 3171427 #: includes/frontend/class-sst-checkout.php:401 1358 1428 msgid "Missing virtual packages" 1359 1429 msgstr "" 1360 1430 1361 #: includes/frontend/class-sst-checkout.php: 4591431 #: includes/frontend/class-sst-checkout.php:543 1362 1432 msgid "Packages created successfully" 1363 1433 msgstr "" 1364 1434 1365 #: includes/frontend/class-sst-checkout.php: 4611435 #: includes/frontend/class-sst-checkout.php:545 1366 1436 msgid "No packages created." 1367 1437 msgstr "" 1368 1438 1369 1439 # 1 - error message 1370 #: includes/frontend/class-sst-checkout.php: 8251440 #: includes/frontend/class-sst-checkout.php:909 1371 1441 msgid "Failed to add exemption certificate during checkout. Error was: %1$s" 1372 1442 msgstr "" 1373 1443 1374 #: includes/frontend/class-sst-checkout.php:958 1375 msgid "Select a exemption certificate" 1376 msgstr "" 1377 1378 #: includes/frontend/class-sst-checkout.php:959 1379 msgid "Add new certificate" 1380 msgstr "" 1381 1382 #: includes/frontend/class-sst-checkout.php:1069 1444 #: includes/frontend/class-sst-checkout.php:1042 1445 msgid "No certificate ? do not apply a tax exemption" 1446 msgstr "" 1447 1448 #: includes/frontend/class-sst-checkout.php:1153 1383 1449 msgid "Required exemption certificate fields are missing" 1384 1450 msgstr "" 1385 1451 1386 #: includes/frontend/class-sst-checkout.php:1 2691452 #: includes/frontend/class-sst-checkout.php:1357 1387 1453 msgid "CO EXCISE TAX" 1388 1454 msgstr "" … … 1549 1615 msgstr "" 1550 1616 1551 #: includes/abstracts/class-sst-abstract-cart.php:24 31617 #: includes/abstracts/class-sst-abstract-cart.php:245 1552 1618 msgid "TaxCloud returned an invalid lookup response." 1553 1619 msgstr "" … … 1592 1658 1593 1659 #: includes/frontend/views/html-checkout.php:18 1594 #: assets/js/blocks/tax-exemption/block.js: 671660 #: assets/js/blocks/tax-exemption/block.js:83 1595 1661 msgid "Tax exemption" 1596 1662 msgstr "" … … 1607 1673 1608 1674 #: includes/frontend/views/html-checkout.php:44 1609 #: assets/js/blocks/tax-exemption/block.js:83 1610 msgid "Exemption certificate" 1611 msgstr "" 1612 1613 #: includes/frontend/views/html-checkout.php:56 1614 #: assets/js/blocks/tax-exemption/block.js:92 1675 #: assets/js/blocks/tax-exemption/block.js:99 1676 msgid "Certificate to apply" 1677 msgstr "" 1678 1679 #: includes/frontend/views/html-checkout.php:51 1680 msgid "" 1681 "The selected certificate will be applied to this order. Certificates are " 1682 "ordered newest first." 1683 msgstr "" 1684 1685 #: includes/frontend/views/html-checkout.php:59 1686 #: assets/js/blocks/tax-exemption/block.js:111 1615 1687 msgid "Manage exemption certificates ?" 1616 1688 msgstr "" 1617 1689 1618 #: includes/frontend/views/html-checkout.php:7 31619 #: assets/js/blocks/tax-exemption/block.js: 721690 #: includes/frontend/views/html-checkout.php:76 1691 #: assets/js/blocks/tax-exemption/block.js:88 1620 1692 msgid "Please log in or register to apply an exemption certificate." 1621 1693 msgstr "" … … 1681 1753 msgid "Select a reason" 1682 1754 msgstr "" 1755 1756 #: assets/js/blocks/tax-exemption/block.js:45 1757 msgid "No exemption certificate will be applied to this order." 1758 msgstr "" 1759 1760 #: assets/js/blocks/tax-exemption/block.js:51 1761 msgid "Complete the certificate details below to apply it to this order." 1762 msgstr "" 1763 1764 #: assets/js/blocks/tax-exemption/block.js:56 1765 msgid "" 1766 "This certificate will be applied to this order. Certificates are ordered " 1767 "newest first." 1768 msgstr "" -
simple-sales-tax/trunk/readme.txt
r3655406 r3669483 4 4 Requires at least: 4.5.0 5 5 Tested up to: 7.0 6 Stable tag: 8.4.1 56 Stable tag: 8.4.16 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later -
simple-sales-tax/trunk/simple-sales-tax.php
r3655406 r3669483 8 8 * Author URI: https://taxcloud.com 9 9 * GitHub Plugin URI: https://github.com/bporcelli/simplesalestax 10 * Version: 8.4.1 510 * Version: 8.4.16 11 11 * Text Domain: simple-sales-tax 12 12 * Domain Path: /languages/
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)