kui-crm 0.0.500 → 0.0.502
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.
- package/agent/index.d.ts +1 -0
- package/agent/index.js +1 -1
- package/cjs/index.js +1 -1
- package/index.d.ts +12 -2
- package/index.js +1 -1
- package/package.json +1 -1
package/agent/index.d.ts
CHANGED
|
@@ -126,6 +126,7 @@ declare const ApartmentsAgent: {
|
|
|
126
126
|
|
|
127
127
|
declare const ApartmentMetersAgent: {
|
|
128
128
|
getMeters: (apartmentId: number, resource: ResourceTypes, year: number, month: number, contractId?: number | null | undefined, queryParams?: string | undefined) => Promise<any>;
|
|
129
|
+
getLightMeters: (apartmentId: number, resource: ResourceTypes) => Promise<any>;
|
|
129
130
|
};
|
|
130
131
|
|
|
131
132
|
declare const requests: {
|
package/agent/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"axios";import{deleteCookie as n,getCookie as e}from"kui-utils";import{setSettings as r}from"kui-complex";var o=function(){return o=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},o.apply(this,arguments)};function i(t,n,e,r){return new(e||(e=Promise))((function(o,i){function c(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(c,a)}u((r=r.apply(t,n||[])).next())}))}function c(t,n){var e,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;c;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,r=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=n.call(t,c)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var a="csrftoken",u=new function(){var t=this;this.getSettings=function(){return o({},t.settings)},this.setSettings=function(n){t.settings=o(o({},t.settings),n),r(n),t.observers.forEach((function(n){return n(t.settings)}))},this.subscribeToSettings=function(n){t.observers.push(n)},this.unsubscribeFromSettings=function(n){var e=t.observers.indexOf(n);-1!==e&&t.observers.splice(e,1)},this.settings={mapKey:""},this.observers=[],this.id=100*Math.random()},s={getCountries:function(t,n,e){var r=u.getSettings().apiBaseUrl;return w.get("/catalogs/countries?limit=".concat(n,"&offset=").concat(t).concat(e),r)},getRegions:function(t,n,e){var r=u.getSettings().apiBaseUrl;return w.get("/catalogs/regions?limit=".concat(n,"&offset=").concat(t).concat(e),r)},getCities:function(t,n,e){var r=u.getSettings().apiBaseUrl;return w.get("/catalogs/cities?limit=".concat(n,"&offset=").concat(t).concat(e),r)},getDistricts:function(t,n,e){var r=u.getSettings().apiBaseUrl;return w.get("/catalogs/districts?limit=".concat(n,"&offset=").concat(t).concat(e),r)},getCounties:function(t,n,e){var r=u.getSettings().apiBaseUrl;return w.get("/catalogs/counties?limit=".concat(n,"&offset=").concat(t).concat(e),r)},getAddresses:function(t){var n=u.getSettings().apiBaseUrl;return w.get("/catalogs/addresses/suggestions?query=".concat(encodeURIComponent(t)),n)}},f={all:function(t,n,e){return w.get("/companies?limit=".concat(n,"&offset=").concat(t).concat(e))},create:function(t){return w.post("/companies",t)},createLogo:function(t,n){return w.put("/companies/".concat(t,"/logo"),n)},findCompanyByINN:function(t){return w.post("/companies/info-by-new-tin",t)}},l={uploadImage:function(t,n){return w.post(n?"":"/upload/image",t,n)},uploadDocument:function(t,n){return w.post(n?"":"/upload/document",t,n)},uploadVideo:function(t,n){return w.post(n?"":"/upload/video",t,n)}},g={getAll:function(t){var n=u.getSettings().catalogsUrl;return w.get("/features?feature_type=".concat(t),n)},create:function(t){return w.post("/features",t)}},p={all:function(t,n,e,r){return w.get("/tariffs/".concat(t,"?ordering=region&offset=").concat(n,"&limit=").concat(e).concat(r))},createTariff:function(t,n){return w.post("/tariffs/".concat(n),t)}},d={signIn:function(t){var n=u.getSettings().appUrl;return w.post("/api/api-token-auth/",t,n)},logout:function(){var t=u.getSettings().appUrl;return w.get("/api/auth/logout",t)}},v={getAll:function(t,n,e){return w.get("/apartments?limit=".concat(n,"&offset=").concat(t).concat(e))},getFillingList:function(t,n){return w.get("/apartments/".concat(t,"/features/list?feature_type=").concat(n))}},h={getMeters:function(t,n,e,r,o,i){return w.get("/apartments/".concat(t,"/expenses/meters/").concat(n,"?year=").concat(e,"&month=").concat(r).concat(o?"&rental_contract=".concat(o):"").concat(i||""))}},m=t.create();m.defaults.withCredentials=!0;var b=t.create(),y=function(t){var e,r,i;if(t&&401===(null===(e=t.response)||void 0===e?void 0:e.status)){var c=u.getSettings();n(a),n("crm-sessionid"),localStorage.removeItem("maroomCRMisAuth"),c.errorHandler&&c.errorHandler(t)}return Promise.reject((null===(r=t.response)||void 0===r?void 0:r.data)?o(o({},t.response.data),{status:null===(i=t.response)||void 0===i?void 0:i.status}):t)},S=function(t){var n=e(a);return n&&(t.headers["X-CSRFToken"]=n),t};m.interceptors.request.use((function(t){var n=u.getSettings().reqHandler;return n?n(S(t)):S(t)})),m.interceptors.response.use((function(t){return i(void 0,void 0,void 0,(function(){return c(this,(function(n){return[2,t.data]}))}))}),(function(t){return y(t)})),b.interceptors.response.use((function(t){return t.data}),(function(t){return y(t)}));var w={get:function(t,n){return i(void 0,void 0,void 0,(function(){var e;return c(this,(function(r){return e=n||u.getSettings().apiUrl,[2,m.get("".concat(e).concat(t))]}))}))},post:function(t,n,e){return i(void 0,void 0,void 0,(function(){var r;return c(this,(function(o){return r=e||u.getSettings().apiUrl,[2,m.post("".concat(r).concat(t),n)]}))}))},put:function(t,n,e){return i(void 0,void 0,void 0,(function(){var r;return c(this,(function(o){return r=e||u.getSettings().apiUrl,[2,m.put("".concat(r).concat(t),n)]}))}))},patch:function(t,n,e){return i(void 0,void 0,void 0,(function(){var r;return c(this,(function(o){return r=e||u.getSettings().apiUrl,[2,m.patch("".concat(r).concat(t),n)]}))}))},delete:function(t,n){return i(void 0,void 0,void 0,(function(){var e;return c(this,(function(r){return e=n||u.getSettings().apiUrl,[2,m.delete("".concat(e).concat(t))]}))}))},getWithoutToken:function(t){return i(void 0,void 0,void 0,(function(){return c(this,(function(n){return[2,b.get(t)]}))}))},postWithoutToken:function(t,n,e){return i(void 0,void 0,void 0,(function(){return c(this,(function(r){return[2,b.post(t,n,{withCredentials:e})]}))}))}};export{h as ApartmentMetersAgent,v as ApartmentsAgent,d as AuthAgent,s as CatalogsAgent,f as CompaniesAgent,g as FillingTagsAgent,p as TariffsAgent,l as UploadAgent,w as default};
|
|
1
|
+
import t from"axios";import{deleteCookie as n,getCookie as e}from"kui-utils";import{setSettings as r}from"kui-complex";var o=function(){return o=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},o.apply(this,arguments)};function i(t,n,e,r){return new(e||(e=Promise))((function(o,i){function c(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(c,a)}u((r=r.apply(t,n||[])).next())}))}function c(t,n){var e,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;c;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,r=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=n.call(t,c)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var a="csrftoken",u=new function(){var t=this;this.getSettings=function(){return o({},t.settings)},this.setSettings=function(n){t.settings=o(o({},t.settings),n),r(n),t.observers.forEach((function(n){return n(t.settings)}))},this.subscribeToSettings=function(n){t.observers.push(n)},this.unsubscribeFromSettings=function(n){var e=t.observers.indexOf(n);-1!==e&&t.observers.splice(e,1)},this.settings={mapKey:""},this.observers=[],this.id=100*Math.random()},s={getCountries:function(t,n,e){var r=u.getSettings().apiBaseUrl;return w.get("/catalogs/countries?limit=".concat(n,"&offset=").concat(t).concat(e),r)},getRegions:function(t,n,e){var r=u.getSettings().apiBaseUrl;return w.get("/catalogs/regions?limit=".concat(n,"&offset=").concat(t).concat(e),r)},getCities:function(t,n,e){var r=u.getSettings().apiBaseUrl;return w.get("/catalogs/cities?limit=".concat(n,"&offset=").concat(t).concat(e),r)},getDistricts:function(t,n,e){var r=u.getSettings().apiBaseUrl;return w.get("/catalogs/districts?limit=".concat(n,"&offset=").concat(t).concat(e),r)},getCounties:function(t,n,e){var r=u.getSettings().apiBaseUrl;return w.get("/catalogs/counties?limit=".concat(n,"&offset=").concat(t).concat(e),r)},getAddresses:function(t){var n=u.getSettings().apiBaseUrl;return w.get("/catalogs/addresses/suggestions?query=".concat(encodeURIComponent(t)),n)}},f={all:function(t,n,e){return w.get("/companies?limit=".concat(n,"&offset=").concat(t).concat(e))},create:function(t){return w.post("/companies",t)},createLogo:function(t,n){return w.put("/companies/".concat(t,"/logo"),n)},findCompanyByINN:function(t){return w.post("/companies/info-by-new-tin",t)}},l={uploadImage:function(t,n){return w.post(n?"":"/upload/image",t,n)},uploadDocument:function(t,n){return w.post(n?"":"/upload/document",t,n)},uploadVideo:function(t,n){return w.post(n?"":"/upload/video",t,n)}},g={getAll:function(t){var n=u.getSettings().catalogsUrl;return w.get("/features?feature_type=".concat(t),n)},create:function(t){return w.post("/features",t)}},p={all:function(t,n,e,r){return w.get("/tariffs/".concat(t,"?ordering=region&offset=").concat(n,"&limit=").concat(e).concat(r))},createTariff:function(t,n){return w.post("/tariffs/".concat(n),t)}},d={signIn:function(t){var n=u.getSettings().appUrl;return w.post("/api/api-token-auth/",t,n)},logout:function(){var t=u.getSettings().appUrl;return w.get("/api/auth/logout",t)}},v={getAll:function(t,n,e){return w.get("/apartments?limit=".concat(n,"&offset=").concat(t).concat(e))},getFillingList:function(t,n){return w.get("/apartments/".concat(t,"/features/list?feature_type=").concat(n))}},h={getMeters:function(t,n,e,r,o,i){return w.get("/apartments/".concat(t,"/expenses/meters/").concat(n,"?year=").concat(e,"&month=").concat(r).concat(o?"&rental_contract=".concat(o):"").concat(i||""))},getLightMeters:function(t,n){return w.get("/apartments/".concat(t,"/meters/").concat(n))}},m=t.create();m.defaults.withCredentials=!0;var b=t.create(),y=function(t){var e,r,i;if(t&&401===(null===(e=t.response)||void 0===e?void 0:e.status)){var c=u.getSettings();n(a),n("crm-sessionid"),localStorage.removeItem("maroomCRMisAuth"),c.errorHandler&&c.errorHandler(t)}return Promise.reject((null===(r=t.response)||void 0===r?void 0:r.data)?o(o({},t.response.data),{status:null===(i=t.response)||void 0===i?void 0:i.status}):t)},S=function(t){var n=e(a);return n&&(t.headers["X-CSRFToken"]=n),t};m.interceptors.request.use((function(t){var n=u.getSettings().reqHandler;return n?n(S(t)):S(t)})),m.interceptors.response.use((function(t){return i(void 0,void 0,void 0,(function(){return c(this,(function(n){return[2,t.data]}))}))}),(function(t){return y(t)})),b.interceptors.response.use((function(t){return t.data}),(function(t){return y(t)}));var w={get:function(t,n){return i(void 0,void 0,void 0,(function(){var e;return c(this,(function(r){return e=n||u.getSettings().apiUrl,[2,m.get("".concat(e).concat(t))]}))}))},post:function(t,n,e){return i(void 0,void 0,void 0,(function(){var r;return c(this,(function(o){return r=e||u.getSettings().apiUrl,[2,m.post("".concat(r).concat(t),n)]}))}))},put:function(t,n,e){return i(void 0,void 0,void 0,(function(){var r;return c(this,(function(o){return r=e||u.getSettings().apiUrl,[2,m.put("".concat(r).concat(t),n)]}))}))},patch:function(t,n,e){return i(void 0,void 0,void 0,(function(){var r;return c(this,(function(o){return r=e||u.getSettings().apiUrl,[2,m.patch("".concat(r).concat(t),n)]}))}))},delete:function(t,n){return i(void 0,void 0,void 0,(function(){var e;return c(this,(function(r){return e=n||u.getSettings().apiUrl,[2,m.delete("".concat(e).concat(t))]}))}))},getWithoutToken:function(t){return i(void 0,void 0,void 0,(function(){return c(this,(function(n){return[2,b.get(t)]}))}))},postWithoutToken:function(t,n,e){return i(void 0,void 0,void 0,(function(){return c(this,(function(r){return[2,b.post(t,n,{withCredentials:e})]}))}))}};export{h as ApartmentMetersAgent,v as ApartmentsAgent,d as AuthAgent,s as CatalogsAgent,f as CompaniesAgent,g as FillingTagsAgent,p as TariffsAgent,l as UploadAgent,w as default};
|