@proveanything/smartlinks 1.8.11 → 1.9.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/dist/api/facets.d.ts +26 -0
- package/dist/api/facets.js +106 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +3 -0
- package/dist/api/loyalty.d.ts +65 -0
- package/dist/api/loyalty.js +139 -0
- package/dist/api/product.d.ts +52 -3
- package/dist/api/product.js +103 -0
- package/dist/api/products.d.ts +21 -0
- package/dist/api/products.js +114 -0
- package/dist/docs/API_SUMMARY.md +770 -31
- package/dist/docs/PRODUCT_FACETS_SDK.md +347 -0
- package/dist/docs/loyalty.md +333 -0
- package/dist/http.d.ts +2 -1
- package/dist/http.js +3 -2
- package/dist/iframeResponder.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/openapi.yaml +5234 -2401
- package/dist/types/facets.d.ts +126 -0
- package/dist/types/facets.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/loyalty.d.ts +145 -0
- package/dist/types/loyalty.js +2 -0
- package/dist/types/product.d.ts +161 -48
- package/dist/utils/paths.js +3 -2
- package/docs/API_SUMMARY.md +770 -31
- package/docs/PRODUCT_FACETS_SDK.md +347 -0
- package/docs/loyalty.md +333 -0
- package/openapi.yaml +5234 -2401
- package/package.json +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { del, post, put, request } from "../http";
|
|
2
|
+
function buildQueryString(params) {
|
|
3
|
+
if (!params)
|
|
4
|
+
return '';
|
|
5
|
+
const searchParams = new URLSearchParams();
|
|
6
|
+
for (const [key, value] of Object.entries(params)) {
|
|
7
|
+
if (value === undefined || value === null)
|
|
8
|
+
continue;
|
|
9
|
+
if (Array.isArray(value)) {
|
|
10
|
+
for (const item of value) {
|
|
11
|
+
searchParams.append(key, String(item));
|
|
12
|
+
}
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
searchParams.set(key, String(value));
|
|
16
|
+
}
|
|
17
|
+
const query = searchParams.toString();
|
|
18
|
+
return query ? `?${query}` : '';
|
|
19
|
+
}
|
|
20
|
+
export var products;
|
|
21
|
+
(function (products) {
|
|
22
|
+
async function get(collectionId, productId, admin) {
|
|
23
|
+
const base = admin ? '/admin' : '/public';
|
|
24
|
+
const path = `${base}/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}`;
|
|
25
|
+
return request(path);
|
|
26
|
+
}
|
|
27
|
+
products.get = get;
|
|
28
|
+
async function list(collectionId, admin) {
|
|
29
|
+
const base = admin ? '/admin' : '/public';
|
|
30
|
+
const path = `${base}/collection/${encodeURIComponent(collectionId)}/products`;
|
|
31
|
+
return request(path);
|
|
32
|
+
}
|
|
33
|
+
products.list = list;
|
|
34
|
+
async function create(collectionId, data) {
|
|
35
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/products`;
|
|
36
|
+
return post(path, data);
|
|
37
|
+
}
|
|
38
|
+
products.create = create;
|
|
39
|
+
async function update(collectionId, productId, data) {
|
|
40
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}`;
|
|
41
|
+
return put(path, data);
|
|
42
|
+
}
|
|
43
|
+
products.update = update;
|
|
44
|
+
async function remove(collectionId, productId) {
|
|
45
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}`;
|
|
46
|
+
return del(path);
|
|
47
|
+
}
|
|
48
|
+
products.remove = remove;
|
|
49
|
+
async function query(collectionId, body) {
|
|
50
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/query`;
|
|
51
|
+
return post(path, body);
|
|
52
|
+
}
|
|
53
|
+
products.query = query;
|
|
54
|
+
async function find(collectionId, body) {
|
|
55
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/find`;
|
|
56
|
+
return post(path, body);
|
|
57
|
+
}
|
|
58
|
+
products.find = find;
|
|
59
|
+
async function publicFind(collectionId, params) {
|
|
60
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/products/find${buildQueryString(params)}`;
|
|
61
|
+
return request(path);
|
|
62
|
+
}
|
|
63
|
+
products.publicFind = publicFind;
|
|
64
|
+
async function clone(collectionId, productId, body = {}) {
|
|
65
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}/clone`;
|
|
66
|
+
return post(path, body);
|
|
67
|
+
}
|
|
68
|
+
products.clone = clone;
|
|
69
|
+
async function listAssets(collectionId, productId, admin) {
|
|
70
|
+
const base = admin ? '/admin' : '/public';
|
|
71
|
+
const path = `${base}/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}/asset`;
|
|
72
|
+
return request(path);
|
|
73
|
+
}
|
|
74
|
+
products.listAssets = listAssets;
|
|
75
|
+
async function createClaimWindow(collectionId, productId, body) {
|
|
76
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}/claimWindow`;
|
|
77
|
+
return post(path, body);
|
|
78
|
+
}
|
|
79
|
+
products.createClaimWindow = createClaimWindow;
|
|
80
|
+
async function updateClaimWindow(collectionId, productId, claimId, body) {
|
|
81
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}/claimWindow/${encodeURIComponent(claimId)}`;
|
|
82
|
+
return put(path, body);
|
|
83
|
+
}
|
|
84
|
+
products.updateClaimWindow = updateClaimWindow;
|
|
85
|
+
async function refresh(collectionId, productId) {
|
|
86
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}/refresh`;
|
|
87
|
+
return request(path);
|
|
88
|
+
}
|
|
89
|
+
products.refresh = refresh;
|
|
90
|
+
async function getSN(collectionId, productId, startIndex = 0, count = 10) {
|
|
91
|
+
const queryParams = new URLSearchParams({
|
|
92
|
+
startIndex: startIndex.toString(),
|
|
93
|
+
count: count.toString(),
|
|
94
|
+
});
|
|
95
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}/getSN?${queryParams}`;
|
|
96
|
+
return request(path);
|
|
97
|
+
}
|
|
98
|
+
products.getSN = getSN;
|
|
99
|
+
async function lookupSN(collectionId, productId, codeId) {
|
|
100
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}/lookupSN/${encodeURIComponent(codeId)}`;
|
|
101
|
+
return request(path);
|
|
102
|
+
}
|
|
103
|
+
products.lookupSN = lookupSN;
|
|
104
|
+
async function publicLookupClaim(collectionId, productId, claimId) {
|
|
105
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}/lookupClaim/${encodeURIComponent(claimId)}`;
|
|
106
|
+
return request(path);
|
|
107
|
+
}
|
|
108
|
+
products.publicLookupClaim = publicLookupClaim;
|
|
109
|
+
async function publicCreateClaim(collectionId, productId, body) {
|
|
110
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}/createClaim`;
|
|
111
|
+
return post(path, body);
|
|
112
|
+
}
|
|
113
|
+
products.publicCreateClaim = publicCreateClaim;
|
|
114
|
+
})(products || (products = {}));
|