@viceme-ai/sdk 0.6.1 → 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.
Files changed (40) hide show
  1. package/README.md +29 -7
  2. package/dist/capability-mount.d.ts +2 -0
  3. package/dist/capability-mount.d.ts.map +1 -1
  4. package/dist/chunks/{client-w9vih8Ng.js → client-C1Sw400H.js} +429 -294
  5. package/dist/chunks/client-C1Sw400H.js.map +1 -0
  6. package/dist/chunks/integration-CTsnJ8mN.js +38 -0
  7. package/dist/chunks/integration-CTsnJ8mN.js.map +1 -0
  8. package/dist/chunks/version-CAPPYmfK.js +6 -0
  9. package/dist/chunks/{version-uPTHb89K.js.map → version-CAPPYmfK.js.map} +1 -1
  10. package/dist/core/capabilities.d.ts +1 -0
  11. package/dist/core/capabilities.d.ts.map +1 -1
  12. package/dist/core/client.d.ts.map +1 -1
  13. package/dist/core/presentation.d.ts +7 -0
  14. package/dist/core/presentation.d.ts.map +1 -1
  15. package/dist/danmaku/mount.d.ts.map +1 -1
  16. package/dist/danmaku.js +117 -91
  17. package/dist/danmaku.js.map +1 -1
  18. package/dist/engagement/integration.d.ts +15 -0
  19. package/dist/engagement/integration.d.ts.map +1 -0
  20. package/dist/generated/public-contract.d.ts +15 -1
  21. package/dist/generated/public-contract.d.ts.map +1 -1
  22. package/dist/index.js +7 -6
  23. package/dist/index.js.map +1 -1
  24. package/dist/loader/auto-loader.d.ts.map +1 -1
  25. package/dist/manifest.json +37 -28
  26. package/dist/session/session.d.ts +12 -0
  27. package/dist/session/session.d.ts.map +1 -1
  28. package/dist/testing.js +1 -1
  29. package/dist/tip/index.d.ts +2 -0
  30. package/dist/tip/index.d.ts.map +1 -1
  31. package/dist/tip/mount.d.ts.map +1 -1
  32. package/dist/tip.js +211 -194
  33. package/dist/tip.js.map +1 -1
  34. package/dist/transport/transport.d.ts.map +1 -1
  35. package/dist/version.d.ts +1 -1
  36. package/dist/viceme.min.js +46 -4
  37. package/dist/viceme.min.js.map +1 -1
  38. package/package.json +1 -1
  39. package/dist/chunks/client-w9vih8Ng.js.map +0 -1
  40. package/dist/chunks/version-uPTHb89K.js +0 -6
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @viceme-ai/sdk
2
2
 
3
- ViceMe browser SDK for Shop-hosted engagement and origin-bound Website Work access.
3
+ ViceMe browser SDK for Shop-hosted engagement and Website Work access.
4
4
 
5
5
  The release PR atomically owns the package version, runtime manifest, and
6
6
  changelog update. During the current preview stage, publication does not
@@ -58,7 +58,7 @@ if (!target) throw new Error('ViceMe target missing');
58
58
 
59
59
  const results = await Promise.allSettled([
60
60
  mountDanmaku(client, { target, theme: 'auto' }),
61
- mountTip(client, { target, theme: 'auto' }),
61
+ mountTip(client, { target, theme: 'auto', presentation: 'integrated' }),
62
62
  ]);
63
63
  const mounted = results.flatMap((result) => (result.status === 'fulfilled' ? [result.value] : []));
64
64
 
@@ -68,6 +68,9 @@ client.destroy();
68
68
 
69
69
  Run those cleanup calls from the owning component's unmount path or another
70
70
  explicit lifecycle boundary, not from `pagehide` (which also covers bfcache).
71
+ The integrated presentation uses the danmaku bar as its only visible launcher
72
+ and opens the official Tip dialog. Standalone `mountTip()` remains inline by
73
+ default.
71
74
 
72
75
  `createViceMe` and `ready()` are purely local and never contact Shop. A live client reports
73
76
  build support for `danmaku` and `tip`; Shop remains authoritative for whether a
@@ -86,12 +89,29 @@ use. They expose `client.auth`, `client.access`, and `client.checkout`; login,
86
89
  explicit follow, and hosted checkout remain ViceMe-owned UI. The host never
