plaza-sdk 1.1.2 → 1.1.4

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.
Files changed (61) hide show
  1. package/README.md +52 -5
  2. package/lib/browser/bundle.iife.js +1 -1
  3. package/lib/browser/bundle.umd.js +1 -1
  4. package/lib/cjs/common/index.js +1 -1
  5. package/lib/cjs/common/utils.js +1 -1
  6. package/lib/cjs/index.js +1 -1
  7. package/lib/cjs/modules/alif-shop-api/core/applications/api.js +1 -0
  8. package/lib/cjs/modules/alif-shop-api/core/applications/constants.js +1 -0
  9. package/lib/cjs/modules/alif-shop-api/core/applications/index.js +1 -0
  10. package/lib/cjs/modules/alif-shop-api/core/applications/params.js +1 -0
  11. package/lib/cjs/modules/alif-shop-api/core/applications/types.js +1 -0
  12. package/lib/cjs/modules/alif-shop-api/core/auth/api.js +1 -1
  13. package/lib/cjs/modules/alif-shop-api/core/index.js +1 -1
  14. package/lib/cjs/modules/alif-shop-api/index.js +1 -1
  15. package/lib/cjs/modules/index.js +1 -1
  16. package/lib/cjs/modules/uzum-market-api/common/utils.js +1 -1
  17. package/lib/cjs/modules/uzum-market-api/core/auth/api.js +1 -1
  18. package/lib/cjs/modules/uzum-market-api/core/products/api.js +1 -1
  19. package/lib/cjs/modules/uzum-market-api/index.js +1 -1
  20. package/lib/esm/common/index.js +1 -1
  21. package/lib/esm/common/utils.js +1 -1
  22. package/lib/esm/index.js +1 -1
  23. package/lib/esm/modules/alif-shop-api/core/applications/api.js +1 -0
  24. package/lib/esm/modules/alif-shop-api/core/applications/constants.js +1 -0
  25. package/lib/esm/modules/alif-shop-api/core/applications/index.js +1 -0
  26. package/lib/esm/modules/alif-shop-api/core/applications/params.js +1 -0
  27. package/lib/esm/modules/alif-shop-api/core/applications/types.js +1 -0
  28. package/lib/esm/modules/alif-shop-api/core/auth/api.js +1 -1
  29. package/lib/esm/modules/alif-shop-api/core/index.js +1 -1
  30. package/lib/esm/modules/alif-shop-api/index.js +1 -1
  31. package/lib/esm/modules/index.js +1 -1
  32. package/lib/esm/modules/uzum-market-api/common/utils.js +1 -1
  33. package/lib/esm/modules/uzum-market-api/core/auth/api.js +1 -1
  34. package/lib/esm/modules/uzum-market-api/core/products/api.js +1 -1
  35. package/lib/esm/modules/uzum-market-api/index.js +1 -1
  36. package/lib/types/src/common/index.d.ts +2 -2
  37. package/lib/types/src/common/types.d.ts +2 -1
  38. package/lib/types/src/common/utils.d.ts +8 -1
  39. package/lib/types/src/index.d.ts +2 -2
  40. package/lib/types/src/modules/alif-shop-api/common/interfaces.d.ts +19 -1
  41. package/lib/types/src/modules/alif-shop-api/core/applications/api.d.ts +9 -0
  42. package/lib/types/src/modules/alif-shop-api/core/applications/constants.d.ts +2 -0
  43. package/lib/types/src/modules/alif-shop-api/core/applications/index.d.ts +6 -0
  44. package/lib/types/src/modules/alif-shop-api/core/applications/params.d.ts +22 -0
  45. package/lib/types/src/modules/alif-shop-api/core/applications/types.d.ts +70 -0
  46. package/lib/types/src/modules/alif-shop-api/core/auth/api.d.ts +2 -2
  47. package/lib/types/src/modules/alif-shop-api/core/auth/index.d.ts +1 -1
  48. package/lib/types/src/modules/alif-shop-api/core/auth/types.d.ts +7 -1
  49. package/lib/types/src/modules/alif-shop-api/core/index.d.ts +5 -1
  50. package/lib/types/src/modules/alif-shop-api/index.d.ts +5 -1
  51. package/lib/types/src/modules/index.d.ts +2 -2
  52. package/lib/types/src/modules/uzum-market-api/common/types.d.ts +1 -1
  53. package/lib/types/src/modules/uzum-market-api/common/utils.d.ts +1 -4
  54. package/lib/types/src/modules/uzum-market-api/core/auth/api.d.ts +3 -2
  55. package/lib/types/src/modules/uzum-market-api/core/auth/index.d.ts +2 -1
  56. package/lib/types/src/modules/uzum-market-api/core/auth/params.d.ts +7 -1
  57. package/lib/types/src/modules/uzum-market-api/core/index.d.ts +2 -1
  58. package/lib/types/src/modules/uzum-market-api/core/products/mappers.d.ts +2 -2
  59. package/lib/types/src/modules/uzum-market-api/core/products/params.d.ts +2 -2
  60. package/lib/types/src/modules/uzum-market-api/index.d.ts +2 -2
  61. package/package.json +2 -2
package/README.md CHANGED
@@ -13,7 +13,9 @@ Loyiha kodlaridan foydalanish uchun bizga eng birinchi o'rinda `nodejs` yoki `br
13
13
 
14
14
  ---
15
15
 
16
- Masalan `Uzum Market (Dashboard Api)` uchun bunday atigi bitta instance kerak bo'ladi:
16
+ ### 1. Kutubxonani qo'llash
17
+
18
+ `Uzum Market (Dashboard Api)` uchun bunday atigi bitta instance kerak bo'ladi:
17
19
 
18
20
  ```typescript
19
21
  // libs/https/uzum-http.ts
@@ -38,12 +40,57 @@ export default uzumHttp;
38
40
  Va uni quyidagicha ishlatishimiz mumkin:
39
41
 
40
42
  ```typescript
