�PNG  IHDR22?�� pHYs  �� OiCCPPhotoshop ICC profilexڝSgTS�=���BK���KoR RB���&*! J�!��Q�EEȠ�����Q, � ��!���������{�kּ������>���� �H3Q5� �B�������.@� $p�d!s�#�~<<+"��x� �M��0���B�\���t�8K�@z�B�@F���&S�`�cb�P-`'������{[�!�� e�Dh;��V�EX0fK�9�-0IWfH���� � 0Q��){`�##x��F�W<�+��*x��<�$9E�[-qWW.(�I+6aa�@.�y�2�4���������x����6��_-��"bb���ϫp@�t~��,/��;�m��%�h^ �u��f�@����W�p�~<�5�j>{�-�]c�K'Xt����o��(�h���w��?�G�%�fI�q^D$.Tʳ?�D��*�A��,���� �`6�B$��BB d�r`)��B(�Ͱ*`/�@4�Qh��p.�U�=p�a��(�� A�a!ڈb�X#����!�H�$ ɈQ"K�5H1R�T UH�=r9�\F��;�2����G1���Q=� �C��7�F� �dt1�����r�=�6��Ыhڏ>C�0��3�l0.��B�8, �c˱"� ���V����cϱw�E� 6wB aAHXLXN�H� $4� 7 �Q�'"��K�&���b21�XH,#��/{�C�7$�C2'��I��T��F�nR#�,��4H#���dk�9�, +ȅ����3��!�[ �b@q��S�(R�jJ��4�e�2AU��Rݨ�T5�ZB���R�Q��4u�9̓IK�����hh�i��t�ݕN��W���G���w ��Ljg(�gw��L�Ӌ�T071���oUX*�*|�� �J�&�*/T����ު U�U�T��^S}�FU3S� Ԗ�U��P�SSg�;���g�oT?�~Y��Y�L�OC�Q��_�� c�x,!k ��u�5�&���|v*�����=���9C3J3W�R�f?�q��tN �(���~���)�)�4L�1e\k����X�H�Q�G�6������E�Y��A�J'\'Gg����S�Sݧ �M=:��.�k���Dw�n��^��Lo��y���}/�T�m���G X� $� �<�5qo</���QC]�@C�a�a�ᄑ��<��F�F�i�\�$�m�mƣ&&!&KM�M�RM��)�;L;L���͢�֙5�=1�2��כ߷`ZxZ,����eI��Z�Yn�Z9Y�XUZ]�F���%ֻ�����N�N���gð�ɶ�����ۮ�m�}agbg�Ů��}�}��= ���Z~s�r:V:ޚΜ�?}����/gX���3��)�i�S��Ggg�s�󈋉K��.�>.���Ƚ�Jt�q]�z���������ۯ�6�i�ܟ�4�)�Y3s���C�Q��? ��0k߬~OCO�g��#/c/�W�װ��w��a�>�>r��>�<7�2�Y_�7��ȷ�O�o�_��C#�d�z����%g��A�[��z|!��?:�e����A���AA�������!h�쐭!��Α�i�P~���a�a��~ '���W�?�p�X�1�5w��Cs�D�D�Dޛg1O9�-J5*>�.j<�7�4�?�.fY��X�XIlK9.*�6nl������� �{�/�]py�����.,:�@L�N8��A*��%�w%� y��g"/�6ш�C\*N�H*Mz�쑼5y$�3�,幄'���L Lݛ:��v m2=:�1����qB�!M��g�g�fvˬe����n��/��k���Y- �B��TZ(�*�geWf�͉�9���+��̳�ې7�����ᒶ��KW-X潬j9�������(�x��oʿ�ܔ���Ĺd�f�f���-�[����n �ڴ �V����E�/��(ۻ��C���<��e����;?T�T�T�T6��ݵa��n��{��4���[���>ɾ�UUM�f�e�I���?�������m]�Nmq����#�׹���=TR��+�G�����w- 6 U����#pDy��� �� :�v�{���vg/jB��F�S��[b[�O�>����z�G��499�?r����C�d�&����ˮ/~�����јѡ�򗓿m|������������x31^�V���w�w��O�| (�h���SЧ��������c3-� cHRMz%������u0�`:�o�_�F5IDATx��ytUս�?�;���fN$$��@B�!�k��� -*�gE���j�O�kQ�ʠ`U�B_ �AÐ0%�Ȕ�@r3ޛ;߳��$�@��v����^�s����������$��ߢ !�W��5�̱'-٘������4�>�Rƫ$�G��0U�H}�_ _� #��k�MJ/=�9Du *ڲ�k�PQ;0��j|�*�$�^컂脛y���>�z×� B��� ��(�:$�ʔ_�6��C!B����MVx��a��ζyY����j��ƋY2�9�F�{r��r�딟F��Q��hY6��� x��[l��RC��������nt@��;P��3��� F�w��7��:�P���ɋ'���mj���Bƪ�$�Q�L��y��߷g��\���z����v5�p�v$�v櫻�`6~K �Y�X����,�:��"�o�e0II"(��,������l_�C���/4�+f�E�!q��:����u����c��樼.UE�@� �]K�W���$-�h]�JG���Dz)�`��.�A/ ���mᏣc�3jK� �!�>���$�Q�!�_�? \�C2(E �M$Z I{�U���s�ǣ���=��@Բe ޻��W�����@ �w����}�9v,)��.}*|"�s��di���,���G�]W�AC�������|<����[��ߕ������K�*�G nߴ!��‹��J�!��6(L�a)��Am��������;adf��:�xm��nh�;֦I��(���o�C~ډa?�=��s����h��E������xp����)���_���t��W�����´;8���`dz=(��@@�+,�;�`�fhl��XȌ�3,uI�~z(J����� �ZX�A����H'�À�㜦�82|��a�n�z2��I���� ���EY�h�ε<�0�q�{��C��v�˅��?"@��χ�x�WS+��N�~�KQ�J�8ل�� _.W��� !TU{�����,��"�� �;�������HI S� ��))�o�1�H�D� ���� (� ;����"Ҕ��,���� �F=���O��&�Ph>�`���y��߲ &S��P�<��'��1s�1cĂ�N����2)����@�u��tv��<�+�-&�����h��[!FSG���' � z z0��<����8d&�����E0�,��<��"!P�b4��� �{S�����X����.�囤���T��hEF��X�q0"-<����h���]�Py*����F⩍��@v�˂�Y08�� .q��a��s����(!<̫1�3�L�H��7sYW�`��qtu�\7��?�@�Y�� %Ka�x�GZ�*W�P��y�����N0r9��Z�c�%���q,��k�����!!,��>���IB��� �x1�Xu�Y���v-���ֺ��N������JP��a�2`�e5��w��u;�6�i���̃��(K���ťa��(l51��JL��O'%���]���ٖ뿉!��{*�p+f ���i8��D�ȑ���ܩ�M��V��ӟz��x�7Z�1i}�^͜���6e����x��)u�d�ˏ�V�eG�\�X1�����=n�U'�~Y����L�\,�(d!x ,�:�TW8� M`r���@��r+v�Q0��>^;˴�VbF��('����� �*O��i��j�Ӆ����^�S3&� ���{������.ی�� N;��NU%d0�Ce\r"�C�b��&t7N�7��� �ȪD�[%l�۪�$��'m?�A9tI�9>��NVL ��� 6v~M�����ъ�B���0����9$&=ώm��W�0���L���&��E���f�f��'+�9��hv��7,���M��6�D�&�^� �����8 D֮�����o��k^z��O��hP�8q�5d*��YVq3�{��������#LX4�?��jP=3�~�؅c�ݰ�̱�ұ��8̲��2�G�����j��έ�9��w7���U�X�w�85C��?!I&���o&����L���I#�^�eV�,�^t5�k� �xs˛\��U�8��."���{���ǵ�l4��ݼ�;��r"���G�/~���gJV�N糦��ZZ^k+NN�D��I$�=OE�z����|*�*{��%k���G��>�`9��b;�s���8,�qs��c��.b��q�%�>r��n�R�Ƨ�%�,�A��le#�8���}; 21�0�b�&�QX�f���q�00����$>�h�N�'�a3��A���/�r ��L5�8�GԲ'�����w;��c#�q1���h$*��V^�k��QĽ�b:i������� ����H F#�_���,��]g����Ը����`RUU���� ��"�qD���>-��ϤI�~��3�̴�����NZ[[555�eeek7�m����YF#[��Đ��R��i��L�H�r ��@��J-�Pŝ��_|�-��6y��ks�V�U~��6���w.����(��0A� 4��f��� /���C�xŊ�ٳ����z=6�����rg���mKo��o�/����a�g���?'9%9��P��斓��~���L{�� �H��{AW��B��$����v�1b�&Mb�ر��ر#�0`�`xMBp! )Z�Nmo�mZ�g�}�eذaWTVV ���'99��C5��&�&+5�bT>|8��PUUETT����&���t��~TE%��'������b�tEGG;RSS�S�N�v��ѯ��t����u1@�ޚ"f��͈���r'L�Ph��m��ƌ�74o��`�x�q�P���NRSS�X,�����l&&&��MFFA!-��`��ҷ�n��Yuu�����x<I�LB%����KԒ50�!�3�bz�����ʸKL���;---�l6[��`��������Ȏ;�����egg4��!D�T��jWujyZ��������K����%����p�^���X,6��sV=�ܖ����6�3�X ���4ҿ��A2�&����_k�;d�� �VfOIEND�B`�
Warning: session_start(): Session cannot be started after headers have already been sent in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 124

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 131

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 132

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 133

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 134

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 135

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 547

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 548

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 549

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 550

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 551
"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[5941],{38176:(e,t,o)=>{o.r(t),o.d(t,{default:()=>E});var s=o(27723),r=o(56427),a=o(86087),i=o(29491),n=o(47143),c=o(98846),l=o(40314),m=o(83306),d=o(95266),p=o(66087),h=o(39793);class u extends a.Component{constructor(e){super(e),this.state={disabled:!1}}renderInput=()=>{const{handleChange:e,name:t,inputText:o,inputType:s,options:a,value:i,component:n}=this.props,{disabled:c}=this.state;switch(s){case"checkboxGroup":return a.map(e=>e.options.length>0&&(0,h.jsxs)("div",{className:"woocommerce-setting__options-group","aria-labelledby":t+"-label",children:[e.label&&(0,h.jsx)("span",{className:"woocommerce-setting__options-group-label",children:e.label}),this.renderCheckboxOptions(e.options)]},e.key));case"checkbox":return this.renderCheckboxOptions(a);case"button":return(0,h.jsx)(r.Button,{variant:"secondary",onClick:this.handleInputCallback,disabled:c,children:o});case"component":const s=n;return(0,h.jsx)(s,{value:i,onChange:e,...this.props});case"select":return(0,h.jsx)(r.SelectControl,{__next40pxDefaultSize:!0,options:a,value:i,onChange:o=>e({target:{name:t,type:"select",value:o}})});case"radio":return(0,h.jsx)(r.RadioControl,{selected:i,options:a,onChange:o=>e({target:{name:t,type:"radio",value:o}})});default:const l=(0,p.uniqueId)(t);return(0,h.jsx)("input",{id:l,type:"text",name:t,onChange:e,value:i,placeholder:o,disabled:c})}};handleInputCallback=()=>{const{createNotice:e,callback:t}=this.props;if("function"==typeof t)return new Promise((o,s)=>{this.setState({disabled:!0}),t(o,s,e)}).then(()=>{this.setState({disabled:!1})}).catch(()=>{this.setState({disabled:!1})})};renderCheckboxOptions(e){const{handleChange:t,name:o,value:s}=this.props,{disabled:a}=this.state;return e.map(e=>(0,h.jsx)(r.CheckboxControl,{label:e.label,name:o,checked:s&&s.includes(e.value),onChange:s=>t({target:{checked:s,name:o,type:"checkbox",value:e.value}}),disabled:a},o+"-"+e.value))}render(){const{helpText:e,label:t,name:o}=this.props;return(0,h.jsxs)("div",{className:"woocommerce-setting",children:[(0,h.jsx)("div",{className:"woocommerce-setting__label",id:o+"-label",children:t}),(0,h.jsxs)("div",{className:"woocommerce-setting__input",children:[this.renderInput(),e&&(0,h.jsx)("span",{className:"woocommerce-setting__help",children:e})]})]})}}const _=(0,i.compose)((0,n.withDispatch)(e=>{const{createNotice:t}=e("core/notices");return{createNotice:t}}))(u);var g=o(76154),w=o.n(g);const v=(e,t,o)=>{const s={};if(o&&(s.skip_existing=!0),"all"!==t.label)if("custom"===t.label){const o=w()().diff(w()(t.date,e),"days",!0);s.days=Math.floor(o)}else s.days=parseInt(t.label,10);return s};var S=o(93832);const b=(0,i.compose)([(0,n.withSelect)(e=>{const{getFormSettings:t}=e(l.importStore),{period:o,skipPrevious:s}=t();return{selectedPeriod:o,skipChecked:s}}),(0,n.withDispatch)(e=>{const{updateImportation:t,setImportStarted:o}=e(l.importStore),{createNotice:s}=e("core/notices");return{createNotice:s,setImportStarted:o,updateImportation:t}})])(function({clearStatusAndTotalsCache:e,createNotice:t,dateFormat:o,importDate:i,onImportStarted:n,selectedPeriod:c,stopImport:l,skipChecked:d,status:p,setImportStarted:u,updateImportation:_}){const g=(e,o,s=!1)=>{_(e,s).then(e=>{"success"===e.status?t("success",e.message):(t("error",o),u(!1),l())}).catch(e=>{e&&e.message&&(t("error",e.message),u(!1),l())})},w=()=>{const e=(0,S.addQueryArgs)("/wc-analytics/reports/import",v(o,c,d)),t=(0,s.__)("There was a problem rebuilding your report data.","woocommerce");g(e,t,!0),n()},b=()=>{l();const e=(0,s.__)("There was a problem stopping your current import.","woocommerce");g("/wc-analytics/reports/import/cancel",e)},x=()=>{const e=(0,s.__)("There was a problem deleting your previous data.","woocommerce");g("/wc-analytics/reports/import/delete",e),(0,m.recordEvent)("analytics_import_delete_previous"),u(!1)},I=()=>{u(!1),e()};return(0,h.jsx)("div",{className:"woocommerce-settings__actions woocommerce-settings-historical-data__actions",children:(()=>{const e="ready"!==p;return["initializing","customers","orders","finalizing"].includes(p)?(0,h.jsxs)(a.Fragment,{children:[(0,h.jsx)(r.Button,{className:"woocommerce-settings-historical-data__action-button",isPrimary:!0,onClick:b,children:(0,s.__)("Stop Import","woocommerce")}),(0,h.jsxs)("div",{className:"woocommerce-setting__help woocommerce-settings-historical-data__action-help",children:[(0,s.__)("Imported data will not be lost if the import is stopped.","woocommerce"),(0,h.jsx)("br",{}),(0,s.__)("Navigating away from this page will not affect the import.","woocommerce")]})]}):["ready","nothing"].includes(p)?i?(0,h.jsxs)(a.Fragment,{children:[(0,h.jsx)(r.Button,{isPrimary:!0,onClick:w,disabled:e,children:(0,s.__)("Start","woocommerce")}),(0,h.jsx)(r.Button,{isSecondary:!0,onClick:x,children:(0,s.__)("Delete Previously Imported Data","woocommerce")})]}):(0,h.jsx)(a.Fragment,{children:(0,h.jsx)(r.Button,{isPrimary:!0,onClick:w,disabled:e,children:(0,s.__)("Start","woocommerce")})}):("error"===p&&t("error",(0,s.__)("Something went wrong with the importation process.","woocommerce")),(0,h.jsxs)(a.Fragment,{children:[(0,h.jsx)(r.Button,{isSecondary:!0,onClick:I,children:(0,s.__)("Re-import Data","woocommerce")}),(0,h.jsx)(r.Button,{isSecondary:!0,onClick:x,children:(0,s.__)("Delete Previously Imported Data","woocommerce")})]}))})()})});var x=o(77374);const I=(0,n.withDispatch)(e=>{const{setImportPeriod:t}=e(l.importStore);return{setImportPeriod:t}})(function({dateFormat:e,disabled:t,setImportPeriod:o,value:a}){const i=t=>{const s=!0;t.date&&t.date.isValid?o(t.date.format(e),s):o(t.text,s)},n=t=>t.isValid()&&a.date.length===e.length?t.isAfter(new Date,"day")?x.dateValidationMessages.future:null:x.dateValidationMessages.invalid;return(0,h.jsxs)("div",{className:"woocommerce-settings-historical-data__columns",children:[(0,h.jsx)("div",{className:"woocommerce-settings-historical-data__column",children:(0,h.jsx)(r.SelectControl,{__next40pxDefaultSize:!0,label:(0,s.__)("Import historical data","woocommerce"),value:a.label,disabled:t,onChange:e=>{o(e)},options:[{label:"All",value:"all"},{label:"Last 365 days",value:"365"},{label:"Last 90 days",value:"90"},{label:"Last 30 days",value:"30"},{label:"Last 7 days",value:"7"},{label:"Last 24 hours",value:"1"},{label:"Custom",value:"custom"}]})}),"custom"===a.label&&(()=>{const o=w()(a.date,e);return(0,h.jsxs)("div",{className:"woocommerce-settings-historical-data__column",children:[(0,h.jsx)("div",{className:"woocommerce-settings-historical-data__column-label",children:(0,s.__)("Beginning on","woocommerce")}),(0,h.jsx)(c.DatePicker,{date:o.isValid()?o.toDate():null,dateFormat:e,disabled:t,error:n(o),isInvalidDate:e=>w()(e).isAfter(new Date,"day"),onUpdate:i,text:a.date})]})})()]})}),f=function({label:e,progress:t,total:o}){const r=(0,s.sprintf)((0,s.__)("Imported %(label)s","woocommerce"),{label:e}),a=(0,p.isNil)(o)?null:(0,s.sprintf)((0,s.__)("%(progress)s of %(total)s","woocommerce"),{progress:t||0,total:o});return(0,h.jsxs)("div",{className:"woocommerce-settings-historical-data__progress",children:[(0,h.jsx)("span",{className:"woocommerce-settings-historical-data__progress-label",children:r}),a&&(0,h.jsx)("span",{className:"woocommerce-settings-historical-data__progress-label",children:a}),(0,h.jsx)("progress",{className:"woocommerce-settings-historical-data__progress-bar",max:o,value:t||0})]})};var C=o(52619);const y=function({importDate:e,status:t}){const o=(0,C.applyFilters)("woocommerce_admin_import_status",{nothing:(0,s.__)("Nothing To Import","woocommerce"),ready:(0,s.__)("Ready To Import","woocommerce"),initializing:[(0,s.__)("Initializing","woocommerce"),(0,h.jsx)(r.Spinner,{},"spinner")],customers:[(0,s.__)("Importing Customers","woocommerce"),(0,h.jsx)(r.Spinner,{},"spinner")],orders:[(0,s.__)("Importing Orders","woocommerce"),(0,h.jsx)(r.Spinner,{},"spinner")],finalizing:[(0,s.__)("Finalizing","woocommerce"),(0,h.jsx)(r.Spinner,{},"spinner")],finished:-1===e?(0,s.__)("All historical data imported","woocommerce"):(0,s.sprintf)((0,s.__)("Historical data from %s onward imported","woocommerce"),w()(e).format("YYYY-MM-DD"))});return(0,h.jsxs)("span",{className:"woocommerce-settings-historical-data__status",children:[(0,s.__)("Status:","woocommerce")+" ",o[t]]})},k=(0,n.withDispatch)(e=>{const{setSkipPrevious:t}=e(l.importStore);return{setSkipPrevious:t}})(function({checked:e,disabled:t,setSkipPrevious:o}){return(0,h.jsx)(r.CheckboxControl,{className:"woocommerce-settings-historical-data__skip-checkbox",checked:e,disabled:t,label:(0,s.__)("Skip previously imported customers and orders","woocommerce"),onChange:e=>{o(e)}})});var j=o(1455),N=o.n(j),T=o(15703);const P=function(){const[e,t]=(0,a.useState)(null),[o,i]=(0,a.useState)(!1),{createNotice:c}=(0,n.useDispatch)("core/notices"),l=(0,a.useCallback)(async()=>{try{const e=await N()({path:"/wc-analytics/imports/status"});t(e)}catch(e){}},[]);(0,a.useEffect)(()=>{l()},[l]);const m=e?.failed_count??0,d=e?.failed_overflow_count??0;if(0===m)return null;const p=(0,h.jsx)("a",{href:(0,T.getAdminLink)("admin.php?page=wc-status&tab=logs&source=wc-analytics-order-import"),"aria-label":(0,s.__)("View the order import log","woocommerce")}),u=d>0?(0,s.__)('More than %d orders failed to import. To recover all missed orders, run the import above with "Skip previously imported customers and orders" checked. View the log for details.',"woocommerce"):(0,s._n)("%d order failed to import. View the log for details.","%d orders failed to import. View the log for details.",m,"woocommerce"),_=(0,a.createInterpolateElement)((0,s.sprintf)(u,m),{link:p});return(0,h.jsxs)(r.Notice,{className:"woocommerce-settings-historical-data__failed-orders",status:"warning",isDismissible:!1,children:[(0,h.jsx)("p",{children:_}),(0,h.jsx)(r.Button,{variant:"secondary",isBusy:o,disabled:o,"aria-disabled":o,onClick:async()=>{i(!0);try{const e=await N()({path:"/wc-analytics/imports/retry-failed",method:"POST"});c("success",e.message),await l()}catch(e){c("error",function(e,t){return"object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message&&""!==e.message?e.message:t}(e,(0,s.__)("Failed to retry order imports.","woocommerce")))}finally{i(!1)}},children:(0,s.__)("Retry failed imports","woocommerce")})]})};class D extends a.Component{render(){const{customersProgress:e,customersTotal:t,dateFormat:o,importDate:r,inProgress:i,lastImportStartTimestamp:n,clearStatusAndTotalsCache:l,ordersProgress:m,ordersTotal:d,onImportStarted:p,period:u,stopImport:_,skipChecked:g,status:w}=this.props;return(0,h.jsxs)(a.Fragment,{children:[(0,h.jsx)(c.SectionHeader,{title:(0,s.__)("Import historical data","woocommerce")}),(0,h.jsx)("div",{className:"woocommerce-settings__wrapper",children:(0,h.jsx)("div",{className:"woocommerce-setting",children:(0,h.jsxs)("div",{className:"woocommerce-setting__input",children:[(0,h.jsx)("span",{className:"woocommerce-setting__help",children:(0,s.__)("This tool populates historical analytics data by processing customers and orders created prior to activating WooCommerce Admin.","woocommerce")}),"finished"!==w&&(0,h.jsxs)(a.Fragment,{children:[(0,h.jsx)(I,{dateFormat:o,disabled:i,value:u}),(0,h.jsx)(k,{disabled:i,checked:g}),(0,h.jsx)(f,{label:(0,s.__)("Registered Customers","woocommerce"),progress:e,total:t}),(0,h.jsx)(f,{label:(0,s.__)("Orders and Refunds","woocommerce"),progress:m,total:d})]}),(0,h.jsx)(y,{importDate:r,status:w}),(0,h.jsx)(P,{})]})})}),(0,h.jsx)(b,{clearStatusAndTotalsCache:l,dateFormat:o,importDate:r,lastImportStartTimestamp:n,onImportStarted:p,stopImport:_,status:w})]})}}const F=(0,n.withSelect)((e,t)=>{const{getImportError:o,getImportStatus:s,getImportTotals:r}=e(l.importStore),{activeImport:a,cacheNeedsClearing:i,dateFormat:n,inProgress:c,onImportStarted:m,onImportFinished:d,period:h,startStatusCheckInterval:u,skipChecked:_}=t,g=v(n,h,_),{customers:w,orders:S,lastImportStartTimestamp:b}=r(g),{customers:x,imported_from:I,is_importing:f,orders:C}=s(b),{imported:y,total:k}=x||{},{imported:j,total:N}=C||{},T=Boolean(o(b)||o(g));Boolean(!b&&!c&&!0===f)&&m();const P=Boolean(c&&!i&&!1===f&&(k>0||N>0)&&y===k&&j===N);let D={customersTotal:w,isError:T,ordersTotal:S};a&&(D={cacheNeedsClearing:i,customersProgress:y,customersTotal:(0,p.isNil)(k)?w:k,inProgress:c,isError:T,ordersProgress:j,ordersTotal:(0,p.isNil)(N)?S:N});const F=(({cacheNeedsClearing:e,customersProgress:t,customersTotal:o,isError:s,inProgress:r,ordersProgress:a,ordersTotal:i})=>s?"error":r?(0,p.isNil)(t)||(0,p.isNil)(a)||(0,p.isNil)(o)||(0,p.isNil)(i)||e?"initializing":t0||i>0?t===o&&a===i?"finished":"ready":"nothing")(D);return"initializing"===F&&u(),P&&d(),{...D,importDate:I,status:F}})(D);class A extends a.Component{constructor(){super(...arguments),this.dateFormat=(0,s.__)("MM/DD/YYYY","woocommerce"),this.intervalId=-1,this.lastImportStopTimestamp=0,this.cacheNeedsClearing=!0,this.onImportFinished=this.onImportFinished.bind(this),this.onImportStarted=this.onImportStarted.bind(this),this.clearStatusAndTotalsCache=this.clearStatusAndTotalsCache.bind(this),this.stopImport=this.stopImport.bind(this),this.startStatusCheckInterval=this.startStatusCheckInterval.bind(this),this.cancelStatusCheckInterval=this.cancelStatusCheckInterval.bind(this)}startStatusCheckInterval(){this.intervalId<0&&(this.cacheNeedsClearing=!0,this.intervalId=setInterval(()=>{this.clearCache("getImportStatus")},3*l.SECOND))}cancelStatusCheckInterval(){clearInterval(this.intervalId),this.intervalId=-1}clearCache(e,t){const{invalidateResolution:o,lastImportStartTimestamp:s}=this.props;o(e,["getImportStatus"===e?s:t]).then(()=>{this.cacheNeedsClearing=!1})}stopImport(){this.cancelStatusCheckInterval(),this.lastImportStopTimestamp=Date.now()}onImportFinished(){const{debouncedSpeak:e}=this.props;this.cacheNeedsClearing||(e("Import complete"),this.stopImport())}onImportStarted(){const{notes:e,setImportStarted:t,updateNote:o}=this.props,s=e.find(e=>"wc-admin-historical-data"===e.name);s&&o(s.id,{status:"actioned"}),t(!0)}clearStatusAndTotalsCache(){const{selectedPeriod:e,skipChecked:t}=this.props,o=v(this.dateFormat,e,t);this.clearCache("getImportTotals",o),this.clearCache("getImportStatus")}isImportationInProgress(){const{lastImportStartTimestamp:e}=this.props;return void 0!==e&&void 0===this.lastImportStopTimestamp||e>this.lastImportStopTimestamp}render(){const{activeImport:e,createNotice:t,lastImportStartTimestamp:o,selectedPeriod:s,skipChecked:r}=this.props;return(0,h.jsx)(F,{activeImport:e,cacheNeedsClearing:this.cacheNeedsClearing,createNotice:t,dateFormat:this.dateFormat,inProgress:this.isImportationInProgress(),onImportFinished:this.onImportFinished,onImportStarted:this.onImportStarted,lastImportStartTimestamp:o,clearStatusAndTotalsCache:this.clearStatusAndTotalsCache,period:s,skipChecked:r,startStatusCheckInterval:this.startStatusCheckInterval,stopImport:this.stopImport})}}const B=(0,i.compose)([(0,n.withSelect)(e=>{const{getNotes:t}=e(l.notesStore),{getImportStarted:o,getFormSettings:s}=e(l.importStore),r=t({page:1,per_page:l.QUERY_DEFAULTS.pageSize,type:"update",status:"unactioned"}),{activeImport:a,lastImportStartTimestamp:i}=o(),{period:n,skipPrevious:c}=s();return{activeImport:a,lastImportStartTimestamp:i,notes:r,selectedPeriod:n,skipChecked:c}}),(0,n.withDispatch)(e=>{const{updateNote:t}=e(l.notesStore),{invalidateResolution:o,setImportStarted:s}=e(l.importStore);return{invalidateResolution:o,setImportStarted:s,updateNote:t}}),r.withSpokenMessages])(A),z=({isOpen:e,onClose:t,onConfirm:o})=>e?(0,h.jsx)(r.Modal,{title:(0,s.__)("Are you sure?","woocommerce"),onRequestClose:t,className:"woocommerce-analytics-import-mode-confirmation-modal",size:"medium",children:(0,h.jsxs)(r.Flex,{direction:"column",gap:6,children:[(0,h.jsx)(r.__experimentalText,{children:(0,s.__)("Immediate updates to Analytics can impact your performance as it may slow busy stores.","woocommerce")}),(0,h.jsxs)(r.Flex,{direction:"row",className:"woocommerce-analytics-import-mode-confirmation-modal__buttons",justify:"flex-end",children:[(0,h.jsx)(r.Button,{variant:"tertiary",onClick:t,"aria-label":(0,s.__)("Cancel import mode change","woocommerce"),children:(0,s.__)("Cancel","woocommerce")}),(0,h.jsx)(r.Button,{variant:"primary",onClick:o,"aria-label":(0,s.__)("Confirm switching to immediate import mode","woocommerce"),children:(0,s.__)("Confirm","woocommerce")})]})]})}):null,E=(0,i.compose)((0,n.withDispatch)(e=>{const{createNotice:t}=e("core/notices");return{createNotice:t}}))(({createNotice:e,query:t})=>{const{settingsError:o,isRequesting:i,isDirty:n,persistSettings:p,updateAndPersistSettings:u,updateSettings:g,wcAdminSettings:w}=(0,l.useSettings)("wc_admin",["wcAdminSettings"]),v=(0,a.useRef)(!1),[S,b]=(0,a.useState)(!1),[x,I]=(0,a.useState)(null);(0,a.useEffect)(()=>{function e(e){if(n)return e.returnValue=(0,s.__)("You have unsaved changes. If you proceed, they will be lost.","woocommerce"),e.returnValue}return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[n]),(0,a.useEffect)(()=>{i?v.current=!0:!i&&v.current&&(o?e("error",(0,s.__)("There was an error saving your settings. Please try again.","woocommerce")):e("success",(0,s.__)("Your settings have been successfully saved.","woocommerce")),v.current=!1)},[i,o,e]);const f=e=>{if(S)return;const{checked:t,name:o,type:s,value:r}=e.target;if(o===d.zm&&d.$W[d.zm]&&"yes"===w[o]&&"no"===r)return I({name:o,value:r}),void b(!0);const a={...w};a[o]="checkbox"===s?t?[...a[o],r]:a[o].filter(e=>e!==r):r,g("wcAdminSettings",a)},C=e=>e!==d.zm||w[e]?w[e]:"no";return(0,h.jsxs)(a.Fragment,{children:[(0,h.jsx)(c.SectionHeader,{title:(0,s.__)("Analytics settings","woocommerce")}),(0,h.jsxs)("div",{className:"woocommerce-settings__wrapper",children:[Object.keys(d.$W).map(e=>(0,h.jsx)(_,{handleChange:f,value:C(e),name:e,...d.$W[e]},e)),(0,h.jsxs)("div",{className:"woocommerce-settings__actions",children:[(0,h.jsx)(r.Button,{variant:"secondary",onClick:()=>{if(window.confirm((0,s.__)("Are you sure you want to reset all settings to default values?","woocommerce"))){const e=Object.keys(d.$W).reduce((e,t)=>(e[t]=d.$W[t].defaultValue,e),{});u("wcAdminSettings",e),(0,m.recordEvent)("analytics_settings_reset_defaults")}},children:(0,s.__)("Reset defaults","woocommerce")}),(0,h.jsx)(r.Button,{variant:"primary",isBusy:i,onClick:()=>{p(),(0,m.recordEvent)("analytics_settings_save",w),t.period=void 0,t.compare=void 0,t.before=void 0,t.after=void 0,t.interval=void 0,t.type=void 0,window.wpNavMenuUrlUpdate(t)},children:(0,s.__)("Save settings","woocommerce")})]})]}),"true"===t.import?(0,h.jsx)(c.ScrollTo,{offset:"-56",children:(0,h.jsx)(B,{createNotice:e})}):(0,h.jsx)(B,{createNotice:e}),d.$W[d.zm]&&(0,h.jsx)(z,{isOpen:S,onClose:()=>{b(!1),I(null)},onConfirm:()=>{if(x){const e={...w};e[x.name]=x.value,g("wcAdminSettings",e)}b(!1),I(null)}})]})})}}]);