@blob-solutions/vcr-am-sdk 0.6.0 → 0.7.0
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/lib/index.cjs +1 -1
- package/lib/index.d.cts +5 -6
- package/lib/index.d.ts +5 -6
- package/lib/index.global.js +7 -7
- package/lib/index.global.js.map +1 -1
- package/package.json +7 -7
package/lib/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var p=Object.defineProperty;var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var m=(a,e)=>{for(var s in e)p(a,s,{get:e[s],enumerable:!0})},f=(a,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of d(e))!g.call(a,n)&&n!==s&&p(a,n,{get:()=>e[n],enumerable:!(o=l(e,n))||o.enumerable});return a};var A=a=>f(p({},"__esModule",{value:!0}),a);var b={};m(b,{AVAILABLE_LANGUAGES:()=>I,VCRClient:()=>r,unitsKeys:()=>h});module.exports=A(b);var i=require("simple-typed-fetch"),t=require("zod"),u="https://vcr.am/api/v1",D=t.z.object({urlId:t.z.string(),saleId:t.z.number(),crn:t.z.string(),srcReceiptId:t.z.number().int(),fiscal:t.z.string()}),y=t.z.object({error:t.z.string()}),r=class{constructor(e){this.apiKey=e}async registerSale(e){return await(0,i.simpleFetch)(async()=>await(0,i.fetchWithValidation)(`${u}/sales`,D,{method:"POST",headers:{"x-api-key":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)},y))()}async searchClassifierCategory(e,s,o){let n=new URL(`${u}/searchClassifier`);return n.searchParams.append("query",e),n.searchParams.append("type",s),n.searchParams.append("language",o),await(0,i.simpleFetch)(async()=>await(0,i.fetchWithValidation)(n.toString(),t.z.array(t.z.object({code:t.z.string(),title:t.z.string()})),{method:"GET",headers:{"x-api-key":this.apiKey,"Content-Type":"application/json"}},y))()}};var h=["pc","unit","set","box","pack","case","hr","sess","proj","sub","kg","l","m","g","ml","cm","bottle","can","jar","bag","m2","dozen","pair","mm","roll","tube","km","ton","m3","pallet","other"],I=["hy","ru","en"];
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/lib/index.d.cts
CHANGED
|
@@ -50,22 +50,21 @@ type OfferTitle = {
|
|
|
50
50
|
type: "universal";
|
|
51
51
|
content: string;
|
|
52
52
|
};
|
|
53
|
+
type DepartmentInput = {
|
|
54
|
+
id: number;
|
|
55
|
+
};
|
|
53
56
|
type NewOffer = {
|
|
54
57
|
title: OfferTitle;
|
|
55
58
|
type: "product" | "service";
|
|
56
59
|
classifierCode: string;
|
|
57
60
|
defaultMeasureUnit: Unit;
|
|
58
|
-
defaultDepartment:
|
|
59
|
-
internalId: number;
|
|
60
|
-
};
|
|
61
|
+
defaultDepartment: DepartmentInput;
|
|
61
62
|
externalId: string;
|
|
62
63
|
};
|
|
63
64
|
type Offer = NewOffer | ExistingOffer;
|
|
64
65
|
type SaleItem = {
|
|
65
66
|
offer: Offer;
|
|
66
|
-
department:
|
|
67
|
-
internalId: number;
|
|
68
|
-
};
|
|
67
|
+
department: DepartmentInput;
|
|
69
68
|
quantity: string;
|
|
70
69
|
price: string;
|
|
71
70
|
unit: Unit;
|
package/lib/index.d.ts
CHANGED
|
@@ -50,22 +50,21 @@ type OfferTitle = {
|
|
|
50
50
|
type: "universal";
|
|
51
51
|
content: string;
|
|
52
52
|
};
|
|
53
|
+
type DepartmentInput = {
|
|
54
|
+
id: number;
|
|
55
|
+
};
|
|
53
56
|
type NewOffer = {
|
|
54
57
|
title: OfferTitle;
|
|
55
58
|
type: "product" | "service";
|
|
56
59
|
classifierCode: string;
|
|
57
60
|
defaultMeasureUnit: Unit;
|
|
58
|
-
defaultDepartment:
|
|
59
|
-
internalId: number;
|
|
60
|
-
};
|
|
61
|
+
defaultDepartment: DepartmentInput;
|
|
61
62
|
externalId: string;
|
|
62
63
|
};
|
|
63
64
|
type Offer = NewOffer | ExistingOffer;
|
|
64
65
|
type SaleItem = {
|
|
65
66
|
offer: Offer;
|
|
66
|
-
department:
|
|
67
|
-
internalId: number;
|
|
68
|
-
};
|
|
67
|
+
department: DepartmentInput;
|
|
69
68
|
quantity: string;
|
|
70
69
|
price: string;
|
|
71
70
|
unit: Unit;
|