41
- // lib/api/auth-service.ts
42
- import { GetToken } from "plaza-sdk/uzum-market"
43
+ // lib/api/uzum-auth-service.ts
44
+ import { GetToken } from "plaza-sdk/uzum-market";
45
+
46
+ import { uzumHttp } from "@/libs/https";
47
+
48
+ const getToken = (username: string, password: string) => {
49
+ return GetToken(uzumHttp, { password: "your-password", username: "your-username" });
50
+ };
51
+ ```
52
+
53
+ ---
54
+
55
+ `Eslatma! Har doim axios bilan sozlangan instance'ni har bir funksiya chaqirilganda uzatish shart!!!!`
56
+
57
+ `Alif Shop (Dashboard Api)` uchun bir nechta http yaratib qo'yib turli vaziyatlarga moslab uzatish kerak bo'ladi:
58
+
59
+ ```typescript
60
+ // 1. authentication uchun
61
+ import axios from "axios";
62
+
63
+ const baseURL = "https://id.alif.uz/realms";
64
+ const alifIdHttp = axios.create({ baseURL });
65
+ export { alifIdHttp };
66
+
67
+ // 2. asosiy product va infolarni olish uchun api http
68
+ const baseURL = "https://api-merchant.alif.uz/merchant";
69
+ const alifMerchantHttp = axios.create({ baseURL });
70
+ export { alifMerchantHttp };
71
+ ```
72
+
73
+ Va ularni quyidagicha ishlatishimiz mumkin:
43
74
 
75
+ ```typescript
76
+ // lib/api/uzum-auth-service.ts
77
+ import { GetToken } from "plaza-sdk/alif-shop";
78
+
79
+ import { alifIdHttp } from "@/libs/https";
44
80
 
45
81
  const getToken = (username: string, password: string) => {
46
- return GetToken({ username, password })
47
- }
82
+ return GetToken(alifIdHttp, { password: "your-password", username: "your-username" });
83
+ };
84
+
85
+ // lib/api/uzum-auth-service.ts
86
+ import { GetProduct } from "plaza-sdk/alif-shop";
87
+
88
+ import { alifMerchantHttp } from "@/libs/https";
89
+
90
+ const getProductInfo = (username: string, password: string) => {
91
+ return GetProduct(alifMerchantHttp, { shopId:"your shopid <number>" product: "your-product-id <number>", token: "your token <string>" });
92
+ };
48
93
 
49
94
  ```
