index.js
1 lines
| 1 | import*as t from"@wordpress/interactivity";var e,n,r={d:function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},o=(e={getElement:function(){return t.getElement},store:function(){return t.store},withSyncEvent:function(){return t.withSyncEvent}},n={},r.d(n,e),n);const i=t=>t&&t instanceof window.HTMLAnchorElement&&t.href&&(!t.target||"_self"===t.target)&&t.origin===window.location.origin,{state:a}=(0,o.store)("surecart/product-review",{state:{loading:!1,open:!1},actions:{navigate:(0,o.withSyncEvent)((function*(t){const{ref:e}=(0,o.getElement)(),n=e.closest("[data-wp-router-region]");if(i(e)&&(t=>!(0!==t.button||t.metaKey||t.ctrlKey||t.altKey||t.shiftKey||t.defaultPrevented))(t)&&n){t.preventDefault();const{actions:n}=yield import("@wordpress/interactivity-router");a.loading=!0,yield n.navigate(e.href),a.loading=!1}})),*prefetch(){const{ref:t}=(0,o.getElement)();if(i(t)){const{actions:e}=yield import("@wordpress/interactivity-router");yield e.prefetch(t.href)}}}}); |