plaza-sdk 1.1.1 → 1.1.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.
- package/README.md +52 -5
- package/lib/browser/bundle.iife.js +1 -1
- package/lib/browser/bundle.umd.js +1 -1
- package/lib/cjs/common/index.js +1 -1
- package/lib/cjs/common/utils.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/modules/alif-shop-api/core/applications/api.js +1 -0
- package/lib/cjs/modules/alif-shop-api/core/applications/constants.js +1 -0
- package/lib/cjs/modules/alif-shop-api/core/applications/index.js +1 -0
- package/lib/cjs/modules/alif-shop-api/core/applications/params.js +1 -0
- package/lib/cjs/modules/alif-shop-api/core/applications/types.js +1 -0
- package/lib/cjs/modules/alif-shop-api/core/auth/api.js +1 -1
- package/lib/cjs/modules/alif-shop-api/core/index.js +1 -1
- package/lib/cjs/modules/alif-shop-api/index.js +1 -1
- package/lib/cjs/modules/index.js +1 -1
- package/lib/cjs/modules/uzum-market-api/common/utils.js +1 -1
- package/lib/cjs/modules/uzum-market-api/core/products/api.js +1 -1
- package/lib/cjs/modules/uzum-market-api/index.js +1 -1
- package/lib/esm/common/index.js +1 -1
- package/lib/esm/common/utils.js +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/modules/alif-shop-api/core/applications/api.js +1 -0
- package/lib/esm/modules/alif-shop-api/core/applications/constants.js +1 -0
- package/lib/esm/modules/alif-shop-api/core/applications/index.js +1 -0
- package/lib/esm/modules/alif-shop-api/core/applications/params.js +1 -0
- package/lib/esm/modules/alif-shop-api/core/applications/types.js +1 -0
- package/lib/esm/modules/alif-shop-api/core/auth/api.js +1 -1
- package/lib/esm/modules/alif-shop-api/core/index.js +1 -1
- package/lib/esm/modules/alif-shop-api/index.js +1 -1
- package/lib/esm/modules/index.js +1 -1
- package/lib/esm/modules/uzum-market-api/common/utils.js +1 -1
- package/lib/esm/modules/uzum-market-api/core/products/api.js +1 -1
- package/lib/esm/modules/uzum-market-api/index.js +1 -1
- package/lib/types/src/common/index.d.ts +2 -2
- package/lib/types/src/common/types.d.ts +2 -1
- package/lib/types/src/common/utils.d.ts +8 -1
- package/lib/types/src/index.d.ts +2 -2
- package/lib/types/src/modules/alif-shop-api/common/interfaces.d.ts +19 -1
- package/lib/types/src/modules/alif-shop-api/core/applications/api.d.ts +9 -0
- package/lib/types/src/modules/alif-shop-api/core/applications/constants.d.ts +2 -0
- package/lib/types/src/modules/alif-shop-api/core/applications/index.d.ts +6 -0
- package/lib/types/src/modules/alif-shop-api/core/applications/params.d.ts +22 -0
- package/lib/types/src/modules/alif-shop-api/core/applications/types.d.ts +70 -0
- package/lib/types/src/modules/alif-shop-api/core/auth/api.d.ts +2 -2
- package/lib/types/src/modules/alif-shop-api/core/auth/index.d.ts +1 -1
- package/lib/types/src/modules/alif-shop-api/core/auth/types.d.ts +7 -1
- package/lib/types/src/modules/alif-shop-api/core/index.d.ts +5 -1
- package/lib/types/src/modules/alif-shop-api/index.d.ts +5 -1
- package/lib/types/src/modules/index.d.ts +0 -1
- package/lib/types/src/modules/uzum-market-api/common/types.d.ts +1 -1
- package/lib/types/src/modules/uzum-market-api/common/utils.d.ts +1 -4
- package/lib/types/src/modules/uzum-market-api/core/products/mappers.d.ts +2 -2
- package/lib/types/src/modules/uzum-market-api/core/products/params.d.ts +2 -2
- package/lib/types/src/modules/uzum-market-api/index.d.ts +0 -1
- package/package.json +5 -3
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
|
-
|
|
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({
|
|
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(
|
|
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
|
|
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})});
|
package/lib/cjs/common/index.js
CHANGED
|
@@ -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;
|
package/lib/cjs/common/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.getNumber=(r
|
|
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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var i=require("./api.js");exports.ApplicationsList=i.ApplicationsList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.GetToken=async(e,
|
|
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
|
|
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;
|
package/lib/cjs/modules/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
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";
|
|
1
|
+
"use strict";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("
|
|
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
|
|
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;
|
package/lib/esm/common/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{getNumber}from"./utils.js";
|
|
1
|
+
export{getNumber,pasteAuthHeader,pasteAuthHeaderAndApikey}from"./utils.js";
|
package/lib/esm/common/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const r=(r,
|
|
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
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ApplicationsList}from"./api.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
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";
|
package/lib/esm/modules/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
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
|
-
|
|
1
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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{
|
|
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 };
|
package/lib/types/src/index.d.ts
CHANGED
|
@@ -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,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<
|
|
6
|
+
declare const GetToken: CallerPayload<IAuth.GetToken.Request, IAuth.GetToken.Response>;
|
|
7
7
|
|
|
8
8
|
export { GetToken };
|
|
@@ -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"
|
|
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,4 +1,3 @@
|
|
|
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';
|
|
@@ -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"
|
|
21
|
-
sortBy: "id"
|
|
20
|
+
filter: "ALL" | (string & {});
|
|
21
|
+
sortBy: "id" | (string & {});
|
|
22
22
|
order: "ascending" | "descending";
|
|
23
23
|
};
|
|
24
24
|
type InvolvedProductsParams = TokenAndShopId & CorePaginationParams & {
|
|
@@ -1,4 +1,3 @@
|
|
|
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';
|
package/package.json
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plaza-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"outputDir": "./lib",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
|
+
"types": "./lib/types/src/index.d.ts",
|
|
7
8
|
"import": "./lib/esm/index.js",
|
|
8
9
|
"require": "./lib/cjs/index.js"
|
|
9
10
|
},
|
|
10
11
|
"./uzum-market": {
|
|
12
|
+
"types": "./lib/types/src/modules/uzum-market-api/index.d.ts",
|
|
11
13
|
"import": "./lib/esm/modules/uzum-market-api/index.js",
|
|
12
14
|
"require": "./lib/cjs/modules/uzum-market-api/index.js"
|
|
13
15
|
},
|
|
14
16
|
"./alif-shop": {
|
|
17
|
+
"types": "./lib/types/src/modules/alif-shop-api/index.d.ts",
|
|
15
18
|
"import": "./lib/esm/modules/alif-shop-api/index.js",
|
|
16
19
|
"require": "./lib/cjs/modules/alif-shop-api/index.js"
|
|
17
20
|
}
|
|
18
21
|
},
|
|
19
|
-
"types": "./lib/types/src/index.d.ts",
|
|
20
22
|
"main": "lib/cjs/index.js",
|
|
21
23
|
"module": "lib/esm/index.js",
|
|
22
24
|
"files": [
|
|
@@ -52,6 +54,7 @@
|
|
|
52
54
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
53
55
|
"@rollup/plugin-json": "^6.1.0",
|
|
54
56
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
57
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
55
58
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
56
59
|
"@types/lodash": "^4.17.20",
|
|
57
60
|
"@typescript-eslint/parser": "^8.38.0",
|
|
@@ -65,7 +68,6 @@
|
|
|
65
68
|
"rollup": "^4.46.2",
|
|
66
69
|
"rollup-plugin-dts": "^6.2.1",
|
|
67
70
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
68
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
69
71
|
"rollup-plugin-tsconfig-paths": "^1.5.2",
|
|
70
72
|
"tslib": "^2.8.1",
|
|
71
73
|
"typescript": "5.8.3",
|