@leancodepl/force-update 9.7.2 → 9.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ (function(T,q){typeof exports=="object"&&typeof module<"u"?q(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],q):(T=typeof globalThis<"u"?globalThis:T||self,q(T["@leancodepl/force-update"]={},T.react))})(this,(function(T,q){"use strict";var M=function(e,n){return M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])},M(e,n)};function k(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");M(e,n);function t(){this.constructor=e}e.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}var C=function(){return C=Object.assign||function(n){for(var t,r=1,o=arguments.length;r<o;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},C.apply(this,arguments)};function Ne(e,n,t,r){function o(i){return i instanceof t?i:new t(function(u){u(i)})}return new(t||(t=Promise))(function(i,u){function s(f){try{c(r.next(f))}catch(h){u(h)}}function a(f){try{c(r.throw(f))}catch(h){u(h)}}function c(f){f.done?i(f.value):o(f.value).then(s,a)}c((r=r.apply(e,n||[])).next())})}function ne(e,n){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(c){return function(f){return a([c,f])}}function a(c){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(t=0)),t;)try{if(r=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,o=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1],i=c;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(c);break}i[2]&&t.ops.pop(),t.trys.pop();continue}c=n.call(e,t)}catch(f){c=[6,f],o=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function _(e){var n=typeof Symbol=="function"&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function H(e,n){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var r=t.call(e),o,i=[],u;try{for(;(n===void 0||n-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(s){u={error:s}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(u)throw u.error}}return i}function V(e,n,t){if(t||arguments.length===2)for(var r=0,o=n.length,i;r<o;r++)(i||!(r in n))&&(i||(i=Array.prototype.slice.call(n,0,r)),i[r]=n[r]);return e.concat(i||Array.prototype.slice.call(n))}function D(e){return this instanceof D?(this.v=e,this):new D(e)}function Ge(e,n,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(e,n||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",u),o[Symbol.asyncIterator]=function(){return this},o;function u(l){return function(x){return Promise.resolve(x).then(l,h)}}function s(l,x){r[l]&&(o[l]=function(d){return new Promise(function(R,P){i.push([l,d,R,P])>1||a(l,d)})},x&&(o[l]=x(o[l])))}function a(l,x){try{c(r[l](x))}catch(d){p(i[0][3],d)}}function c(l){l.value instanceof D?Promise.resolve(l.value.v).then(f,h):p(i[0][2],l)}function f(l){a("next",l)}function h(l){a("throw",l)}function p(l,x){l(x),i.shift(),i.length&&a(i[0][0],i[0][1])}}function Me(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e[Symbol.asyncIterator],t;return n?n.call(e):(e=typeof _=="function"?_(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(i){t[i]=e[i]&&function(u){return new Promise(function(s,a){u=e[i](u),o(s,a,u.done,u.value)})}}function o(i,u,s,a){Promise.resolve(a).then(function(c){i({value:c,done:s})},u)}}typeof SuppressedError=="function"&&SuppressedError;function b(e){return typeof e=="function"}function X(e){var n=function(r){Error.call(r),r.stack=new Error().stack},t=e(n);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Y=X(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
2
+ `+t.map(function(r,o){return o+1+") "+r.toString()}).join(`
3
+ `):"",this.name="UnsubscriptionError",this.errors=t}});function J(e,n){if(e){var t=e.indexOf(n);0<=t&&e.splice(t,1)}}var B=(function(){function e(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var n,t,r,o,i;if(!this.closed){this.closed=!0;var u=this._parentage;if(u)if(this._parentage=null,Array.isArray(u))try{for(var s=_(u),a=s.next();!a.done;a=s.next()){var c=a.value;c.remove(this)}}catch(d){n={error:d}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(n)throw n.error}}else u.remove(this);var f=this.initialTeardown;if(b(f))try{f()}catch(d){i=d instanceof Y?d.errors:[d]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var p=_(h),l=p.next();!l.done;l=p.next()){var x=l.value;try{oe(x)}catch(d){i=i??[],d instanceof Y?i=V(V([],H(i)),H(d.errors)):i.push(d)}}}catch(d){r={error:d}}finally{try{l&&!l.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}}if(i)throw new Y(i)}},e.prototype.add=function(n){var t;if(n&&n!==this)if(this.closed)oe(n);else{if(n instanceof e){if(n.closed||n._hasParent(this))return;n._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(n)}},e.prototype._hasParent=function(n){var t=this._parentage;return t===n||Array.isArray(t)&&t.includes(n)},e.prototype._addParent=function(n){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(n),t):t?[t,n]:n},e.prototype._removeParent=function(n){var t=this._parentage;t===n?this._parentage=null:Array.isArray(t)&&J(t,n)},e.prototype.remove=function(n){var t=this._finalizers;t&&J(t,n),n instanceof e&&n._removeParent(this)},e.EMPTY=(function(){var n=new e;return n.closed=!0,n})(),e})();B.EMPTY;function re(e){return e instanceof B||e&&"closed"in e&&b(e.remove)&&b(e.add)&&b(e.unsubscribe)}function oe(e){b(e)?e():e.unsubscribe()}var Xe={Promise:void 0},Ye={setTimeout:function(e,n){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];return setTimeout.apply(void 0,V([e,n],H(t)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function ie(e){Ye.setTimeout(function(){throw e})}function ue(){}function Je(e){e()}var $=(function(e){k(n,e);function n(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,re(t)&&t.add(r)):r.destination=We,r}return n.create=function(t,r,o){return new z(t,r,o)},n.prototype.next=function(t){this.isStopped||this._next(t)},n.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},n.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},n.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},n.prototype._next=function(t){this.destination.next(t)},n.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},n.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},n})(B),$e=(function(){function e(n){this.partialObserver=n}return e.prototype.next=function(n){var t=this.partialObserver;if(t.next)try{t.next(n)}catch(r){N(r)}},e.prototype.error=function(n){var t=this.partialObserver;if(t.error)try{t.error(n)}catch(r){N(r)}else N(n)},e.prototype.complete=function(){var n=this.partialObserver;if(n.complete)try{n.complete()}catch(t){N(t)}},e})(),z=(function(e){k(n,e);function n(t,r,o){var i=e.call(this)||this,u;return b(t)||!t?u={next:t??void 0,error:r??void 0,complete:o??void 0}:u=t,i.destination=new $e(u),i}return n})($);function N(e){ie(e)}function ze(e){throw e}var We={closed:!0,next:ue,error:ze,complete:ue},W=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ae(e){return e}function Ke(e){return e.length===0?ae:e.length===1?e[0]:function(t){return e.reduce(function(r,o){return o(r)},t)}}var S=(function(){function e(n){n&&(this._subscribe=n)}return e.prototype.lift=function(n){var t=new e;return t.source=this,t.operator=n,t},e.prototype.subscribe=function(n,t,r){var o=this,i=Ze(n)?n:new z(n,t,r);return Je(function(){var u=o,s=u.operator,a=u.source;i.add(s?s.call(i,a):a?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(n){try{return this._subscribe(n)}catch(t){n.error(t)}},e.prototype.forEach=function(n,t){var r=this;return t=ce(t),new t(function(o,i){var u=new z({next:function(s){try{n(s)}catch(a){i(a),u.unsubscribe()}},error:i,complete:o});r.subscribe(u)})},e.prototype._subscribe=function(n){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(n)},e.prototype[W]=function(){return this},e.prototype.pipe=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return Ke(n)(this)},e.prototype.toPromise=function(n){var t=this;return n=ce(n),new n(function(r,o){var i;t.subscribe(function(u){return i=u},function(u){return o(u)},function(){return r(i)})})},e.create=function(n){return new e(n)},e})();function ce(e){var n;return(n=e??Xe.Promise)!==null&&n!==void 0?n:Promise}function Qe(e){return e&&b(e.next)&&b(e.error)&&b(e.complete)}function Ze(e){return e&&e instanceof $||Qe(e)&&re(e)}function et(e){return b(e?.lift)}function A(e){return function(n){if(et(n))return n.lift(function(t){try{return e(t,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function E(e,n,t,r,o){return new tt(e,n,t,r,o)}var tt=(function(e){k(n,e);function n(t,r,o,i,u,s){var a=e.call(this,t)||this;return a.onFinalize=u,a.shouldUnsubscribe=s,a._next=r?function(c){try{r(c)}catch(f){t.error(f)}}:e.prototype._next,a._error=i?function(c){try{i(c)}catch(f){t.error(f)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=o?function(){try{o()}catch(c){t.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,a}return n.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},n})($),nt={now:function(){return Date.now()}},rt=(function(e){k(n,e);function n(t,r){return e.call(this)||this}return n.prototype.schedule=function(t,r){return this},n})(B),se={setInterval:function(e,n){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];return setInterval.apply(void 0,V([e,n],H(t)))},clearInterval:function(e){return clearInterval(e)},delegate:void 0},ot=(function(e){k(n,e);function n(t,r){var o=e.call(this,t,r)||this;return o.scheduler=t,o.work=r,o.pending=!1,o}return n.prototype.schedule=function(t,r){var o;if(r===void 0&&(r=0),this.closed)return this;this.state=t;var i=this.id,u=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(u,i,r)),this.pending=!0,this.delay=r,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(u,this.id,r),this},n.prototype.requestAsyncId=function(t,r,o){return o===void 0&&(o=0),se.setInterval(t.flush.bind(t,this),o)},n.prototype.recycleAsyncId=function(t,r,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return r;r!=null&&se.clearInterval(r)},n.prototype.execute=function(t,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(t,r);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},n.prototype._execute=function(t,r){var o=!1,i;try{this.work(t)}catch(u){o=!0,i=u||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),i},n.prototype.unsubscribe=function(){if(!this.closed){var t=this,r=t.id,o=t.scheduler,i=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,J(i,this),r!=null&&(this.id=this.recycleAsyncId(o,r,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},n})(rt),fe=(function(){function e(n,t){t===void 0&&(t=e.now),this.schedulerActionCtor=n,this.now=t}return e.prototype.schedule=function(n,t,r){return t===void 0&&(t=0),new this.schedulerActionCtor(this,n).schedule(r,t)},e.now=nt.now,e})(),it=(function(e){k(n,e);function n(t,r){r===void 0&&(r=fe.now);var o=e.call(this,t,r)||this;return o.actions=[],o._active=!1,o}return n.prototype.flush=function(t){var r=this.actions;if(this._active){r.push(t);return}var o;this._active=!0;do if(o=t.execute(t.state,t.delay))break;while(t=r.shift());if(this._active=!1,o){for(;t=r.shift();)t.unsubscribe();throw o}},n})(fe),le=new it(ot),ut=le,at=new S(function(e){return e.complete()});function he(e){return e&&b(e.schedule)}function ct(e){return e[e.length-1]}function st(e){return he(ct(e))?e.pop():void 0}var de=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function ve(e){return b(e?.then)}function pe(e){return b(e[W])}function ye(e){return Symbol.asyncIterator&&b(e?.[Symbol.asyncIterator])}function me(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ft(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var we=ft();function be(e){return b(e?.[we])}function xe(e){return Ge(this,arguments,function(){var t,r,o,i;return ne(this,function(u){switch(u.label){case 0:t=e.getReader(),u.label=1;case 1:u.trys.push([1,,9,10]),u.label=2;case 2:return[4,D(t.read())];case 3:return r=u.sent(),o=r.value,i=r.done,i?[4,D(void 0)]:[3,5];case 4:return[2,u.sent()];case 5:return[4,D(o)];case 6:return[4,u.sent()];case 7:return u.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function ge(e){return b(e?.getReader)}function F(e){if(e instanceof S)return e;if(e!=null){if(pe(e))return lt(e);if(de(e))return ht(e);if(ve(e))return dt(e);if(ye(e))return Se(e);if(be(e))return vt(e);if(ge(e))return pt(e)}throw me(e)}function lt(e){return new S(function(n){var t=e[W]();if(b(t.subscribe))return t.subscribe(n);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ht(e){return new S(function(n){for(var t=0;t<e.length&&!n.closed;t++)n.next(e[t]);n.complete()})}function dt(e){return new S(function(n){e.then(function(t){n.closed||(n.next(t),n.complete())},function(t){return n.error(t)}).then(null,ie)})}function vt(e){return new S(function(n){var t,r;try{for(var o=_(e),i=o.next();!i.done;i=o.next()){var u=i.value;if(n.next(u),n.closed)return}}catch(s){t={error:s}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}n.complete()})}function Se(e){return new S(function(n){yt(e,n).catch(function(t){return n.error(t)})})}function pt(e){return Se(xe(e))}function yt(e,n){var t,r,o,i;return Ne(this,void 0,void 0,function(){var u,s;return ne(this,function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),t=Me(e),a.label=1;case 1:return[4,t.next()];case 2:if(r=a.sent(),!!r.done)return[3,4];if(u=r.value,n.next(u),n.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=a.sent(),o={error:s},[3,11];case 6:return a.trys.push([6,,9,10]),r&&!r.done&&(i=t.return)?[4,i.call(t)]:[3,8];case 7:a.sent(),a.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return n.complete(),[2]}})})}function O(e,n,t,r,o){r===void 0&&(r=0),o===void 0&&(o=!1);var i=n.schedule(function(){t(),o?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(i),!o)return i}function Ae(e,n){return n===void 0&&(n=0),A(function(t,r){t.subscribe(E(r,function(o){return O(r,e,function(){return r.next(o)},n)},function(){return O(r,e,function(){return r.complete()},n)},function(o){return O(r,e,function(){return r.error(o)},n)}))})}function Ee(e,n){return n===void 0&&(n=0),A(function(t,r){r.add(e.schedule(function(){return t.subscribe(r)},n))})}function mt(e,n){return F(e).pipe(Ee(n),Ae(n))}function wt(e,n){return F(e).pipe(Ee(n),Ae(n))}function bt(e,n){return new S(function(t){var r=0;return n.schedule(function(){r===e.length?t.complete():(t.next(e[r++]),t.closed||this.schedule())})})}function xt(e,n){return new S(function(t){var r;return O(t,n,function(){r=e[we](),O(t,n,function(){var o,i,u;try{o=r.next(),i=o.value,u=o.done}catch(s){t.error(s);return}u?t.complete():t.next(i)},0,!0)}),function(){return b(r?.return)&&r.return()}})}function Ie(e,n){if(!e)throw new Error("Iterable cannot be null");return new S(function(t){O(t,n,function(){var r=e[Symbol.asyncIterator]();O(t,n,function(){r.next().then(function(o){o.done?t.complete():t.next(o.value)})},0,!0)})})}function gt(e,n){return Ie(xe(e),n)}function St(e,n){if(e!=null){if(pe(e))return mt(e,n);if(de(e))return bt(e,n);if(ve(e))return wt(e,n);if(ye(e))return Ie(e,n);if(be(e))return xt(e,n);if(ge(e))return gt(e,n)}throw me(e)}function At(e,n){return n?St(e,n):F(e)}function Et(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=st(e);return At(e,t)}var Te=X(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function It(e){return e instanceof Date&&!isNaN(e)}function K(e,n){return A(function(t,r){var o=0;t.subscribe(E(r,function(i){r.next(e.call(n,i,o++))}))})}function Tt(e,n,t,r,o,i,u,s){var a=[],c=0,f=0,h=!1,p=function(){h&&!a.length&&!c&&n.complete()},l=function(d){return c<r?x(d):a.push(d)},x=function(d){c++;var R=!1;F(t(d,f++)).subscribe(E(n,function(P){n.next(P)},function(){R=!0},void 0,function(){if(R)try{c--;for(var P=function(){var L=a.shift();u||x(L)};a.length&&c<r;)P();p()}catch(L){n.error(L)}}))};return e.subscribe(E(n,l,function(){h=!0,p()})),function(){}}function Pe(e,n,t){return t===void 0&&(t=1/0),b(n)?Pe(function(r,o){return K(function(i,u){return n(r,i,o,u)})(F(e(r,o)))},t):(typeof n=="number"&&(t=n),A(function(r,o){return Tt(r,o,e,t)}))}function Pt(e,n,t){e===void 0&&(e=0),t===void 0&&(t=ut);var r=-1;return n!=null&&(he(n)?t=n:r=n),new S(function(o){var i=It(e)?+e-t.now():e;i<0&&(i=0);var u=0;return t.schedule(function(){o.closed||(o.next(u++),0<=r?this.schedule(void 0,r):o.complete())},i)})}function Ot(e,n){return e===void 0&&(e=0),n===void 0&&(n=le),e<0&&(e=0),Pt(e,e,n)}function jt(e,n){return A(function(t,r){var o=0;t.subscribe(E(r,function(i){return e.call(n,i,o++)&&r.next(i)}))})}function Oe(e){return A(function(n,t){var r=null,o=!1,i;r=n.subscribe(E(t,void 0,void 0,function(u){i=F(e(u,Oe(e)(n))),r?(r.unsubscribe(),r=null,i.subscribe(t)):o=!0})),o&&(r.unsubscribe(),r=null,i.subscribe(t))})}function Rt(e,n,t,r,o){return function(i,u){var s=t,a=n,c=0;i.subscribe(E(u,function(f){var h=c++;a=s?e(a,f,h):(s=!0,f),u.next(a)},o))}}function Lt(e){return A(function(n,t){var r=!1;n.subscribe(E(t,function(o){r=!0,t.next(o)},function(){r||t.next(e),t.complete()}))})}function Ut(e){return e<=0?function(){return at}:A(function(n,t){var r=0;n.subscribe(E(t,function(o){++r<=e&&(t.next(o),e<=r&&t.complete())}))})}function kt(e){return e===void 0&&(e=Dt),A(function(n,t){var r=!1;n.subscribe(E(t,function(o){r=!0,t.next(o)},function(){return r?t.complete():t.error(e())}))})}function Dt(){return new Te}function Ft(e,n){var t=arguments.length>=2;return function(r){return r.pipe(e?jt(function(o,i){return e(o,i,r)}):ae,Ut(1),t?Lt(n):kt(function(){return new Te}))}}function qt(){return A(function(e,n){var t,r=!1;e.subscribe(E(n,function(o){var i=t;t=o,r&&n.next([i,o]),r=!0}))})}function Ct(e,n){return A(Rt(e,n,arguments.length>=2,!0))}function je(e){switch(e.responseType){case"json":{if("response"in e)return e.response;var n=e;return JSON.parse(n.responseText)}case"document":return e.responseXML;default:{if("response"in e)return e.response;var n=e;return n.responseText}}}var _t=(function(){function e(n,t,r,o){o===void 0&&(o="download_load"),this.originalEvent=n,this.xhr=t,this.request=r,this.type=o;var i=t.status,u=t.responseType;this.status=i??0,this.responseType=u??"";var s=t.getAllResponseHeaders();this.responseHeaders=s?s.split(`
4
+ `).reduce(function(f,h){var p=h.indexOf(": ");return f[h.slice(0,p)]=h.slice(p+2),f},{}):{},this.response=je(t);var a=n.loaded,c=n.total;this.loaded=a,this.total=c}return e})(),G=X(function(e){return function(t,r,o){this.message=t,this.name="AjaxError",this.xhr=r,this.request=o,this.status=r.status,this.responseType=r.responseType;var i;try{i=je(r)}catch{i=r.responseText}this.response=i}}),Ht=(function(){function e(n,t){return G.call(this,"ajax timeout",n,t),this.name="AjaxTimeoutError",this}return e.prototype=Object.create(G.prototype),e})();function Vt(e,n){return j({method:"GET",url:e,headers:n})}function Bt(e,n,t){return j({method:"POST",url:e,body:n,headers:t})}function Nt(e,n){return j({method:"DELETE",url:e,headers:n})}function Gt(e,n,t){return j({method:"PUT",url:e,body:n,headers:t})}function Mt(e,n,t){return j({method:"PATCH",url:e,body:n,headers:t})}var Xt=K(function(e){return e.response});function Yt(e,n){return Xt(j({method:"GET",url:e,headers:n}))}var j=(function(){var e=function(n){var t=typeof n=="string"?{url:n}:n;return $t(t)};return e.get=Vt,e.post=Bt,e.delete=Nt,e.put=Gt,e.patch=Mt,e.getJSON=Yt,e})(),Jt="upload",Re="download",Q="loadstart",Z="progress",Le="load";function $t(e){return new S(function(n){var t,r,o=C({async:!0,crossDomain:!1,withCredentials:!1,method:"GET",timeout:0,responseType:"json"},e),i=o.queryParams,u=o.body,s=o.headers,a=o.url;if(!a)throw new TypeError("url is required");if(i){var c;if(a.includes("?")){var f=a.split("?");if(2<f.length)throw new TypeError("invalid url");c=new URLSearchParams(f[1]),new URLSearchParams(i).forEach(function(m,w){return c.set(w,m)}),a=f[0]+"?"+c}else c=new URLSearchParams(i),a=a+"?"+c}var h={};if(s)for(var p in s)s.hasOwnProperty(p)&&(h[p.toLowerCase()]=s[p]);var l=o.crossDomain;!l&&!("x-requested-with"in h)&&(h["x-requested-with"]="XMLHttpRequest");var x=o.withCredentials,d=o.xsrfCookieName,R=o.xsrfHeaderName;if((x||!l)&&d&&R){var P=(r=(t=document?.cookie.match(new RegExp("(^|;\\s*)("+d+")=([^;]*)")))===null||t===void 0?void 0:t.pop())!==null&&r!==void 0?r:"";P&&(h[R]=P)}var L=zt(u,h),I=C(C({},o),{url:a,headers:h,body:L}),v;v=e.createXHR?e.createXHR():new XMLHttpRequest;{var y=e.progressSubscriber,ke=e.includeDownloadProgress,cn=ke===void 0?!1:ke,De=e.includeUploadProgress,sn=De===void 0?!1:De,Fe=function(m,w){v.addEventListener(m,function(){var g,U=w();(g=y?.error)===null||g===void 0||g.call(y,U),n.error(U)})};Fe("timeout",function(){return new Ht(v,I)}),Fe("abort",function(){return new G("aborted",v,I)});var qe=function(m,w){return new _t(w,v,I,m+"_"+w.type)},Ce=function(m,w,g){m.addEventListener(w,function(U){n.next(qe(g,U))})};sn&&[Q,Z,Le].forEach(function(m){return Ce(v.upload,m,Jt)}),y&&[Q,Z].forEach(function(m){return v.upload.addEventListener(m,function(w){var g;return(g=y?.next)===null||g===void 0?void 0:g.call(y,w)})}),cn&&[Q,Z].forEach(function(m){return Ce(v,m,Re)});var _e=function(m){var w="ajax error"+(m?" "+m:"");n.error(new G(w,v,I))};v.addEventListener("error",function(m){var w;(w=y?.error)===null||w===void 0||w.call(y,m),_e()}),v.addEventListener(Le,function(m){var w,g,U=v.status;if(U<400){(w=y?.complete)===null||w===void 0||w.call(y);var Be=void 0;try{Be=qe(Re,m)}catch(fn){n.error(fn);return}n.next(Be),n.complete()}else(g=y?.error)===null||g===void 0||g.call(y,m),_e(U)})}var He=I.user,Ve=I.method,te=I.async;He?v.open(Ve,a,te,He,I.password):v.open(Ve,a,te),te&&(v.timeout=I.timeout,v.responseType=I.responseType),"withCredentials"in v&&(v.withCredentials=I.withCredentials);for(var p in h)h.hasOwnProperty(p)&&v.setRequestHeader(p,h[p]);return L?v.send(L):v.send(),function(){v&&v.readyState!==4&&v.abort()}})}function zt(e,n){var t;if(!e||typeof e=="string"||tn(e)||nn(e)||Kt(e)||Qt(e)||Zt(e)||rn(e))return e;if(en(e))return e.buffer;if(typeof e=="object")return n["content-type"]=(t=n["content-type"])!==null&&t!==void 0?t:"application/json;charset=utf-8",JSON.stringify(e);throw new TypeError("Unknown body type")}var Wt=Object.prototype.toString;function ee(e,n){return Wt.call(e)==="[object "+n+"]"}function Kt(e){return ee(e,"ArrayBuffer")}function Qt(e){return ee(e,"File")}function Zt(e){return ee(e,"Blob")}function en(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(e)}function tn(e){return typeof FormData<"u"&&e instanceof FormData}function nn(e){return typeof URLSearchParams<"u"&&e instanceof URLSearchParams}function rn(e){return typeof ReadableStream<"u"&&e instanceof ReadableStream}const on=180*1e3,Ue=({versionCheckIntervalPeriod:e=on,onNewVersionAvailable:n})=>{const t=()=>j({url:"/version",responseType:"text",headers:{"Cache-Control":"no-store"}}).pipe(K(o=>{const i=o.response;return typeof i=="string"?i.trim():null}),Oe(()=>Et(null))),r=Ot(e).pipe(Pe(t),Ct((o,i)=>i??o),qt(),Ft(([o,i])=>!!o&&o!==i)).subscribe(()=>{n(),r.unsubscribe()});return()=>r.unsubscribe()};function un({message:e="A new version of the app is available. Please reload the page to access latest features."}){return q.useEffect(()=>Ue({onNewVersionAvailable:()=>{globalThis.confirm(e)&&globalThis.location.reload()}}),[e]),null}function an(e={}){const{envVarName:n="APP_VERSION"}=e;return{name:"vite-plugin-force-update",generateBundle(){const t=process.env[n];if(!t){console.warn(`Environment variable ${n} is not set.`);return}this.emitFile({type:"asset",fileName:"version",source:t.trim()})}}}T.ForceUpdateNotification=un,T.listenOnForceUpdate=Ue,T.vitePluginForceUpdate=an,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})}));
@@ -2,3 +2,4 @@ export type ForceUpdateNotificationProps = {
2
2
  message?: string;
3
3
  };
4
4
  export declare function ForceUpdateNotification({ message, }: ForceUpdateNotificationProps): null;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/ForceUpdateNotification/index.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,wBAAgB,uBAAuB,CAAC,EACtC,OAAoG,GACrG,EAAE,4BAA4B,QAc9B"}
@@ -12,3 +12,4 @@ export type ForceUpdateParams = {
12
12
  * @returns A cleanup function that unsubscribes from the version checking
13
13
  */
14
14
  export declare const listenOnForceUpdate: ({ versionCheckIntervalPeriod, onNewVersionAvailable, }: ForceUpdateParams) => () => void;
15
+ //# sourceMappingURL=listenOnForceUpdate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listenOnForceUpdate.d.ts","sourceRoot":"","sources":["../../src/lib/listenOnForceUpdate.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,0BAA0B,CAAC,EAAE,MAAM,CAAA;IACnC,qBAAqB,EAAE,MAAM,IAAI,CAAA;CAClC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,wDAGjC,iBAAiB,eA+BnB,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { Plugin } from "vite";
1
+ import { Plugin } from 'vite';
2
2
  export interface ForceUpdatePluginOptions {
3
3
  envVarName?: string;
4
4
  }
@@ -11,3 +11,4 @@ export interface ForceUpdatePluginOptions {
11
11
  * @returns A Vite plugin that creates a /version endpoint serving the current app version
12
12
  */
13
13
  export declare function vitePluginForceUpdate(options?: ForceUpdatePluginOptions): Plugin;
14
+ //# sourceMappingURL=vitePluginForceUpdate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitePluginForceUpdate.d.ts","sourceRoot":"","sources":["../../src/lib/vitePluginForceUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,MAAM,WAAW,wBAAwB;IACvC,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,wBAA6B,GAAG,MAAM,CAqBpF"}
package/package.json CHANGED
@@ -1,10 +1,25 @@
1
1
  {
2
2
  "name": "@leancodepl/force-update",
3
- "version": "9.7.2",
3
+ "version": "9.7.3",
4
4
  "license": "Apache-2.0",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ "./package.json": "./package.json",
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
5
17
  "dependencies": {
6
18
  "rxjs": ">=7.0.0"
7
19
  },
20
+ "devDependencies": {
21
+ "vitest": "*"
22
+ },
8
23
  "peerDependencies": {
9
24
  "react": "*",
10
25
  "vite": ">=4.0.0"
@@ -14,7 +29,7 @@
14
29
  "registry": "https://registry.npmjs.org/"
15
30
  },
16
31
  "engines": {
17
- "node": ">=18.0.0"
32
+ "node": ">=22.0.0"
18
33
  },
19
34
  "repository": {
20
35
  "type": "git",
@@ -41,16 +56,9 @@
41
56
  "name": "LeanCode",
42
57
  "url": "https://leancode.co"
43
58
  },
44
- "exports": {
45
- "./package.json": "./package.json",
46
- ".": {
47
- "module": "./index.esm.js",
48
- "types": "./index.d.ts",
49
- "import": "./index.cjs.mjs",
50
- "default": "./index.cjs.js"
51
- }
52
- },
53
- "module": "./index.esm.js",
54
- "main": "./index.cjs.js",
55
- "types": "./index.d.ts"
59
+ "files": [
60
+ "dist",
61
+ "CHANGELOG.md",
62
+ "!**/*.tsbuildinfo"
63
+ ]
56
64
  }
@@ -1 +0,0 @@
1
- exports._default = require('./index.cjs.js').default;
package/index.cjs.js DELETED
@@ -1,79 +0,0 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
- var rxjs = require('rxjs');
5
- var ajax = require('rxjs/ajax');
6
- var operators = require('rxjs/operators');
7
-
8
- const defaultVersionCheckIntervalPeriod = 3 * 60 * 1000;
9
- /**
10
- * Listens for force updates by periodically checking the `/version` endpoint.
11
- * When a new version is detected, it calls the provided callback function.
12
- *
13
- * @param params - Configuration object for force update listening
14
- * @param params.versionCheckIntervalPeriod - The interval period in milliseconds to check for version updates (default: 180000 - 3 minutes)
15
- * @param params.onNewVersionAvailable - Callback function that is called when a new version is available
16
- * @returns A cleanup function that unsubscribes from the version checking
17
- */ const listenOnForceUpdate = ({ versionCheckIntervalPeriod = defaultVersionCheckIntervalPeriod, onNewVersionAvailable })=>{
18
- const versionUrl = ()=>ajax.ajax({
19
- url: "/version",
20
- responseType: "text",
21
- headers: {
22
- "Cache-Control": "no-store"
23
- }
24
- }).pipe(operators.map((response)=>{
25
- const version = response.response;
26
- return typeof version === "string" ? version.trim() : null;
27
- }), operators.catchError(()=>rxjs.of(null)));
28
- const subscription = rxjs.interval(versionCheckIntervalPeriod).pipe(operators.mergeMap(versionUrl), operators.scan((lastVersion, version)=>version != null ? version : lastVersion), operators.pairwise(), operators.first(([previousVersion, currentVersion])=>!!previousVersion && previousVersion !== currentVersion)).subscribe(()=>{
29
- onNewVersionAvailable();
30
- subscription.unsubscribe();
31
- });
32
- return ()=>subscription.unsubscribe();
33
- };
34
-
35
- function ForceUpdateNotification({ message = "A new version of the app is available. Please reload the page to access latest features." }) {
36
- react.useEffect(()=>{
37
- const cleanup = listenOnForceUpdate({
38
- onNewVersionAvailable: ()=>{
39
- if (window.confirm(message)) {
40
- window.location.reload();
41
- }
42
- }
43
- });
44
- return cleanup;
45
- }, [
46
- message
47
- ]);
48
- return null;
49
- }
50
-
51
- /**
52
- * Vite plugin that emits a version asset file based on an environment variable, 'APP_VERSION' as default
53
- * This is used for force update mechanism that needs to check the current app version.
54
- *
55
- * @param options - Configuration options for the plugin
56
- * @param options.envVarName - The name of the environment variable to read the version from (default: 'APP_VERSION')
57
- * @returns A Vite plugin that creates a /version endpoint serving the current app version
58
- */ function vitePluginForceUpdate(options = {}) {
59
- const { envVarName = "APP_VERSION" } = options;
60
- return {
61
- name: "vite-plugin-force-update",
62
- generateBundle () {
63
- const version = process.env[envVarName];
64
- if (!version) {
65
- console.warn(`Environment variable ${envVarName} is not set.`);
66
- return;
67
- }
68
- this.emitFile({
69
- type: "asset",
70
- fileName: "version",
71
- source: version.trim()
72
- });
73
- }
74
- };
75
- }
76
-
77
- exports.ForceUpdateNotification = ForceUpdateNotification;
78
- exports.listenOnForceUpdate = listenOnForceUpdate;
79
- exports.vitePluginForceUpdate = vitePluginForceUpdate;
package/index.cjs.mjs DELETED
@@ -1,2 +0,0 @@
1
- export * from './index.cjs.js';
2
- export { _default as default } from './index.cjs.default.js';
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/index";
package/index.esm.js DELETED
@@ -1,75 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { interval, of } from 'rxjs';
3
- import { ajax } from 'rxjs/ajax';
4
- import { mergeMap, scan, pairwise, first, map, catchError } from 'rxjs/operators';
5
-
6
- const defaultVersionCheckIntervalPeriod = 3 * 60 * 1000;
7
- /**
8
- * Listens for force updates by periodically checking the `/version` endpoint.
9
- * When a new version is detected, it calls the provided callback function.
10
- *
11
- * @param params - Configuration object for force update listening
12
- * @param params.versionCheckIntervalPeriod - The interval period in milliseconds to check for version updates (default: 180000 - 3 minutes)
13
- * @param params.onNewVersionAvailable - Callback function that is called when a new version is available
14
- * @returns A cleanup function that unsubscribes from the version checking
15
- */ const listenOnForceUpdate = ({ versionCheckIntervalPeriod = defaultVersionCheckIntervalPeriod, onNewVersionAvailable })=>{
16
- const versionUrl = ()=>ajax({
17
- url: "/version",
18
- responseType: "text",
19
- headers: {
20
- "Cache-Control": "no-store"
21
- }
22
- }).pipe(map((response)=>{
23
- const version = response.response;
24
- return typeof version === "string" ? version.trim() : null;
25
- }), catchError(()=>of(null)));
26
- const subscription = interval(versionCheckIntervalPeriod).pipe(mergeMap(versionUrl), scan((lastVersion, version)=>version != null ? version : lastVersion), pairwise(), first(([previousVersion, currentVersion])=>!!previousVersion && previousVersion !== currentVersion)).subscribe(()=>{
27
- onNewVersionAvailable();
28
- subscription.unsubscribe();
29
- });
30
- return ()=>subscription.unsubscribe();
31
- };
32
-
33
- function ForceUpdateNotification({ message = "A new version of the app is available. Please reload the page to access latest features." }) {
34
- useEffect(()=>{
35
- const cleanup = listenOnForceUpdate({
36
- onNewVersionAvailable: ()=>{
37
- if (window.confirm(message)) {
38
- window.location.reload();
39
- }
40
- }
41
- });
42
- return cleanup;
43
- }, [
44
- message
45
- ]);
46
- return null;
47
- }
48
-
49
- /**
50
- * Vite plugin that emits a version asset file based on an environment variable, 'APP_VERSION' as default
51
- * This is used for force update mechanism that needs to check the current app version.
52
- *
53
- * @param options - Configuration options for the plugin
54
- * @param options.envVarName - The name of the environment variable to read the version from (default: 'APP_VERSION')
55
- * @returns A Vite plugin that creates a /version endpoint serving the current app version
56
- */ function vitePluginForceUpdate(options = {}) {
57
- const { envVarName = "APP_VERSION" } = options;
58
- return {
59
- name: "vite-plugin-force-update",
60
- generateBundle () {
61
- const version = process.env[envVarName];
62
- if (!version) {
63
- console.warn(`Environment variable ${envVarName} is not set.`);
64
- return;
65
- }
66
- this.emitFile({
67
- type: "asset",
68
- fileName: "version",
69
- source: version.trim()
70
- });
71
- }
72
- };
73
- }
74
-
75
- export { ForceUpdateNotification, listenOnForceUpdate, vitePluginForceUpdate };
package/src/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from "./lib/ForceUpdateNotification";
2
- export * from "./lib/listenOnForceUpdate";
3
- export * from "./lib/vitePluginForceUpdate";