@proveanything/smartlinks 2.2.1 → 3.0.0-alpha.1
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 +741 -754
- package/dist/README.md +573 -573
- package/dist/adminCardsView.js +55 -55
- package/dist/api/adminCards.d.ts +8 -0
- package/dist/api/adminCards.js +9 -1
- package/dist/api/ai.d.ts +22 -11
- package/dist/api/ai.js +18 -14
- package/dist/api/analytics.d.ts +13 -0
- package/dist/api/analytics.js +13 -0
- package/dist/api/appConfiguration.d.ts +17 -14
- package/dist/api/appConfiguration.js +14 -12
- package/dist/api/appObjects.d.ts +80 -16
- package/dist/api/appObjects.js +74 -11
- package/dist/api/asset.d.ts +55 -19
- package/dist/api/asset.js +52 -32
- package/dist/api/attestation.d.ts +3 -2
- package/dist/api/attestation.js +1 -1
- package/dist/api/attestations.d.ts +22 -7
- package/dist/api/attestations.js +22 -7
- package/dist/api/authKit.d.ts +22 -5
- package/dist/api/authKit.js +21 -4
- package/dist/api/batch.d.ts +23 -16
- package/dist/api/batch.js +19 -13
- package/dist/api/bookings.d.ts +45 -9
- package/dist/api/bookings.js +39 -3
- package/dist/api/broadcasts.d.ts +26 -6
- package/dist/api/broadcasts.js +22 -2
- package/dist/api/claimSet.d.ts +48 -13
- package/dist/api/claimSet.js +43 -7
- package/dist/api/collection.d.ts +20 -6
- package/dist/api/collection.js +19 -8
- package/dist/api/comms.d.ts +43 -12
- package/dist/api/comms.js +43 -13
- package/dist/api/conditions.d.ts +12 -2
- package/dist/api/conditions.js +10 -1
- package/dist/api/config.d.ts +15 -2
- package/dist/api/config.js +12 -0
- package/dist/api/contact.d.ts +34 -13
- package/dist/api/contact.js +35 -10
- package/dist/api/containers.d.ts +41 -23
- package/dist/api/containers.js +37 -21
- package/dist/api/crate.d.ts +9 -8
- package/dist/api/crate.js +8 -8
- package/dist/api/dpp.d.ts +58 -10
- package/dist/api/dpp.js +57 -15
- package/dist/api/facets.d.ts +71 -0
- package/dist/api/facets.js +71 -0
- package/dist/api/files.d.ts +11 -5
- package/dist/api/files.js +9 -1
- package/dist/api/form.d.ts +9 -2
- package/dist/api/form.js +7 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +0 -1
- package/dist/api/integrations.d.ts +82 -27
- package/dist/api/integrations.js +63 -7
- package/dist/api/interactions.d.ts +42 -6
- package/dist/api/interactions.js +41 -5
- package/dist/api/jobs.d.ts +9 -2
- package/dist/api/jobs.js +6 -0
- package/dist/api/journeys.d.ts +13 -2
- package/dist/api/journeys.js +10 -1
- package/dist/api/journeysAnalytics.d.ts +12 -3
- package/dist/api/journeysAnalytics.js +9 -1
- package/dist/api/knowledge.d.ts +43 -10
- package/dist/api/knowledge.js +37 -5
- package/dist/api/location.d.ts +10 -3
- package/dist/api/location.js +7 -1
- package/dist/api/lots.d.ts +40 -13
- package/dist/api/lots.js +38 -8
- package/dist/api/loyalty.d.ts +70 -12
- package/dist/api/loyalty.js +60 -3
- package/dist/api/nfc.d.ts +8 -2
- package/dist/api/nfc.js +6 -1
- package/dist/api/order.d.ts +51 -160
- package/dist/api/order.js +46 -208
- package/dist/api/partner.d.ts +41 -8
- package/dist/api/partner.js +36 -4
- package/dist/api/products.d.ts +41 -8
- package/dist/api/products.js +33 -4
- package/dist/api/proof.d.ts +50 -13
- package/dist/api/proof.js +43 -7
- package/dist/api/realtime.d.ts +1 -11
- package/dist/api/realtime.js +1 -22
- package/dist/api/secrets.d.ts +25 -5
- package/dist/api/secrets.js +21 -2
- package/dist/api/segments.d.ts +26 -6
- package/dist/api/segments.js +22 -2
- package/dist/api/serviceAccounts.d.ts +8 -1
- package/dist/api/serviceAccounts.js +8 -1
- package/dist/api/shop.d.ts +41 -13
- package/dist/api/shop.js +35 -4
- package/dist/api/subscriptions.d.ts +47 -12
- package/dist/api/subscriptions.js +40 -4
- package/dist/api/tags.d.ts +40 -19
- package/dist/api/tags.js +38 -18
- package/dist/api/template.d.ts +31 -3
- package/dist/api/template.js +27 -0
- package/dist/api/translations.d.ts +17 -2
- package/dist/api/translations.js +14 -0
- package/dist/api/userGroups.d.ts +35 -9
- package/dist/api/userGroups.js +30 -5
- package/dist/api/variant.d.ts +11 -3
- package/dist/api/variant.js +9 -2
- package/dist/api/wallet.d.ts +23 -10
- package/dist/api/wallet.js +20 -2
- package/dist/apiVersion.d.ts +1 -1
- package/dist/apiVersion.js +1 -1
- package/dist/baseline.css +194 -194
- package/dist/docs/API_SUMMARY.md +1389 -2298
- package/dist/docs/PRODUCT_FACETS_SDK.md +10 -15
- package/dist/docs/admin-cards.md +189 -189
- package/dist/docs/admin-lists-and-pickers.md +1 -1
- package/dist/docs/agent-tools.md +156 -156
- package/dist/docs/ai-tools-and-skills.md +180 -180
- package/dist/docs/ai.md +1721 -1721
- package/dist/docs/analytics.md +3 -2
- package/dist/docs/api-versions.md +85 -76
- package/dist/docs/app-data-storage.md +277 -277
- package/dist/docs/app-docs.md +73 -73
- package/dist/docs/app-manifest.md +852 -852
- package/dist/docs/app-objects.md +38 -50
- package/dist/docs/app-records-pattern.md +388 -388
- package/dist/docs/appConfig.md +550 -550
- package/dist/docs/assets.md +17 -3
- package/dist/docs/assistant-apps.md +172 -172
- package/dist/docs/assistant-context.md +119 -119
- package/dist/docs/attestations.md +5 -4
- package/dist/docs/auth-kit.md +1 -1
- package/dist/docs/bookings.md +442 -442
- package/dist/docs/comms.md +689 -686
- package/dist/docs/connectors.md +340 -340
- package/dist/docs/contact-search.md +4 -3
- package/dist/docs/container-tracking.md +7 -7
- package/dist/docs/css-baseline.md +133 -133
- package/dist/docs/customer-guide.md +70 -70
- package/dist/docs/deploying-apps.md +340 -340
- package/dist/docs/dpp.md +115 -115
- package/dist/docs/entitlements.md +90 -90
- package/dist/docs/executor.md +1 -1
- package/dist/docs/files.md +69 -69
- package/dist/docs/forms.md +1 -1
- package/dist/docs/headless-providers.md +3 -3
- package/dist/docs/host-dependency-contract.md +252 -210
- package/dist/docs/integrations.md +322 -322
- package/dist/docs/interactions.md +544 -545
- package/dist/docs/item-context.md +181 -181
- package/dist/docs/knowledge.md +105 -102
- package/dist/docs/lists.md +114 -0
- package/dist/docs/lots.md +112 -111
- package/dist/docs/loyalty.md +348 -352
- package/dist/docs/members.md +183 -183
- package/dist/docs/memberships.md +150 -149
- package/dist/docs/mobile-admin-container.md +693 -693
- package/dist/docs/operations.md +281 -281
- package/dist/docs/overview.md +485 -485
- package/dist/docs/proof-claiming-methods.md +6 -6
- package/dist/docs/proof-comms-triggers.md +142 -142
- package/dist/docs/proof-ownership-transfer.md +155 -155
- package/dist/docs/proof-product-data-scoping.md +462 -462
- package/dist/docs/proof-share-grants.md +305 -305
- package/dist/docs/realtime.md +139 -138
- package/dist/docs/records-admin-pattern.md +304 -304
- package/dist/docs/server-functions.md +2 -2
- package/dist/docs/service-accounts.md +64 -64
- package/dist/docs/shop.md +4 -2
- package/dist/docs/site-seo.md +2 -1
- package/dist/docs/standard-query.md +187 -187
- package/dist/docs/tag-codes.md +97 -97
- package/dist/docs/tag-ranges.md +106 -106
- package/dist/docs/theme-tokens.md +252 -252
- package/dist/docs/translations.md +6 -1
- package/dist/docs/upgrading-to-3.md +430 -0
- package/dist/docs/user-groups.md +4 -4
- package/dist/docs/utils.md +1 -1
- package/dist/docs/wallet-passes.md +107 -107
- package/dist/docs/websites.md +123 -123
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +2 -2
- package/dist/http.d.ts +15 -2
- package/dist/http.js +60 -2
- package/dist/index.d.ts +7 -8
- package/dist/index.js +2 -0
- package/dist/list.d.ts +24 -0
- package/dist/list.js +80 -0
- package/dist/mobile-admin/types.d.ts +0 -16
- package/dist/openapi.yaml +290 -2723
- package/dist/shared-dependencies.d.ts +3 -3
- package/dist/shared-dependencies.js +13 -5
- package/dist/site.d.ts +1 -7
- package/dist/site.js +1 -14
- package/dist/theme-boot.js +82 -82
- package/dist/theme.css +75 -75
- package/dist/types/adminCards.d.ts +6 -3
- package/dist/types/ai.d.ts +0 -6
- package/dist/types/analytics.d.ts +5 -8
- package/dist/types/appManifest.d.ts +4 -5
- package/dist/types/appObjects.d.ts +14 -18
- package/dist/types/appObjects.js +0 -1
- package/dist/types/appOptions.d.ts +18 -0
- package/dist/types/asset.d.ts +3 -22
- package/dist/types/attestations.d.ts +7 -10
- package/dist/types/batch.d.ts +6 -14
- package/dist/types/bookings.d.ts +22 -4
- package/dist/types/broadcasts.d.ts +5 -13
- package/dist/types/broadcasts.js +0 -1
- package/dist/types/claimSet.d.ts +0 -5
- package/dist/types/comms.d.ts +11 -9
- package/dist/types/contact.d.ts +5 -29
- package/dist/types/contact.js +0 -13
- package/dist/types/containers.d.ts +15 -26
- package/dist/types/crate.d.ts +4 -12
- package/dist/types/dpp.d.ts +3 -3
- package/dist/types/dpp.js +0 -1
- package/dist/types/error.d.ts +8 -5
- package/dist/types/error.js +12 -5
- package/dist/types/facets.d.ts +15 -15
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/integrations.d.ts +3 -28
- package/dist/types/interaction.d.ts +3 -9
- package/dist/types/jobs.d.ts +3 -8
- package/dist/types/jobs.js +0 -1
- package/dist/types/journeys.d.ts +3 -8
- package/dist/types/journeys.js +0 -1
- package/dist/types/journeysAnalytics.d.ts +0 -1
- package/dist/types/list.d.ts +24 -0
- package/dist/types/list.js +2 -0
- package/dist/types/location.d.ts +0 -4
- package/dist/types/lots.d.ts +0 -9
- package/dist/types/loyalty.d.ts +0 -9
- package/dist/types/order.d.ts +7 -134
- package/dist/types/product.d.ts +11 -24
- package/dist/types/proof.d.ts +16 -0
- package/dist/types/realtime.d.ts +0 -29
- package/dist/types/segments.d.ts +5 -13
- package/dist/types/segments.js +0 -1
- package/dist/types/serviceAccounts.d.ts +3 -2
- package/dist/types/serviceAccounts.js +0 -1
- package/dist/types/shop.d.ts +5 -12
- package/dist/types/shop.js +0 -4
- package/dist/types/subscriptions.d.ts +18 -0
- package/dist/types/subscriptions.js +0 -8
- package/dist/types/tags.d.ts +6 -16
- package/dist/types/tags.js +0 -7
- package/dist/types/translations.d.ts +3 -9
- package/dist/types/variant.d.ts +0 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/API_SUMMARY.md +1389 -2298
- package/docs/PRODUCT_FACETS_SDK.md +10 -15
- package/docs/admin-cards.md +189 -189
- package/docs/admin-lists-and-pickers.md +1 -1
- package/docs/agent-tools.md +156 -156
- package/docs/ai-tools-and-skills.md +180 -180
- package/docs/ai.md +1721 -1721
- package/docs/analytics.md +3 -2
- package/docs/api-versions.md +85 -76
- package/docs/app-data-storage.md +277 -277
- package/docs/app-docs.md +73 -73
- package/docs/app-manifest.md +852 -852
- package/docs/app-objects.md +38 -50
- package/docs/app-records-pattern.md +388 -388
- package/docs/appConfig.md +550 -550
- package/docs/assets.md +17 -3
- package/docs/assistant-apps.md +172 -172
- package/docs/assistant-context.md +119 -119
- package/docs/attestations.md +5 -4
- package/docs/auth-kit.md +1 -1
- package/docs/bookings.md +442 -442
- package/docs/comms.md +689 -686
- package/docs/connectors.md +340 -340
- package/docs/contact-search.md +4 -3
- package/docs/container-tracking.md +7 -7
- package/docs/css-baseline.md +133 -133
- package/docs/customer-guide.md +70 -70
- package/docs/deploying-apps.md +340 -340
- package/docs/dpp.md +115 -115
- package/docs/entitlements.md +90 -90
- package/docs/executor.md +1 -1
- package/docs/files.md +69 -69
- package/docs/forms.md +1 -1
- package/docs/headless-providers.md +3 -3
- package/docs/host-dependency-contract.md +252 -210
- package/docs/integrations.md +322 -322
- package/docs/interactions.md +544 -545
- package/docs/item-context.md +181 -181
- package/docs/knowledge.md +105 -102
- package/docs/lists.md +114 -0
- package/docs/lots.md +112 -111
- package/docs/loyalty.md +348 -352
- package/docs/members.md +183 -183
- package/docs/memberships.md +150 -149
- package/docs/mobile-admin-container.md +693 -693
- package/docs/operations.md +281 -281
- package/docs/overview.md +485 -485
- package/docs/proof-claiming-methods.md +6 -6
- package/docs/proof-comms-triggers.md +142 -142
- package/docs/proof-ownership-transfer.md +155 -155
- package/docs/proof-product-data-scoping.md +462 -462
- package/docs/proof-share-grants.md +305 -305
- package/docs/realtime.md +139 -138
- package/docs/server-functions.md +2 -2
- package/docs/service-accounts.md +64 -64
- package/docs/shop.md +4 -2
- package/docs/site-seo.md +2 -1
- package/docs/standard-query.md +187 -187
- package/docs/tag-codes.md +97 -97
- package/docs/tag-ranges.md +106 -106
- package/docs/theme-lookbook.v1.json +120 -120
- package/docs/theme-tokens.md +252 -252
- package/docs/translations.md +6 -1
- package/docs/upgrading-to-3.md +430 -0
- package/docs/user-groups.md +4 -4
- package/docs/utils.md +1 -1
- package/docs/wallet-passes.md +107 -107
- package/docs/websites.md +123 -123
- package/openapi.yaml +290 -2723
- package/package.json +8 -4
- package/scripts/headless-check.mjs +87 -87
- package/scripts/lib/bare-imports.mjs +57 -57
- package/scripts/lib/keyed-app-data.mjs +21 -21
- package/scripts/lib/upgrade.mjs +512 -0
- package/scripts/publish.mjs +272 -272
- package/scripts/register-release.mjs +91 -91
- package/scripts/upgrade.mjs +56 -0
- package/upgrade/3.json +2213 -0
package/dist/api/proof.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ProofResponse, ProofCreateRequest, ProofUpdateRequest, ProofValuesUpdateRequest, ProofClaimRequest, ProofGrant, CreateGrantOptions, RedeemGrantOptions, RedeemGrantResult, ProofTransfer, TransferProofOptions, TransferProofResult, AcceptTransferOptions, CancelTransferOptions } from "../types/proof.js";
|
|
1
|
+
import { ProofResponse, ProofCreateRequest, ProofUpdateRequest, ProofValuesUpdateRequest, ProofClaimRequest, ProofGrant, CreateGrantOptions, RedeemGrantOptions, RedeemGrantResult, ProofTransfer, TransferProofOptions, TransferProofResult, AcceptTransferOptions, CancelTransferOptions, ProofFindQuery } from "../types/proof.js";
|
|
2
|
+
import type { ListResult } from "../types/list.js";
|
|
2
3
|
import type { StandardQuery, QueryResult, QueryDescription } from "../types/query.js";
|
|
3
4
|
export declare namespace proof {
|
|
4
5
|
/**
|
|
@@ -36,9 +37,15 @@ export declare namespace proof {
|
|
|
36
37
|
*/
|
|
37
38
|
function get(collectionId: string, productId: string, proofId: string, admin?: boolean, include?: string[]): Promise<ProofResponse>;
|
|
38
39
|
/**
|
|
39
|
-
* List all Proofs for a Collection.
|
|
40
|
+
* List all Proofs for a Collection, in one list (no pages).
|
|
41
|
+
* GET /public/collection/:collectionId/proof
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const { items } = await proof.list(collectionId)
|
|
46
|
+
* ```
|
|
40
47
|
*/
|
|
41
|
-
function list(collectionId: string, include?: string[]): Promise<ProofResponse
|
|
48
|
+
function list(collectionId: string, include?: string[]): Promise<ListResult<ProofResponse>>;
|
|
42
49
|
/**
|
|
43
50
|
* Create a proof for a product (admin only).
|
|
44
51
|
* POST /admin/collection/:collectionId/product/:productId/proof
|
|
@@ -121,25 +128,47 @@ export declare namespace proof {
|
|
|
121
128
|
*/
|
|
122
129
|
function remove(collectionId: string, productId: string, proofId: string): Promise<void>;
|
|
123
130
|
/**
|
|
124
|
-
* Get proofs for a user in a collection (admin only).
|
|
131
|
+
* Get proofs for a user in a collection (admin only), in one list (no pages).
|
|
125
132
|
* GET /admin/collection/:collectionId/proof/findByUser/:userId
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* const { items } = await proof.getByUser(collectionId, userId)
|
|
137
|
+
* ```
|
|
126
138
|
*/
|
|
127
|
-
function getByUser(collectionId: string, userId: string): Promise<ProofResponse
|
|
139
|
+
function getByUser(collectionId: string, userId: string): Promise<ListResult<ProofResponse>>;
|
|
128
140
|
/**
|
|
129
|
-
* Get proofs for a product (admin only).
|
|
141
|
+
* Get proofs for a product (admin only), in one list (no pages).
|
|
130
142
|
* GET /admin/collection/:collectionId/product/:productId/proof
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* const { items } = await proof.getByProduct(collectionId, productId)
|
|
147
|
+
* ```
|
|
131
148
|
*/
|
|
132
|
-
function getByProduct(collectionId: string, productId: string): Promise<ProofResponse
|
|
149
|
+
function getByProduct(collectionId: string, productId: string): Promise<ListResult<ProofResponse>>;
|
|
133
150
|
/**
|
|
134
|
-
* Find proofs for a product (admin only)
|
|
151
|
+
* Find proofs for a product (admin only): the newest `limit` (default 100), or every proof matching
|
|
152
|
+
* `filterBy`. For counting, sorting and paging through a collection's proofs use `proof.query`.
|
|
135
153
|
* POST /admin/collection/:collectionId/product/:productId/proof/find
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const { items } = await proof.findByProduct(collectionId, productId, { limit: 50, includes: ['assets'] })
|
|
158
|
+
* const red = await proof.findByProduct(collectionId, productId, { filterBy: [{ field: 'values.colour', value: 'red' }] })
|
|
159
|
+
* ```
|
|
136
160
|
*/
|
|
137
|
-
function findByProduct(collectionId: string, productId: string, query
|
|
161
|
+
function findByProduct(collectionId: string, productId: string, query?: ProofFindQuery): Promise<ListResult<ProofResponse>>;
|
|
138
162
|
/**
|
|
139
|
-
* Get proofs for a batch (admin only).
|
|
163
|
+
* Get proofs for a batch (admin only), in one list (no pages).
|
|
140
164
|
* GET /admin/collection/:collectionId/product/:productId/batch/:batchId/proof
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* const { items } = await proof.getByBatch(collectionId, productId, batchId)
|
|
169
|
+
* ```
|
|
141
170
|
*/
|
|
142
|
-
function getByBatch(collectionId: string, productId: string, batchId: string): Promise<ProofResponse
|
|
171
|
+
function getByBatch(collectionId: string, productId: string, batchId: string): Promise<ListResult<ProofResponse>>;
|
|
143
172
|
/**
|
|
144
173
|
* Migrate a proof to a different product within the same collection (admin only).
|
|
145
174
|
*
|
|
@@ -185,8 +214,16 @@ export declare namespace proof {
|
|
|
185
214
|
* {@link setGrantToken}.
|
|
186
215
|
*/
|
|
187
216
|
function createGrant(collectionId: string, productId: string, proofId: string, options: CreateGrantOptions): Promise<ProofGrant>;
|
|
188
|
-
/**
|
|
189
|
-
|
|
217
|
+
/**
|
|
218
|
+
* List the active + past grants on a proof (owner / collection admin only), in one list (no pages).
|
|
219
|
+
* Tokens are never returned here.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* const { items } = await proof.listGrants(collectionId, productId, proofId)
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
function listGrants(collectionId: string, productId: string, proofId: string): Promise<ListResult<ProofGrant>>;
|
|
190
227
|
/** Revoke a grant by id (owner / collection admin only). Takes effect immediately. */
|
|
191
228
|
function revokeGrant(collectionId: string, productId: string, proofId: string, grantId: string): Promise<void>;
|
|
192
229
|
/**
|
package/dist/api/proof.js
CHANGED
|
@@ -51,7 +51,13 @@ export var proof;
|
|
|
51
51
|
}
|
|
52
52
|
proof.get = get;
|
|
53
53
|
/**
|
|
54
|
-
* List all Proofs for a Collection.
|
|
54
|
+
* List all Proofs for a Collection, in one list (no pages).
|
|
55
|
+
* GET /public/collection/:collectionId/proof
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const { items } = await proof.list(collectionId)
|
|
60
|
+
* ```
|
|
55
61
|
*/
|
|
56
62
|
async function list(collectionId, include) {
|
|
57
63
|
const qp = include && include.length ? `?include=${encodeURIComponent(include.join(','))}` : '';
|
|
@@ -166,8 +172,13 @@ export var proof;
|
|
|
166
172
|
}
|
|
167
173
|
proof.remove = remove;
|
|
168
174
|
/**
|
|
169
|
-
* Get proofs for a user in a collection (admin only).
|
|
175
|
+
* Get proofs for a user in a collection (admin only), in one list (no pages).
|
|
170
176
|
* GET /admin/collection/:collectionId/proof/findByUser/:userId
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* const { items } = await proof.getByUser(collectionId, userId)
|
|
181
|
+
* ```
|
|
171
182
|
*/
|
|
172
183
|
async function getByUser(collectionId, userId) {
|
|
173
184
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/proof/findByUser/${encodeURIComponent(userId)}`;
|
|
@@ -175,8 +186,13 @@ export var proof;
|
|
|
175
186
|
}
|
|
176
187
|
proof.getByUser = getByUser;
|
|
177
188
|
/**
|
|
178
|
-
* Get proofs for a product (admin only).
|
|
189
|
+
* Get proofs for a product (admin only), in one list (no pages).
|
|
179
190
|
* GET /admin/collection/:collectionId/product/:productId/proof
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```typescript
|
|
194
|
+
* const { items } = await proof.getByProduct(collectionId, productId)
|
|
195
|
+
* ```
|
|
180
196
|
*/
|
|
181
197
|
async function getByProduct(collectionId, productId) {
|
|
182
198
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof`;
|
|
@@ -184,17 +200,29 @@ export var proof;
|
|
|
184
200
|
}
|
|
185
201
|
proof.getByProduct = getByProduct;
|
|
186
202
|
/**
|
|
187
|
-
* Find proofs for a product (admin only)
|
|
203
|
+
* Find proofs for a product (admin only): the newest `limit` (default 100), or every proof matching
|
|
204
|
+
* `filterBy`. For counting, sorting and paging through a collection's proofs use `proof.query`.
|
|
188
205
|
* POST /admin/collection/:collectionId/product/:productId/proof/find
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const { items } = await proof.findByProduct(collectionId, productId, { limit: 50, includes: ['assets'] })
|
|
210
|
+
* const red = await proof.findByProduct(collectionId, productId, { filterBy: [{ field: 'values.colour', value: 'red' }] })
|
|
211
|
+
* ```
|
|
189
212
|
*/
|
|
190
|
-
async function findByProduct(collectionId, productId, query) {
|
|
213
|
+
async function findByProduct(collectionId, productId, query = {}) {
|
|
191
214
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/find`;
|
|
192
215
|
return post(path, query);
|
|
193
216
|
}
|
|
194
217
|
proof.findByProduct = findByProduct;
|
|
195
218
|
/**
|
|
196
|
-
* Get proofs for a batch (admin only).
|
|
219
|
+
* Get proofs for a batch (admin only), in one list (no pages).
|
|
197
220
|
* GET /admin/collection/:collectionId/product/:productId/batch/:batchId/proof
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* const { items } = await proof.getByBatch(collectionId, productId, batchId)
|
|
225
|
+
* ```
|
|
198
226
|
*/
|
|
199
227
|
async function getByBatch(collectionId, productId, batchId) {
|
|
200
228
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/batch/${encodeURIComponent(batchId)}/proof`;
|
|
@@ -265,7 +293,15 @@ export var proof;
|
|
|
265
293
|
return post(grantBase(collectionId, productId, proofId), body);
|
|
266
294
|
}
|
|
267
295
|
proof.createGrant = createGrant;
|
|
268
|
-
/**
|
|
296
|
+
/**
|
|
297
|
+
* List the active + past grants on a proof (owner / collection admin only), in one list (no pages).
|
|
298
|
+
* Tokens are never returned here.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* ```typescript
|
|
302
|
+
* const { items } = await proof.listGrants(collectionId, productId, proofId)
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
269
305
|
async function listGrants(collectionId, productId, proofId) {
|
|
270
306
|
return request(grantBase(collectionId, productId, proofId));
|
|
271
307
|
}
|
package/dist/api/realtime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RealtimeChangeEvent, RealtimeChangeFilter, RealtimeMessage, RealtimeScope } from "../types/realtime.js";
|
|
2
2
|
/**
|
|
3
3
|
* One of your app's declared channels (manifest `realtime.channels`).
|
|
4
4
|
*
|
|
@@ -53,13 +53,3 @@ export declare function onStaffChange(scope: RealtimeScope & {
|
|
|
53
53
|
* Messages for the signed-in person only (e.g. "scan" — a tag they just scanned on another device).
|
|
54
54
|
*/
|
|
55
55
|
export declare function onMine(scope: RealtimeScope, onMessage: (msg: RealtimeMessage) => void): () => void;
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated Use `realtime.channel()` / `realtime.onChange()`. Returns a raw Ably TokenRequest for
|
|
58
|
-
* `collection:{collectionId}:*` (subscribe; publish only for the collection's admins).
|
|
59
|
-
*/
|
|
60
|
-
export declare function getPublicToken(params: RealtimeTokenRequest): Promise<AblyTokenRequest>;
|
|
61
|
-
/**
|
|
62
|
-
* @deprecated Use `realtime.onMine()`. Returns a raw Ably TokenRequest for `interaction:{userId}`
|
|
63
|
-
* (subscribe only).
|
|
64
|
-
*/
|
|
65
|
-
export declare function getAdminToken(): Promise<AblyTokenRequest>;
|
package/dist/api/realtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/api/realtime.ts
|
|
2
|
-
import {
|
|
2
|
+
import { post } from "../http.js";
|
|
3
3
|
/** One live stream per (collection, app): every listener on this page shares it. */
|
|
4
4
|
class Stream {
|
|
5
5
|
constructor(collectionId, appId, onEmpty) {
|
|
@@ -261,24 +261,3 @@ export function onStaffChange(scope, filter, onChangeFn) {
|
|
|
261
261
|
export function onMine(scope, onMessage) {
|
|
262
262
|
return streamFor({ collectionId: scope.collectionId }).add("feed:me", onMessage);
|
|
263
263
|
}
|
|
264
|
-
// ---------------------------------------------------------------------------------------------------
|
|
265
|
-
// Legacy (raw Ably tokens). New code uses channel / onChange above — no provider in your app.
|
|
266
|
-
// ---------------------------------------------------------------------------------------------------
|
|
267
|
-
/**
|
|
268
|
-
* @deprecated Use `realtime.channel()` / `realtime.onChange()`. Returns a raw Ably TokenRequest for
|
|
269
|
-
* `collection:{collectionId}:*` (subscribe; publish only for the collection's admins).
|
|
270
|
-
*/
|
|
271
|
-
export async function getPublicToken(params) {
|
|
272
|
-
const queryParams = new URLSearchParams();
|
|
273
|
-
queryParams.append("collectionId", params.collectionId);
|
|
274
|
-
if (params.appId)
|
|
275
|
-
queryParams.append("appId", params.appId);
|
|
276
|
-
return request(`/public/push/token?${queryParams.toString()}`);
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* @deprecated Use `realtime.onMine()`. Returns a raw Ably TokenRequest for `interaction:{userId}`
|
|
280
|
-
* (subscribe only).
|
|
281
|
-
*/
|
|
282
|
-
export async function getAdminToken() {
|
|
283
|
-
return request("/admin/auth/push");
|
|
284
|
-
}
|
package/dist/api/secrets.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { SecretMeta,
|
|
1
|
+
import type { SecretMeta, SetSecretInput, SetSecretResult, ListSecretsQuery } from "../types/integrations.js";
|
|
2
|
+
import type { ListResult } from "../types/list.js";
|
|
2
3
|
export interface AppSecretOptions {
|
|
3
4
|
/** The app whose secret this is. Defaults to the SDK's app context (`initializeApi({ appId })`). */
|
|
4
5
|
appId?: string;
|
|
@@ -11,14 +12,33 @@ export declare namespace secrets {
|
|
|
11
12
|
* the value. PUT /app/:appId/secrets/:name
|
|
12
13
|
*/
|
|
13
14
|
function put(collectionId: string, name: string, value: string, opts?: AppSecretOptions): Promise<SetSecretResult>;
|
|
14
|
-
/**
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* This app's secrets on the collection: names + masked hints (never values). Returns
|
|
17
|
+
* `{ items, nextCursor }`: the secrets are in `items`, each `ref` being the name you saved it under. The
|
|
18
|
+
* list is not paged, so `nextCursor` is always `null`. GET /app/:appId/secrets
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const { items } = await secrets.listOwn('coll_123')
|
|
23
|
+
* // items: [{ ref: 'shop-api-key', hint: '••••1234', ... }]
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
function listOwn(collectionId: string, opts?: AppSecretOptions): Promise<ListResult<SecretMeta>>;
|
|
16
27
|
/** Delete this app's secret `name`. DELETE /app/:appId/secrets/:name */
|
|
17
28
|
function removeOwn(collectionId: string, name: string, opts?: AppSecretOptions): Promise<{
|
|
18
29
|
deleted: boolean;
|
|
19
30
|
}>;
|
|
20
|
-
/**
|
|
21
|
-
|
|
31
|
+
/**
|
|
32
|
+
* List secrets as refs + masked hints + metadata (never values). Returns `{ items, nextCursor }`: the
|
|
33
|
+
* secrets are in `items`, newest first. The list is not paged, so `nextCursor` is always `null`.
|
|
34
|
+
* `purpose` narrows it to one purpose. GET /secrets
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const { items } = await secrets.list('coll_123', { purpose: 'integration' })
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
function list(collectionId: string, query?: ListSecretsQuery): Promise<ListResult<SecretMeta>>;
|
|
22
42
|
/**
|
|
23
43
|
* Create a collection secret with a GENERATED ref. POST /secrets → { ref, hint }. Store the ref on a
|
|
24
44
|
* flow. For a secret your app's server functions read by name, use `put` instead.
|
package/dist/api/secrets.js
CHANGED
|
@@ -45,7 +45,17 @@ export var secrets;
|
|
|
45
45
|
return put_(`${appBase(collectionId, opts)}/${enc(name)}`, { value });
|
|
46
46
|
}
|
|
47
47
|
secrets.put = put;
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* This app's secrets on the collection: names + masked hints (never values). Returns
|
|
50
|
+
* `{ items, nextCursor }`: the secrets are in `items`, each `ref` being the name you saved it under. The
|
|
51
|
+
* list is not paged, so `nextCursor` is always `null`. GET /app/:appId/secrets
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const { items } = await secrets.listOwn('coll_123')
|
|
56
|
+
* // items: [{ ref: 'shop-api-key', hint: '••••1234', ... }]
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
49
59
|
async function listOwn(collectionId, opts = {}) {
|
|
50
60
|
return request(appBase(collectionId, opts));
|
|
51
61
|
}
|
|
@@ -55,7 +65,16 @@ export var secrets;
|
|
|
55
65
|
return del(`${appBase(collectionId, opts)}/${enc(name)}`);
|
|
56
66
|
}
|
|
57
67
|
secrets.removeOwn = removeOwn;
|
|
58
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* List secrets as refs + masked hints + metadata (never values). Returns `{ items, nextCursor }`: the
|
|
70
|
+
* secrets are in `items`, newest first. The list is not paged, so `nextCursor` is always `null`.
|
|
71
|
+
* `purpose` narrows it to one purpose. GET /secrets
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const { items } = await secrets.list('coll_123', { purpose: 'integration' })
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
59
78
|
async function list(collectionId, query = {}) {
|
|
60
79
|
return request(`${base(collectionId)}${encodeQuery(query)}`);
|
|
61
80
|
}
|
package/dist/api/segments.d.ts
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
|
-
import type { SegmentRecord, ListSegmentsQuery,
|
|
1
|
+
import type { SegmentRecord, ListSegmentsQuery, SegmentCalculateResult, SegmentRecipientsResponse } from "../types/segments.js";
|
|
2
|
+
import type { ListResult, ListOptions } from "../types/list.js";
|
|
2
3
|
export declare namespace segments {
|
|
3
4
|
function create(collectionId: string, body: Omit<SegmentRecord, 'id' | 'collectionId' | 'createdAt'>): Promise<SegmentRecord>;
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The collection's segments, a page at a time. Filter by the app that owns them (`appId`) or by
|
|
7
|
+
* `filterType`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* let page = await segments.list('coll_123', { filterType: 'dynamic', limit: 50 })
|
|
12
|
+
* page.items // SegmentRecord[]
|
|
13
|
+
* while (page.nextCursor) page = await segments.list('coll_123', { filterType: 'dynamic', limit: 50, cursor: page.nextCursor })
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
function list(collectionId: string, query?: ListSegmentsQuery): Promise<ListResult<SegmentRecord>>;
|
|
5
17
|
function get(collectionId: string, id: string): Promise<SegmentRecord>;
|
|
6
18
|
function update(collectionId: string, id: string, body: Partial<Omit<SegmentRecord, 'id' | 'collectionId' | 'createdAt'>>): Promise<SegmentRecord>;
|
|
7
19
|
function remove(collectionId: string, id: string): Promise<void>;
|
|
8
20
|
function calculate(collectionId: string, id: string): Promise<SegmentCalculateResult>;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The contacts in a segment, a page at a time. `count` is how many there are in all.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const page = await segments.recipients('coll_123', 'seg_1', { limit: 100 })
|
|
27
|
+
* page.items // Recipient[]
|
|
28
|
+
* page.count // total in the segment
|
|
29
|
+
* page.nextCursor // pass back as `cursor` for the next page; null on the last
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
function recipients(collectionId: string, id: string, query?: ListOptions): Promise<SegmentRecipientsResponse>;
|
|
13
33
|
}
|
package/dist/api/segments.js
CHANGED
|
@@ -21,7 +21,17 @@ export var segments;
|
|
|
21
21
|
return post(path, body);
|
|
22
22
|
}
|
|
23
23
|
segments.create = create;
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* The collection's segments, a page at a time. Filter by the app that owns them (`appId`) or by
|
|
26
|
+
* `filterType`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* let page = await segments.list('coll_123', { filterType: 'dynamic', limit: 50 })
|
|
31
|
+
* page.items // SegmentRecord[]
|
|
32
|
+
* while (page.nextCursor) page = await segments.list('coll_123', { filterType: 'dynamic', limit: 50, cursor: page.nextCursor })
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
25
35
|
async function list(collectionId, query = {}) {
|
|
26
36
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/segments/${encodeQuery(query)}`;
|
|
27
37
|
return request(path);
|
|
@@ -51,7 +61,17 @@ export var segments;
|
|
|
51
61
|
return post(path, {});
|
|
52
62
|
}
|
|
53
63
|
segments.calculate = calculate;
|
|
54
|
-
|
|
64
|
+
/**
|
|
65
|
+
* The contacts in a segment, a page at a time. `count` is how many there are in all.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const page = await segments.recipients('coll_123', 'seg_1', { limit: 100 })
|
|
70
|
+
* page.items // Recipient[]
|
|
71
|
+
* page.count // total in the segment
|
|
72
|
+
* page.nextCursor // pass back as `cursor` for the next page; null on the last
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
55
75
|
async function recipients(collectionId, id, query = {}) {
|
|
56
76
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/segments/${encodeURIComponent(id)}/recipients${encodeQuery(query)}`;
|
|
57
77
|
return request(path);
|
|
@@ -3,7 +3,14 @@ export declare namespace serviceAccounts {
|
|
|
3
3
|
/**
|
|
4
4
|
* The service accounts that work on this collection — its own (`home: true`, with `alsoOn`) and other
|
|
5
5
|
* collections' (`home: false`, with `homeCollection`) — never their keys, and the access levels that can be
|
|
6
|
-
* given. GET /service-accounts
|
|
6
|
+
* given (`access`). All of them in one answer: `nextCursor` is always null. GET /service-accounts
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const { items, access } = await serviceAccounts.list('coll_123')
|
|
11
|
+
* items // ServiceAccount[]
|
|
12
|
+
* access // ["User", "Reporter", "Assigner", "Admin"]
|
|
13
|
+
* ```
|
|
7
14
|
*/
|
|
8
15
|
function list(collectionId: string): Promise<ServiceAccountList>;
|
|
9
16
|
/**
|
|
@@ -25,7 +25,14 @@ export var serviceAccounts;
|
|
|
25
25
|
/**
|
|
26
26
|
* The service accounts that work on this collection — its own (`home: true`, with `alsoOn`) and other
|
|
27
27
|
* collections' (`home: false`, with `homeCollection`) — never their keys, and the access levels that can be
|
|
28
|
-
* given. GET /service-accounts
|
|
28
|
+
* given (`access`). All of them in one answer: `nextCursor` is always null. GET /service-accounts
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const { items, access } = await serviceAccounts.list('coll_123')
|
|
33
|
+
* items // ServiceAccount[]
|
|
34
|
+
* access // ["User", "Reporter", "Assigner", "Admin"]
|
|
35
|
+
* ```
|
|
29
36
|
*/
|
|
30
37
|
async function list(collectionId) {
|
|
31
38
|
return request(base(collectionId));
|
package/dist/api/shop.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ShopPublicConfig, ShopProduct, ShopCheckoutInput, ShopCheckoutResult, ShopBuyerOrder,
|
|
1
|
+
import type { ShopPublicConfig, ShopProduct, ShopCheckoutInput, ShopCheckoutResult, ShopBuyerOrder, ShopSettingsView, ShopSettingsPatch, ShopConnectStatus, ShopPrice, ShopPriceInput, ShopPriceUpdate, ShopPriceListParams, ShopAdminOrder, ShopOrderListParams, ShopShipInput, ShopRefundInput } from '../types/shop.js';
|
|
2
|
+
import type { ListResult, ListOptions } from '../types/list.js';
|
|
2
3
|
export declare namespace shop {
|
|
3
4
|
/**
|
|
4
5
|
* What a shop front shows: currency, the seller's details (UK law: shown before paying), shipping rates,
|
|
@@ -7,19 +8,19 @@ export declare namespace shop {
|
|
|
7
8
|
function config(collectionId: string): Promise<ShopPublicConfig>;
|
|
8
9
|
/**
|
|
9
10
|
* What is for sale, in the shop's currency, with stock (`inStock`, `available`) and whether the buyer must
|
|
10
|
-
* sign in first (`needsSignIn`: a proof or access goes to an account).
|
|
11
|
+
* sign in first (`needsSignIn`: a proof or access goes to an account). Everything for sale comes in one
|
|
12
|
+
* answer (`nextCursor` is always null), with the shop's `currency` beside the list.
|
|
11
13
|
*
|
|
12
14
|
* @example
|
|
13
15
|
* ```typescript
|
|
14
|
-
* const { items } = await shop.products(collectionId)
|
|
16
|
+
* const { items, currency } = await shop.products(collectionId)
|
|
15
17
|
* items.map((p) => `${p.name}: ${formatMoney(p.amount, p.currency)}${p.inStock ? '' : ' (sold out)'}`)
|
|
16
18
|
* ```
|
|
17
19
|
*/
|
|
18
20
|
function products(collectionId: string, params?: {
|
|
19
21
|
productIds?: string[];
|
|
20
|
-
}): Promise<{
|
|
22
|
+
}): Promise<ListResult<ShopProduct> & {
|
|
21
23
|
currency: string;
|
|
22
|
-
items: ShopProduct[];
|
|
23
24
|
}>;
|
|
24
25
|
/**
|
|
25
26
|
* Start paying: the server prices the basket, holds the stock and returns Stripe's checkout page. Send the
|
|
@@ -45,11 +46,19 @@ export declare namespace shop {
|
|
|
45
46
|
* `downloads` has links for bought files once it's paid.
|
|
46
47
|
*/
|
|
47
48
|
function orderBySession(collectionId: string, sessionId: string): Promise<ShopBuyerOrder>;
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The signed-in buyer's orders, newest first, with their download links, a page at a time. `count` is how
|
|
51
|
+
* many they have in all.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* let page = await shop.myOrders(collectionId, { limit: 20 })
|
|
56
|
+
* page.items // ShopBuyerOrder[]
|
|
57
|
+
* if (page.nextCursor) page = await shop.myOrders(collectionId, { limit: 20, cursor: page.nextCursor })
|
|
58
|
+
* ```
|
|
59
|
+
* @throws `SIGN_IN_REQUIRED`
|
|
60
|
+
*/
|
|
61
|
+
function myOrders(collectionId: string, params?: ListOptions): Promise<ListResult<ShopBuyerOrder>>;
|
|
53
62
|
/**
|
|
54
63
|
* Format minor units as money, in the page's language unless `locale` says otherwise:
|
|
55
64
|
* `formatMoney(1299, 'EUR')` → "€12.99" in English, "12,99 €" in German. Zero-decimal currencies
|
|
@@ -75,7 +84,16 @@ export declare namespace shop {
|
|
|
75
84
|
}>;
|
|
76
85
|
/** Whether Stripe is connected, and whether it can take payments and pay out yet. */
|
|
77
86
|
function connectStatus(collectionId: string): Promise<ShopConnectStatus>;
|
|
78
|
-
|
|
87
|
+
/**
|
|
88
|
+
* The shop's prices, a page at a time. Filter by product, currency, app, or whether it is on sale
|
|
89
|
+
* (`active`). `count` is how many match in all.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const { items, nextCursor, count } = await shop.admin.listPrices(collectionId, { productId: 'soap', active: true })
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
function listPrices(collectionId: string, params?: ShopPriceListParams): Promise<ListResult<ShopPrice>>;
|
|
79
97
|
/**
|
|
80
98
|
* Put a product (or variant) on sale, or change its price in that currency (one price per product per
|
|
81
99
|
* currency). @throws `INVALID_INPUT`, `APP_NOT_INSTALLED`
|
|
@@ -86,8 +104,18 @@ export declare namespace shop {
|
|
|
86
104
|
function removePrice(collectionId: string, priceId: string): Promise<{
|
|
87
105
|
deleted: true;
|
|
88
106
|
}>;
|
|
89
|
-
/**
|
|
90
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Shop orders, newest first, a page at a time. Unpaid and expired checkouts are left out unless asked
|
|
109
|
+
* for. `count` is how many match in all.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* let page = await shop.admin.listOrders(collectionId, { status: 'paid', limit: 50 })
|
|
114
|
+
* page.items // ShopAdminOrder[]
|
|
115
|
+
* while (page.nextCursor) page = await shop.admin.listOrders(collectionId, { status: 'paid', limit: 50, cursor: page.nextCursor })
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
function listOrders(collectionId: string, params?: ShopOrderListParams): Promise<ListResult<ShopAdminOrder>>;
|
|
91
119
|
function getOrder(collectionId: string, orderId: string): Promise<ShopAdminOrder>;
|
|
92
120
|
/**
|
|
93
121
|
* Send some or all of what's left, with tracking. The held stock leaves; the buyer's "shipped" email
|
package/dist/api/shop.js
CHANGED
|
@@ -29,11 +29,12 @@ export var shop;
|
|
|
29
29
|
shop.config = config;
|
|
30
30
|
/**
|
|
31
31
|
* What is for sale, in the shop's currency, with stock (`inStock`, `available`) and whether the buyer must
|
|
32
|
-
* sign in first (`needsSignIn`: a proof or access goes to an account).
|
|
32
|
+
* sign in first (`needsSignIn`: a proof or access goes to an account). Everything for sale comes in one
|
|
33
|
+
* answer (`nextCursor` is always null), with the shop's `currency` beside the list.
|
|
33
34
|
*
|
|
34
35
|
* @example
|
|
35
36
|
* ```typescript
|
|
36
|
-
* const { items } = await shop.products(collectionId)
|
|
37
|
+
* const { items, currency } = await shop.products(collectionId)
|
|
37
38
|
* items.map((p) => `${p.name}: ${formatMoney(p.amount, p.currency)}${p.inStock ? '' : ' (sold out)'}`)
|
|
38
39
|
* ```
|
|
39
40
|
*/
|
|
@@ -71,7 +72,18 @@ export var shop;
|
|
|
71
72
|
return request(`${pub(collectionId)}/orders/by-session/${encodeURIComponent(sessionId)}`);
|
|
72
73
|
}
|
|
73
74
|
shop.orderBySession = orderBySession;
|
|
74
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* The signed-in buyer's orders, newest first, with their download links, a page at a time. `count` is how
|
|
77
|
+
* many they have in all.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* let page = await shop.myOrders(collectionId, { limit: 20 })
|
|
82
|
+
* page.items // ShopBuyerOrder[]
|
|
83
|
+
* if (page.nextCursor) page = await shop.myOrders(collectionId, { limit: 20, cursor: page.nextCursor })
|
|
84
|
+
* ```
|
|
85
|
+
* @throws `SIGN_IN_REQUIRED`
|
|
86
|
+
*/
|
|
75
87
|
async function myOrders(collectionId, params) {
|
|
76
88
|
return request(`${pub(collectionId)}/orders/mine${qs(params)}`);
|
|
77
89
|
}
|
|
@@ -111,6 +123,15 @@ export var shop;
|
|
|
111
123
|
return request(`${adm(collectionId)}/connect/status`);
|
|
112
124
|
}
|
|
113
125
|
admin.connectStatus = connectStatus;
|
|
126
|
+
/**
|
|
127
|
+
* The shop's prices, a page at a time. Filter by product, currency, app, or whether it is on sale
|
|
128
|
+
* (`active`). `count` is how many match in all.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* const { items, nextCursor, count } = await shop.admin.listPrices(collectionId, { productId: 'soap', active: true })
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
114
135
|
async function listPrices(collectionId, params) {
|
|
115
136
|
return request(`${adm(collectionId)}/prices${qs(params)}`);
|
|
116
137
|
}
|
|
@@ -132,7 +153,17 @@ export var shop;
|
|
|
132
153
|
return del(`${adm(collectionId)}/prices/${encodeURIComponent(priceId)}`);
|
|
133
154
|
}
|
|
134
155
|
admin.removePrice = removePrice;
|
|
135
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Shop orders, newest first, a page at a time. Unpaid and expired checkouts are left out unless asked
|
|
158
|
+
* for. `count` is how many match in all.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* let page = await shop.admin.listOrders(collectionId, { status: 'paid', limit: 50 })
|
|
163
|
+
* page.items // ShopAdminOrder[]
|
|
164
|
+
* while (page.nextCursor) page = await shop.admin.listOrders(collectionId, { status: 'paid', limit: 50, cursor: page.nextCursor })
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
136
167
|
async function listOrders(collectionId, params) {
|
|
137
168
|
return request(`${adm(collectionId)}/orders${qs(params)}`);
|
|
138
169
|
}
|