95
+
96
+ Qolgan service'lar ustida hali ishlanmoqda!
@@ -1 +1 @@
1
- var plazaSdk=function(r){"use strict";return r.getNumber=(r,t=0)=>{if("number"==typeof r)return r;if("string"==typeof r){const e=parseFloat(r);return isNaN(e)?t:e}return t},r}({});
1
+ var plazaSdk=function(e){"use strict";return e.getNumber=(e,r=0)=>{if("number"==typeof e)return e;if("string"==typeof e){const t=parseFloat(e);return isNaN(t)?r:t}return r},e.pasteAuthHeader=e=>({Authorization:`Bearer ${e}`}),e.pasteAuthHeaderAndApikey=(e,r="2qHIakuLe5")=>({Authorization:`Bearer ${e}`,apikey:r}),e}({});
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).plazaSdk={})}(this,function(e){"use strict";e.getNumber=(e,t=0)=>{if("number"==typeof e)return e;if("string"==typeof e){const n=parseFloat(e);return isNaN(n)?t:n}return t}});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).plazaSdk={})}(this,function(e){"use strict";e.getNumber=(e,t=0)=>{if("number"==typeof e)return e;if("string"==typeof e){const i=parseFloat(e);return isNaN(i)?t:i}return t},e.pasteAuthHeader=e=>({Authorization:`Bearer ${e}`}),e.pasteAuthHeaderAndApikey=(e,t="2qHIakuLe5")=>({Authorization:`Bearer ${e}`,apikey:t})});
@@ -1 +1 @@
1
- "use strict";var e=require("./utils.js");exports.getNumber=e.getNumber;
1
+ "use strict";var e=require("./utils.js");exports.getNumber=e.getNumber,exports.pasteAuthHeader=e.pasteAuthHeader,exports.pasteAuthHeaderAndApikey=e.pasteAuthHeaderAndApikey;
@@ -1 +1 @@
1
- "use strict";exports.getNumber=(r,t=0)=>{if("number"==typeof r)return r;if("string"==typeof r){const e=parseFloat(r);return isNaN(e)?t:e}return t};
1
+ "use strict";exports.getNumber=(e,r=0)=>{if("number"==typeof e)return e;if("string"==typeof e){const t=parseFloat(e);return isNaN(t)?r:t}return r},exports.pasteAuthHeader=e=>({Authorization:`Bearer ${e}`}),exports.pasteAuthHeaderAndApikey=(e,r="2qHIakuLe5")=>({Authorization:`Bearer ${e}`,apikey:r});
package/lib/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("./common/utils.js");exports.getNumber=e.getNumber;
1
+ "use strict";var e=require("./common/utils.js");exports.getNumber=e.getNumber,exports.pasteAuthHeader=e.pasteAuthHeader,exports.pasteAuthHeaderAndApikey=e.pasteAuthHeaderAndApikey;
@@ -0,0 +1 @@
1
+ "use strict";var a=require("../../../../common/utils.js");exports.ApplicationsList=async(i,{token:s,...t})=>i.get("/application/applications/applications",{params:t,headers:a.pasteAuthHeaderAndApikey(s)});
@@ -0,0 +1 @@
1
+ "use strict";var i=require("./api.js");exports.ApplicationsList=i.ApplicationsList;
@@ -1 +1 @@
1
- "use strict";exports.GetToken=async(e,n)=>{const t={username:n.username,password:n.password,client_id:"merchant-frontend",grant_type:"password"};return e.post("/merchants/protocol/openid-connect/token",t,{headers:{"content-type":"application/x-www-form-urlencoded"}})};
1
+ "use strict";exports.GetToken=async(e,o)=>e.post("/merchants/protocol/openid-connect/token",o,{headers:{"content-type":"application/x-www-form-urlencoded"}});
@@ -1 +1 @@
1
- "use strict";var e=require("./auth/api.js");exports.GetToken=e.GetToken;
1
+ "use strict";var i=require("./auth/api.js"),t=require("./applications/api.js");exports.GetToken=i.GetToken,exports.ApplicationsList=t.ApplicationsList;
@@ -1 +1 @@
1
- "use strict";var e=require("./core/auth/api.js");exports.GetToken=e.GetToken;
1
+ "use strict";var e=require("./core/auth/api.js"),i=require("./core/applications/api.js");exports.GetToken=e.GetToken,exports.ApplicationsList=i.ApplicationsList;
@@ -1 +1 @@
1
- "use strict";var e=require("./uzum-market-api/common/utils.js"),t=require("./uzum-market-api/core/auth/api.js"),r=require("./uzum-market-api/core/products/api.js");exports.pasteAuthHeader=e.pasteAuthHeader,exports.CheckToken=t.CheckToken,exports.GetToken=t.GetToken,exports.AddPromotion=r.AddPromotion,exports.ArchiveProduct=r.ArchiveProduct,exports.CheckSkuExists=r.CheckSkuExists,exports.CreateProduct=r.CreateProduct,exports.GetProduct=r.GetProduct,exports.InvolvedProductsList=r.InvolvedProductsList,exports.ProductDescription=r.ProductDescription,exports.ProductsList=r.ProductsList,exports.RemovePromotion=r.RemovePromotion,exports.SendSkuData=r.SendSkuData,exports.UnarchiveProduct=r.UnarchiveProduct;
1
+ "use strict";var t=require("./uzum-market-api/core/auth/api.js"),e=require("./uzum-market-api/core/products/api.js");exports.CheckToken=t.CheckToken,exports.GetToken=t.GetToken,exports.AddPromotion=e.AddPromotion,exports.ArchiveProduct=e.ArchiveProduct,exports.CheckSkuExists=e.CheckSkuExists,exports.CreateProduct=e.CreateProduct,exports.GetProduct=e.GetProduct,exports.InvolvedProductsList=e.InvolvedProductsList,exports.ProductDescription=e.ProductDescription,exports.ProductsList=e.ProductsList,exports.RemovePromotion=e.RemovePromotion,exports.SendSkuData=e.SendSkuData,exports.UnarchiveProduct=e.UnarchiveProduct;
@@ -1 +1 @@
1
- "use strict";exports.pasteAuthHeader=e=>({Authorization:`Bearer ${e}`});
1
+ "use strict";
@@ -1 +1 @@
1
- "use strict";const e={"content-type":"application/x-www-form-urlencoded",authorization:"Basic YjJiLWZyb250OmNsaWVudFNlY3JldA=="};exports.CheckToken=async(s,t)=>s.post("/auth/seller/check_token",{token:t},{headers:e}),exports.GetToken=async(s,t)=>s.post("/oauth/token",{grant_type:"password",username:t.username,password:t.password,referer:""},{headers:e});
1
+ "use strict";const e={"content-type":"application/x-www-form-urlencoded",authorization:"Basic YjJiLWZyb250OmNsaWVudFNlY3JldA=="};exports.CheckToken=async(t,s)=>t.post("/auth/seller/check_token",{token:s},{headers:e}),exports.GetToken=async(t,s)=>t.post("/oauth/token",{grant_type:s.grant_type||"password",refresh_token:s.refresh_token,username:s.username,password:s.password,referer:""},{headers:e});
@@ -1 +1 @@
1
- "use strict";var e=require("../../common/utils.js"),s=require("./mappers.js");exports.AddPromotion=(s,t,r)=>s.post(`/seller/shop/${t.shopId}/marketing/calendar-event/add`,r,{headers:e.pasteAuthHeader(t.token)}),exports.ArchiveProduct=(s,{token:t,shopId:r,skuId:o})=>s.post(`/seller/shop/${r}/product/sku/${o}/archive`,null,{headers:e.pasteAuthHeader(t)}),exports.CheckSkuExists=async(s,t)=>s.get(`/seller/shop/${t.shopId}/product/checkSku`,{headers:e.pasteAuthHeader(t.token),params:{sku:t.sku}}),exports.CreateProduct=async(s,t,r)=>s.post(`/seller/shop/${t.shopId}/product/createProduct`,r,{headers:e.pasteAuthHeader(t.token)}),exports.GetProduct=async(s,t)=>s.get(`/seller/shop/${t.shopId}/product`,{params:{productId:t.productId},headers:e.pasteAuthHeader(t.token)}),exports.InvolvedProductsList=async(s,t)=>s.get(`/seller/shop/${t.shopId}/marketing/calendar-event/products-involved`,{params:{eventId:t.eventId,page:t.page,size:t.size},headers:e.pasteAuthHeader(t.token)}),exports.ProductDescription=async(s,t)=>s.get(`/seller/shop/${t.shopId}/product/${t.productId}/description-response`,{headers:e.pasteAuthHeader(t.token)}),exports.ProductsList=async(t,r)=>await t.get(`/seller/shop/${r.shopId}/product/getProducts`,{params:s.ProductListParamsMapper(r),headers:e.pasteAuthHeader(r.token)}),exports.RemovePromotion=(s,t,r)=>s.post(`/seller/shop/${t.shopId}/marketing/calendar-event/remove`,r,{headers:e.pasteAuthHeader(t.token)}),exports.SendSkuData=async(s,t,r)=>s.post(`/seller/shop/${t.shopId}/product/sendSkuData`,r,{headers:e.pasteAuthHeader(t.token)}),exports.UnarchiveProduct=(s,{token:t,shopId:r,skuId:o})=>s.post(`/seller/shop/${r}/product/sku/${o}/archive/restore`,null,{headers:e.pasteAuthHeader(t)});
1
+ "use strict";var e=require("./mappers.js"),s=require("../../../../common/utils.js");exports.AddPromotion=(e,t,r)=>e.post(`/seller/shop/${t.shopId}/marketing/calendar-event/add`,r,{headers:s.pasteAuthHeader(t.token)}),exports.ArchiveProduct=(e,{token:t,shopId:r,skuId:o})=>e.post(`/seller/shop/${r}/product/sku/${o}/archive`,null,{headers:s.pasteAuthHeader(t)}),exports.CheckSkuExists=async(e,t)=>e.get(`/seller/shop/${t.shopId}/product/checkSku`,{headers:s.pasteAuthHeader(t.token),params:{sku:t.sku}}),exports.CreateProduct=async(e,t,r)=>e.post(`/seller/shop/${t.shopId}/product/createProduct`,r,{headers:s.pasteAuthHeader(t.token)}),exports.GetProduct=async(e,t)=>e.get(`/seller/shop/${t.shopId}/product`,{params:{productId:t.productId},headers:s.pasteAuthHeader(t.token)}),exports.InvolvedProductsList=async(e,t)=>e.get(`/seller/shop/${t.shopId}/marketing/calendar-event/products-involved`,{params:{eventId:t.eventId,page:t.page,size:t.size},headers:s.pasteAuthHeader(t.token)}),exports.ProductDescription=async(e,t)=>e.get(`/seller/shop/${t.shopId}/product/${t.productId}/description-response`,{headers:s.pasteAuthHeader(t.token)}),exports.ProductsList=async(t,r)=>await t.get(`/seller/shop/${r.shopId}/product/getProducts`,{params:e.ProductListParamsMapper(r),headers:s.pasteAuthHeader(r.token)}),exports.RemovePromotion=(e,t,r)=>e.post(`/seller/shop/${t.shopId}/marketing/calendar-event/remove`,r,{headers:s.pasteAuthHeader(t.token)}),exports.SendSkuData=async(e,t,r)=>e.post(`/seller/shop/${t.shopId}/product/sendSkuData`,r,{headers:s.pasteAuthHeader(t.token)}),exports.UnarchiveProduct=(e,{token:t,shopId:r,skuId:o})=>e.post(`/seller/shop/${r}/product/sku/${o}/archive/restore`,null,{headers:s.pasteAuthHeader(t)});
@@ -1 +1 @@
1
- "use strict";var e=require("./common/utils.js"),t=require("./core/auth/api.js"),o=require("./core/products/api.js");exports.pasteAuthHeader=e.pasteAuthHeader,exports.CheckToken=t.CheckToken,exports.GetToken=t.GetToken,exports.AddPromotion=o.AddPromotion,exports.ArchiveProduct=o.ArchiveProduct,exports.CheckSkuExists=o.CheckSkuExists,exports.CreateProduct=o.CreateProduct,exports.GetProduct=o.GetProduct,exports.InvolvedProductsList=o.InvolvedProductsList,exports.ProductDescription=o.ProductDescription,exports.ProductsList=o.ProductsList,exports.RemovePromotion=o.RemovePromotion,exports.SendSkuData=o.SendSkuData,exports.UnarchiveProduct=o.UnarchiveProduct;
1
+ "use strict";var o=require("./core/auth/api.js"),t=require("./core/products/api.js");exports.CheckToken=o.CheckToken,exports.GetToken=o.GetToken,exports.AddPromotion=t.AddPromotion,exports.ArchiveProduct=t.ArchiveProduct,exports.CheckSkuExists=t.CheckSkuExists,exports.CreateProduct=t.CreateProduct,exports.GetProduct=t.GetProduct,exports.InvolvedProductsList=t.InvolvedProductsList,exports.ProductDescription=t.ProductDescription,exports.ProductsList=t.ProductsList,exports.RemovePromotion=t.RemovePromotion,exports.SendSkuData=t.SendSkuData,exports.UnarchiveProduct=t.UnarchiveProduct;
@@ -1 +1 @@
1
- export{getNumber}from"./utils.js";
1
+ export{getNumber,pasteAuthHeader,pasteAuthHeaderAndApikey}from"./utils.js";
@@ -1 +1 @@
1
- const r=(r,t=0)=>{if("number"==typeof r)return r;if("string"==typeof r){const e=parseFloat(r);return isNaN(e)?t:e}return t};export{r as getNumber};
1
+ const r=(r,e=0)=>{if("number"==typeof r)return r;if("string"==typeof r){const t=parseFloat(r);return isNaN(t)?e:t}return e},e=r=>({Authorization:`Bearer ${r}`}),t=(r,e="2qHIakuLe5")=>({Authorization:`Bearer ${r}`,apikey:e});export{r as getNumber,e as pasteAuthHeader,t as pasteAuthHeaderAndApikey};
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- export{getNumber}from"./common/utils.js";
1
+ export{getNumber,pasteAuthHeader,pasteAuthHeaderAndApikey}from"./common/utils.js";
@@ -0,0 +1 @@
1
+ import{pasteAuthHeaderAndApikey as a}from"../../../../common/utils.js";const o=async(o,{token:p,...t})=>o.get("/application/applications/applications",{params:t,headers:a(p)});export{o as ApplicationsList};
@@ -0,0 +1 @@
1
+ export{ApplicationsList}from"./api.js";
@@ -1 +1 @@
1
- const e=async(e,n)=>{const o={username:n.username,password:n.password,client_id:"merchant-frontend",grant_type:"password"};return e.post("/merchants/protocol/openid-connect/token",o,{headers:{"content-type":"application/x-www-form-urlencoded"}})};export{e as GetToken};
1
+ const o=async(o,e)=>o.post("/merchants/protocol/openid-connect/token",e,{headers:{"content-type":"application/x-www-form-urlencoded"}});export{o as GetToken};
@@ -1 +1 @@
1
- export{GetToken}from"./auth/api.js";
1
+ export{GetToken}from"./auth/api.js";export{ApplicationsList}from"./applications/api.js";
@@ -1 +1 @@
1
- export{GetToken}from"./core/auth/api.js";
1
+ export{GetToken}from"./core/auth/api.js";export{ApplicationsList}from"./core/applications/api.js";
@@ -1 +1 @@
1
- export{pasteAuthHeader}from"./uzum-market-api/common/utils.js";export{CheckToken,GetToken}from"./uzum-market-api/core/auth/api.js";export{AddPromotion,ArchiveProduct,CheckSkuExists,CreateProduct,GetProduct,InvolvedProductsList,ProductDescription,ProductsList,RemovePromotion,SendSkuData,UnarchiveProduct}from"./uzum-market-api/core/products/api.js";
1
+ export{CheckToken,GetToken}from"./uzum-market-api/core/auth/api.js";export{AddPromotion,ArchiveProduct,CheckSkuExists,CreateProduct,GetProduct,InvolvedProductsList,ProductDescription,ProductsList,RemovePromotion,SendSkuData,UnarchiveProduct}from"./uzum-market-api/core/products/api.js";
@@ -1 +1 @@
1
- const o=o=>({Authorization:`Bearer ${o}`});export{o as pasteAuthHeader};
1
+
@@ -1 +1 @@
1
- const e={"content-type":"application/x-www-form-urlencoded",authorization:"Basic YjJiLWZyb250OmNsaWVudFNlY3JldA=="},a=async(a,s)=>a.post("/oauth/token",{grant_type:"password",username:s.username,password:s.password,referer:""},{headers:e}),s=async(a,s)=>a.post("/auth/seller/check_token",{token:s},{headers:e});export{s as CheckToken,a as GetToken};
1
+ const e={"content-type":"application/x-www-form-urlencoded",authorization:"Basic YjJiLWZyb250OmNsaWVudFNlY3JldA=="},r=async(r,t)=>r.post("/oauth/token",{grant_type:t.grant_type||"password",refresh_token:t.refresh_token,username:t.username,password:t.password,referer:""},{headers:e}),t=async(r,t)=>r.post("/auth/seller/check_token",{token:t},{headers:e});export{t as CheckToken,r as GetToken};
@@ -1 +1 @@
1
- import{pasteAuthHeader as e}from"../../common/utils.js";import{ProductListParamsMapper as s}from"./mappers.js";const o=(s,{token:o,shopId:r,skuId:t})=>s.post(`/seller/shop/${r}/product/sku/${t}/archive`,null,{headers:e(o)}),r=(s,{token:o,shopId:r,skuId:t})=>s.post(`/seller/shop/${r}/product/sku/${t}/archive/restore`,null,{headers:e(o)}),t=async(o,r)=>await o.get(`/seller/shop/${r.shopId}/product/getProducts`,{params:s(r),headers:e(r.token)}),p=(s,o,r)=>s.post(`/seller/shop/${o.shopId}/marketing/calendar-event/remove`,r,{headers:e(o.token)}),d=(s,o,r)=>s.post(`/seller/shop/${o.shopId}/marketing/calendar-event/add`,r,{headers:e(o.token)}),a=async(s,o)=>s.get(`/seller/shop/${o.shopId}/marketing/calendar-event/products-involved`,{params:{eventId:o.eventId,page:o.page,size:o.size},headers:e(o.token)}),n=async(s,o)=>s.get(`/seller/shop/${o.shopId}/product/${o.productId}/description-response`,{headers:e(o.token)}),h=async(s,o)=>s.get(`/seller/shop/${o.shopId}/product/checkSku`,{headers:e(o.token),params:{sku:o.sku}}),c=async(s,o,r)=>s.post(`/seller/shop/${o.shopId}/product/createProduct`,r,{headers:e(o.token)}),l=async(s,o)=>s.get(`/seller/shop/${o.shopId}/product`,{params:{productId:o.productId},headers:e(o.token)}),u=async(s,o,r)=>s.post(`/seller/shop/${o.shopId}/product/sendSkuData`,r,{headers:e(o.token)});export{d as AddPromotion,o as ArchiveProduct,h as CheckSkuExists,c as CreateProduct,l as GetProduct,a as InvolvedProductsList,n as ProductDescription,t as ProductsList,p as RemovePromotion,u as SendSkuData,r as UnarchiveProduct};
1
+ import{ProductListParamsMapper as e}from"./mappers.js";import{pasteAuthHeader as s}from"../../../../common/utils.js";const o=(e,{token:o,shopId:r,skuId:t})=>e.post(`/seller/shop/${r}/product/sku/${t}/archive`,null,{headers:s(o)}),r=(e,{token:o,shopId:r,skuId:t})=>e.post(`/seller/shop/${r}/product/sku/${t}/archive/restore`,null,{headers:s(o)}),t=async(o,r)=>await o.get(`/seller/shop/${r.shopId}/product/getProducts`,{params:e(r),headers:s(r.token)}),p=(e,o,r)=>e.post(`/seller/shop/${o.shopId}/marketing/calendar-event/remove`,r,{headers:s(o.token)}),d=(e,o,r)=>e.post(`/seller/shop/${o.shopId}/marketing/calendar-event/add`,r,{headers:s(o.token)}),a=async(e,o)=>e.get(`/seller/shop/${o.shopId}/marketing/calendar-event/products-involved`,{params:{eventId:o.eventId,page:o.page,size:o.size},headers:s(o.token)}),n=async(e,o)=>e.get(`/seller/shop/${o.shopId}/product/${o.productId}/description-response`,{headers:s(o.token)}),h=async(e,o)=>e.get(`/seller/shop/${o.shopId}/product/checkSku`,{headers:s(o.token),params:{sku:o.sku}}),c=async(e,o,r)=>e.post(`/seller/shop/${o.shopId}/product/createProduct`,r,{headers:s(o.token)}),l=async(e,o)=>e.get(`/seller/shop/${o.shopId}/product`,{params:{productId:o.productId},headers:s(o.token)}),u=async(e,o,r)=>e.post(`/seller/shop/${o.shopId}/product/sendSkuData`,r,{headers:s(o.token)});export{d as AddPromotion,o as ArchiveProduct,h as CheckSkuExists,c as CreateProduct,l as GetProduct,a as InvolvedProductsList,n as ProductDescription,t as ProductsList,p as RemovePromotion,u as SendSkuData,r as UnarchiveProduct};
@@ -1 +1 @@
1
- export{pasteAuthHeader}from"./common/utils.js";export{CheckToken,GetToken}from"./core/auth/api.js";export{AddPromotion,ArchiveProduct,CheckSkuExists,CreateProduct,GetProduct,InvolvedProductsList,ProductDescription,ProductsList,RemovePromotion,SendSkuData,UnarchiveProduct}from"./core/products/api.js";
1
+ export{CheckToken,GetToken}from"./core/auth/api.js";export{AddPromotion,ArchiveProduct,CheckSkuExists,CreateProduct,GetProduct,InvolvedProductsList,ProductDescription,ProductsList,RemovePromotion,SendSkuData,UnarchiveProduct}from"./core/products/api.js";
@@ -1,5 +1,5 @@
1
- export { BooleanNullable, CallerNoParam, CallerParam, CallerParamPayload, CallerPayload, NumberNullable, StringNullable } from './types.js';
2
- export { getNumber } from './utils.js';
1
+ export { BooleanNullable, CallerNoParam, CallerParam, CallerParamPayload, CallerPayload, NumberNullable, NumberRange, StringNullable } from './types.js';
2
+ export { getNumber, pasteAuthHeader, pasteAuthHeaderAndApikey } from './utils.js';
3
3
  export { UsernamePasswordParams } from './params.js';