87
90
  receives a general ViceMe session or payment credential. Tests can inject a
88
91
  deterministic transport and presenter through `@viceme-ai/sdk/testing`.
92
+ Calling `client.destroy()` cancels in-flight access requests, closes the active
93
+ SDK-owned sign-in or checkout layer, and rejects the interrupted call with
94
+ `CLIENT_DESTROYED`; late responses cannot restore the in-memory Work token.
95
+ Request cancellation and timeouts remain effective until the parsed response is
96
+ delivered. Cancelling the client's optional `signal` preserves the caller's
97
+ `Error` reason; a request timeout rejects with retryable `NETWORK_TIMEOUT`.
98
+ A cancelled response cannot establish a Work session even if its body has
99
+ already finished parsing.
100
+
101
+ The current Website Access release accepts any valid HTTP(S) host Origin and
102
+ does not require DNS TXT verification. Session tokens remain bound to the
103
+ Origin observed when they were issued, but that Origin is not compared with a
104
+ registered allowlist. The hosted checkout iframe likewise has no parent-Origin
105
+ `frame-ancestors` restriction; its signed launch context, expiry, official
106
+ Shop URL, and server-authoritative entitlement checks remain enforced.
89
107
 
90
108
  Website access login renders the work-bound WeChat QR code directly in the SDK
91
109
  layer. Paid access keeps desktop QR payment and WeChat JSAPI in that layer;
92
110
  mobile H5/WAP payment may open a provider page or app. The original page polls
93
111
  the server-authoritative access decision and closes the layer after entitlement
94
- is active. This behavior does not change the separate Tip Widget flow.
112
+ is active. Before login, the consent layer shows only the creator avatar,
113
+ display name, published Work count, and the current Work title, summary, and
114
+ cover. This behavior does not change the separate Tip Widget flow.
95
115
 
96
116
  ```ts
97
117
  const decisions = await client.access.checkMany(['members', 'pro-tools']);
@@ -110,10 +130,12 @@ scroll bucket, and sends only the opaque anchor to the hosted iframe. Destroying
110
130
  the mount removes its nodes, listeners, debounce timer, and location poll.
111
131
 
112
132
  The Tip mount sends no amount, provider, token, or application ID. It enables
113
- interaction only after a trusted resize handshake. Shop resets its hosted
114
- payment surface on Escape before sending close; the SDK forwards sanitized
115
- close and paid notifications, and removes its iframe, timer, media listener,
116
- and message listener on destroy.
133
+ interaction only after a trusted resize handshake. In integrated mode it also
134
+ accepts open requests only from the matching trusted danmaku controls, then
135
+ restores focus there after close. Shop resets its hosted payment surface on
136
+ Escape before sending close; the SDK forwards sanitized close and paid
137
+ notifications, and removes its iframe, timer, media listener, and message
138
+ listener on destroy.
117
139
 
118
140
  ## Headless Tip
119
141
 
@@ -3,6 +3,8 @@ export interface CapabilityMountOptions {
3
3
  /** Mount host element; the capability owns its Shadow DOM subtree. */
4
4
  target: Element;
5
5
  theme: 'light' | 'dark' | 'auto';
6
+ /** Use the shared danmaku controls as the visible Tip launcher. */
7
+ presentation?: 'inline' | 'integrated';
6
8
  /** Abort a mount that has not completed and destroy it after completion. */
7
9
  signal?: AbortSignal;
8
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"capability-mount.d.ts","sourceRoot":"","sources":["../src/capability-mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,sBAAsB;IACrC,sEAAsE;IACtE,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC,4EAA4E;IAC5E,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,+EAA+E;AAC/E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,MAAM,uBAAuB,GAAG,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,sBAAsB,KAC5B,OAAO,CAAC,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"capability-mount.d.ts","sourceRoot":"","sources":["../src/capability-mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,sBAAsB;IACrC,sEAAsE;IACtE,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC,mEAAmE;IACnE,YAAY,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IACvC,4EAA4E;IAC5E,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,+EAA+E;AAC/E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,MAAM,uBAAuB,GAAG,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,sBAAsB,KAC5B,OAAO,CAAC,qBAAqB,CAAC,CAAC"}