@proveanything/smartlinks 1.0.39 → 1.0.40

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.
@@ -1,3 +1,4 @@
1
+ import type { UserAccountRegistrationRequest } from "../types/auth";
1
2
  export type LoginResponse = {
2
3
  id: string;
3
4
  name: string;
@@ -70,6 +71,10 @@ export declare namespace auth {
70
71
  * Validates if the user has access to the resource, and returns a JWT
71
72
  */
72
73
  function requestPublicJWT(collectionId: string, productId: string, proofId: string): Promise<string>;
74
+ /**
75
+ * Tries to register a new user account. Can return a bearer token, or a Firebase token
76
+ */
77
+ function registerUser(user: UserAccountRegistrationRequest): Promise<LoginResponse>;
73
78
  /**
74
79
  * Admin: Get a user bearer token (impersonation/automation).
75
80
  * POST /admin/auth/userToken
package/dist/api/auth.js CHANGED
@@ -60,6 +60,17 @@ export var auth;
60
60
  return post("/public/auth/requestJWT", { collectionId, productId, proofId });
61
61
  }
62
62
  auth.requestPublicJWT = requestPublicJWT;
63
+ /**
64
+ * Tries to register a new user account. Can return a bearer token, or a Firebase token
65
+ */
66
+ async function registerUser(user) {
67
+ // Use the provided token, or the one from getApiHeaders
68
+ const res = await post("/public/auth/register", user);
69
+ if (res.bearerToken)
70
+ setBearerToken(res.bearerToken);
71
+ return res;
72
+ }
73
+ auth.registerUser = registerUser;
63
74
  /**
64
75
  * Admin: Get a user bearer token (impersonation/automation).
65
76
  * POST /admin/auth/userToken
@@ -19,6 +19,11 @@ export declare namespace proof {
19
19
  * PUT /admin/collection/:collectionId/product/:productId/proof/:proofId
20
20
  */
21
21
  function update(collectionId: string, productId: string, proofId: string, values: any): Promise<ProofResponse>;
22
+ /**
23
+ * Claim a proof for a product.
24
+ * PUT /public/collection/:collectionId/product/:productId/proof/:proofId
25
+ */
26
+ function claim(collectionId: string, productId: string, proofId: string, values: any): Promise<ProofResponse>;
22
27
  /**
23
28
  * Delete a proof for a product (admin only).
24
29
  * DELETE /admin/collection/:collectionId/product/:productId/proof/:proofId
package/dist/api/proof.js CHANGED
@@ -39,6 +39,15 @@ export var proof;
39
39
  return put(path, values);
40
40
  }
41
41
  proof.update = update;
42
+ /**
43
+ * Claim a proof for a product.
44
+ * PUT /public/collection/:collectionId/product/:productId/proof/:proofId
45
+ */
46
+ async function claim(collectionId, productId, proofId, values) {
47
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}`;
48
+ return put(path, values);
49
+ }
50
+ proof.claim = claim;
42
51
  /**
43
52
  * Delete a proof for a product (admin only).
44
53
  * DELETE /admin/collection/:collectionId/product/:productId/proof/:proofId
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { initializeApi, request, sendCustomProxyMessage } from "./http";
2
2
  export * from "./api";
3
3
  export * from "./types";
4
4
  export type { LoginResponse, VerifyTokenResponse, AccountInfoResponse, } from "./api/auth";
5
+ export type { UserAccountRegistrationRequest, } from "./types/auth";
5
6
  export type { AttestationResponse, AttestationCreateRequest, AttestationUpdateRequest, } from "./types/attestation";
6
7
  export type { BatchResponse, BatchCreateRequest, BatchUpdateRequest, } from "./types/batch";
7
8
  export type { VariantResponse, VariantCreateRequest, VariantUpdateRequest, } from "./types/variant";
@@ -0,0 +1,9 @@
1
+ export type UserAccountRegistrationRequest = {
2
+ name: string;
3
+ email?: string;
4
+ phone?: string;
5
+ password?: string;
6
+ sendAccountConfirmation?: boolean;
7
+ collectionId?: string;
8
+ tokenType?: 'bearer' | 'firebase';
9
+ };
@@ -0,0 +1,3 @@
1
+ // src/types/auth.ts
2
+ // Auth-related request/response type shapes used by the SDK.
3
+ export {};
@@ -7,3 +7,4 @@ export * from "./asset";
7
7
  export * from "./batch";
8
8
  export * from "./variant";
9
9
  export * from "./claimSet";
10
+ export * from "./auth";
@@ -9,3 +9,4 @@ export * from "./asset";
9
9
  export * from "./batch";
10
10
  export * from "./variant";
11
11
  export * from "./claimSet";
12
+ export * from "./auth";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",