4
4
  export { IMultiLang, IMultiLangArray } from './interfaces.js';
5
5
  import 'axios';
@@ -7,5 +7,6 @@ type CallerParamPayload<R, S, T = any> = (uzumHttp: AxiosInstance, params: R, pa
7
7
  type StringNullable = string | null;
8
8
  type NumberNullable = number | null;
9
9
  type BooleanNullable = boolean | null;
10
+ type NumberRange<From extends number, To extends number, Acc extends number[] = [], Result extends number[] = []> = Acc["length"] extends To ? [...Result, To][number] : Acc["length"] extends From ? NumberRange<From, To, [...Acc, 1], [Acc["length"]]> : Result extends [] ? NumberRange<From, To, [...Acc, 1], []> : NumberRange<From, To, [...Acc, 1], [...Result, Acc["length"]]>;
10
11
 
11
- export type { BooleanNullable, CallerNoParam, CallerParam, CallerParamPayload, CallerPayload, NumberNullable, StringNullable };
12
+ export type { BooleanNullable, CallerNoParam, CallerParam, CallerParamPayload, CallerPayload, NumberNullable, NumberRange, StringNullable };
@@ -1,3 +1,10 @@
1
1
  declare const getNumber: (value: unknown, defaultValue?: number) => number;
2
+ declare const pasteAuthHeader: (token: string) => {
3
+ Authorization: string;
4
+ };
5
+ declare const pasteAuthHeaderAndApikey: (token: string, apikey?: string) => {
6
+ Authorization: string;
7
+ apikey: string;
8
+ };
2
9
 
3
- export { getNumber };
10
+ export { getNumber, pasteAuthHeader, pasteAuthHeaderAndApikey };
@@ -1,5 +1,5 @@
1
- export { BooleanNullable, CallerNoParam, CallerParam, CallerParamPayload, CallerPayload, NumberNullable, StringNullable } from './common/types.js';
2
- export { getNumber } from './common/utils.js';
1
+ export { BooleanNullable, CallerNoParam, CallerParam, CallerParamPayload, CallerPayload, NumberNullable, NumberRange, StringNullable } from './common/types.js';
2
+ export { getNumber, pasteAuthHeader, pasteAuthHeaderAndApikey } from './common/utils.js';
3
3
  export { UsernamePasswordParams } from './common/params.js';
4
4
  export { IMultiLang, IMultiLangArray } from './common/interfaces.js';
5
5
  import 'axios';
@@ -1,2 +1,20 @@
1
+ interface IMeta {
2
+ current_page: number;
3
+ from: number;
4
+ path: string;
5
+ per_page: number;
6
+ to: number;
7
+ }
8
+ interface ILinks {
9
+ first: string;
10
+ last: string | null;
11
+ prev: string | null;
12
+ next: string | null;
13
+ }
14
+ interface IPaginatedResponse<T> {
15
+ data: T;
16
+ meta: IMeta;
17
+ links: ILinks;
18
+ }
1
19
 
2
- export { };
20
+ export type { ILinks, IMeta, IPaginatedResponse };
@@ -0,0 +1,9 @@
1
+ import { CallerParam } from '../../../../common/types.js';
2
+ import { ApplicationsApi } from './types.js';
3
+ import { ApplicationsParams } from './params.js';
4
+ import 'axios';
5
+ import '../../common/interfaces.js';
6
+
7
+ declare const ApplicationsList: CallerParam<ApplicationsParams, ApplicationsApi.List.Response>;
8
+
9
+ export { ApplicationsList };
@@ -0,0 +1,6 @@
1
+ export { ApplicationsList } from './api.js';
2
+ import '../../../../common/types.js';
3
+ import 'axios';
4
+ import './types.js';
5
+ import '../../common/interfaces.js';
6
+ import './params.js';
@@ -0,0 +1,22 @@
1
+ import { NumberRange } from '../../../../common/types.js';
2
+ import { ApplicationsEntity } from './types.js';
3
+ import 'axios';
4
+ import '../../common/interfaces.js';
5
+
6
+ interface TokenParams {
7
+ token: string;
8
+ }
9
+ interface ApplicationsParams extends TokenParams {
10
+ page: number;
11
+ q?: string;
12
+ date?: string;
13
+ is_delivery?: NumberRange<0, 1>;
14
+ reject_reason?: NumberRange<1, 16>;
15
+ contract_uploaded?: NumberRange<0, 1>;
16
+ cancel_reason?: NumberRange<1, 10>;
17
+ created_from_str?: ApplicationsEntity.Sources | (string & {});
18
+ search_param: "phone" | "fio" | "passport" | "pinfl" | "application_id" | (string & {});
19
+ status_key: ApplicationsEntity.Statuses | (string & {});
20
+ }
21
+
22
+ export type { ApplicationsParams, TokenParams };
@@ -0,0 +1,70 @@
1
+ import { IPaginatedResponse } from '../../common/interfaces.js';
2
+
3
+ declare namespace ApplicationsEntity {
4
+ type Sources = "MERCHANT" | "MERCHANT_MOBILE" | "ALIFSHOP" | "ALIFSHOP_MOBILE" | "ALIFMOBI" | "ALIFSHOP_MINI_APP" | "ONLINE" | "E-COMMERCE" | "COMPLIANCE";
5
+ type Statuses = "NEW" | "REVIEWING" | "APPROVED" | "REJECTED" | "COMPLETED" | "CANCELLED" | "DELETED" | "TO_DELIVERY";
6
+ interface ApplicationStatus {
7
+ id: number;
8
+ key: "APPROVED";
9
+ title_ru: string;
10
+ body: string;
11
+ class: string;
12
+ order: number;
13
+ }
14
+ interface ApplicationClient {
15
+ id: number;
16
+ name: string;
17
+ surname: string;
18
+ patronymic: string;
19
+ phone: string;
20
+ client_status_key: "IDENTIFIED";
21
+ }
22
+ interface Application {
23
+ amount: number;
24
+ application_condition_id: number;
25
+ application_status: ApplicationsEntity.ApplicationStatus;
26
+ application_status_key: ApplicationsEntity.Statuses;
27
+ auto: boolean;
28
+ auto_review: boolean;
29
+ cancel_reason: number | null;
30
+ client: ApplicationsEntity.ApplicationClient;
31
+ client_id: number;
32
+ commission: number;
33
+ created_at: string;
34
+ created_by_id: number;
35
+ created_from_str: string;
36
+ down_payment_amount: number;
37
+ down_payment_hold: null;
38
+ duration: number;
39
+ engaged_at: null;
40
+ engaged_by_id: null;
41
+ extra_days: number;
42
+ file_id: null;
43
+ first_payment_date: string | null;
44
+ hidden: boolean;
45
+ invoice_id: null;
46
+ id: number;
47
+ merchant_engaged_at: string;
48
+ merchant_engaged_by_str: string;
49
+ merchant_engaged_by_id: number;
50
+ merchant_id: number;
51
+ merchant_note: null;
52
+ note: null;
53
+ prepayment: number;
54
+ reject_reason: null;
55
+ status_updated_at: string;
56
+ store_id: number;
57
+ type: "full";
58
+ updated_at: string;
59
+ updated_by_id: 1;
60
+ updated_from_str: "CRM" | "CREDITS" | (string & {});
61
+ confirmed_by_merchant: false;
62
+ }
63
+ }
64
+ declare namespace ApplicationsApi {
65
+ namespace List {
66
+ type Response = IPaginatedResponse<ApplicationsEntity.Application[]>;
67
+ }
68
+ }
69
+
70
+ export { ApplicationsApi, ApplicationsEntity };
@@ -1,8 +1,8 @@
1
1
  import { CallerPayload } from '../../../../common/types.js';
2
- import { UsernamePasswordParams } from '../../../../common/params.js';
3
2
  import { IAuth } from './types.js';
4
3
  import 'axios';
4
+ import '../../../../common/params.js';
5
5
 
6
- declare const GetToken: CallerPayload<UsernamePasswordParams, IAuth.GetToken.Response>;
6
+ declare const GetToken: CallerPayload<IAuth.GetToken.Request, IAuth.GetToken.Response>;
7
7
 
8
8
  export { GetToken };
@@ -1,5 +1,5 @@
1
1
  export { GetToken } from './api.js';
2
2
  import '../../../../common/types.js';
3
3
  import 'axios';
4
- import '../../../../common/params.js';
5
4
  import './types.js';
5
+ import '../../../../common/params.js';
@@ -1,11 +1,17 @@
1
+ import { UsernamePasswordParams } from '../../../../common/params.js';
2
+
1
3
  declare namespace IAuth {
2
4
  namespace GetToken {
5
+ interface Request extends UsernamePasswordParams {
6
+ client_id: "merchant-frontend" | (string & {});
7
+ grant_type: "password" | "refresh_token" | (string & {});
8
+ }
3
9
  interface Response {
4
10
  access_token: string;
5
11
  expires_in: number;
6
12
  refresh_expires_in: number;
7
13
  refresh_token: string;
8
- token_type: "Bearer" & (string & {});
14
+ token_type: "Bearer" | (string & {});
9
15
  "not-before-policy": number;
10
16
  session_state: string;
11
17
  scope: string;
@@ -1,5 +1,9 @@
1
1
  export { GetToken } from './auth/api.js';
2
+ export { ApplicationsList } from './applications/api.js';
2
3
  import '../../../common/types.js';
3
4
  import 'axios';
4
- import '../../../common/params.js';
5
5
  import './auth/types.js';
6
+ import '../../../common/params.js';
7
+ import './applications/types.js';
8
+ import '../common/interfaces.js';
9
+ import './applications/params.js';
@@ -1,5 +1,9 @@
1
1
  export { GetToken } from './core/auth/api.js';
2
+ export { ApplicationsList } from './core/applications/api.js';
2
3
  import '../../common/types.js';
3
4
  import 'axios';
4
- import '../../common/params.js';
5
5
  import './core/auth/types.js';
6
+ import '../../common/params.js';
7
+ import './core/applications/types.js';
8
+ import './common/interfaces.js';
9
+ import './core/applications/params.js';
@@ -1,11 +1,11 @@
1
- export { pasteAuthHeader } from './uzum-market-api/common/utils.js';
2
1
  export { CheckToken, GetToken } from './uzum-market-api/core/auth/api.js';
3
2
  export { AddPromotion, ArchiveProduct, CheckSkuExists, CreateProduct, GetProduct, InvolvedProductsList, ProductDescription, ProductsList, RemovePromotion, SendSkuData, UnarchiveProduct } from './uzum-market-api/core/products/api.js';
4
3
  import '../common/types.js';
5
4
  import 'axios';
6
- import '../common/params.js';
7
5
  import './uzum-market-api/core/auth/types.js';
8
6
  import './uzum-market-api/core/auth/enums.js';
7
+ import './uzum-market-api/core/auth/params.js';
8
+ import '../common/params.js';
9
9
  import './uzum-market-api/core/products/types.js';
10
10
  import './uzum-market-api/core/types.js';
11
11
  import './uzum-market-api/common/interfaces.js';
@@ -1,3 +1,3 @@
1
- type ProductStatuses = "READY_TO_SEND" | "ARCHIVED" | "IN_STOCK" | ("RUN_OUT" & (string & {}));
1
+ type ProductStatuses = "READY_TO_SEND" | "ARCHIVED" | "IN_STOCK" | "RUN_OUT" | (string & {});
2
2
 
3
3
  export type { ProductStatuses };
@@ -1,5 +1,2 @@
1
- declare const pasteAuthHeader: (token: string) => {
2
- Authorization: string;
3
- };
4
1
 
5
- export { pasteAuthHeader };
2
+ export { };
@@ -1,10 +1,11 @@
1
1
  import { CallerParam } from '../../../../common/types.js';
2
- import { UsernamePasswordParams } from '../../../../common/params.js';
3
2
  import { AuthApi } from './types.js';
3
+ import { TokenParams } from './params.js';
4
4
  import 'axios';
5
5
  import './enums.js';
6
+ import '../../../../common/params.js';
6
7
 
7
- declare const GetToken: CallerParam<UsernamePasswordParams, AuthApi.GetToken.Response>;
8
+ declare const GetToken: CallerParam<TokenParams, AuthApi.GetToken.Response>;
8
9
  declare const CheckToken: CallerParam<string, AuthApi.CheckToken.Response>;
9
10
 
10
11
  export { CheckToken, GetToken };
@@ -1,6 +1,7 @@
1
1
  export { CheckToken, GetToken } from './api.js';
2
2
  import '../../../../common/types.js';
3
3
  import 'axios';
4
- import '../../../../common/params.js';
5
4
  import './types.js';
6
5
  import './enums.js';
6
+ import './params.js';
7
+ import '../../../../common/params.js';
@@ -1,2 +1,8 @@
1
+ import { UsernamePasswordParams } from '../../../../common/params.js';
1
2
 
2
- export { };
3
+ interface TokenParams extends UsernamePasswordParams {
4
+ grant_type?: "password" | "refresh_token";
5
+ refresh_token?: string;
6
+ }
7
+
8
+ export type { TokenParams };
@@ -2,9 +2,10 @@ export { CheckToken, GetToken } from './auth/api.js';
2
2
  export { AddPromotion, ArchiveProduct, CheckSkuExists, CreateProduct, GetProduct, InvolvedProductsList, ProductDescription, ProductsList, RemovePromotion, SendSkuData, UnarchiveProduct } from './products/api.js';
3
3
  import '../../../common/types.js';
4
4
  import 'axios';
5
- import '../../../common/params.js';
6
5
  import './auth/types.js';
7
6
  import './auth/enums.js';
7
+ import './auth/params.js';
8
+ import '../../../common/params.js';
8
9
  import './products/types.js';
9
10
  import './types.js';
10
11
  import '../common/interfaces.js';
@@ -2,8 +2,8 @@ import { ProductListParams } from './params.js';
2
2
 
3
3
  declare const ProductListParamsMapper: (params: ProductListParams) => {
4
4
  searchQuery: string;
5
- filter: "ALL";
6
- sortBy: "id";
5
+ filter: "ALL" | (string & {});
6
+ sortBy: (string & {}) | "id";
7
7
  order: "ascending" | "descending";
8
8
  size: number;
9
9
  page: number;
@@ -17,8 +17,8 @@ interface SkuBasedParams extends TokenAndShopId {
17
17
  }
18
18
  type ProductListParams = TokenAndShopId & CorePaginationParams & {
19
19
  searchQuery?: string;
20
- filter: "ALL" & (string & {});
21
- sortBy: "id" & (string & {});
20
+ filter: "ALL" | (string & {});
21
+ sortBy: "id" | (string & {});
22
22
  order: "ascending" | "descending";
23
23
  };
24
24
  type InvolvedProductsParams = TokenAndShopId & CorePaginationParams & {
@@ -1,11 +1,11 @@
1
- export { pasteAuthHeader } from './common/utils.js';
2
1
  export { CheckToken, GetToken } from './core/auth/api.js';
3
2
  export { AddPromotion, ArchiveProduct, CheckSkuExists, CreateProduct, GetProduct, InvolvedProductsList, ProductDescription, ProductsList, RemovePromotion, SendSkuData, UnarchiveProduct } from './core/products/api.js';
4
3
  import '../../common/types.js';
5
4
  import 'axios';
6
- import '../../common/params.js';
7
5
  import './core/auth/types.js';
8
6
  import './core/auth/enums.js';
7
+ import './core/auth/params.js';
8
+ import '../../common/params.js';
9
9
  import './core/products/types.js';
10
10
  import './core/types.js';
11
11
  import './common/interfaces.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plaza-sdk",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "outputDir": "./lib",
5
5
  "exports": {
6
6
  ".": {
@@ -54,6 +54,7 @@
54
54
  "@rollup/plugin-commonjs": "^28.0.6",
55
55
  "@rollup/plugin-json": "^6.1.0",
56
56
  "@rollup/plugin-node-resolve": "^16.0.1",
57
+ "@rollup/plugin-terser": "^0.4.4",
57
58
  "@rollup/plugin-typescript": "^12.1.4",
58
59
  "@types/lodash": "^4.17.20",
59
60
  "@typescript-eslint/parser": "^8.38.0",
@@ -67,7 +68,6 @@
67
68
  "rollup": "^4.46.2",
68
69
  "rollup-plugin-dts": "^6.2.1",
69
70
  "rollup-plugin-peer-deps-external": "^2.2.4",
70
- "rollup-plugin-terser": "^7.0.2",
71
71
  "rollup-plugin-tsconfig-paths": "^1.5.2",
72
72
  "tslib": "^2.8.1",
73
73
  "typescript": "5.8.3",