@andco/sdk-svelte 0.0.1 → 0.0.2

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 (2) hide show
  1. package/README.md +10 -9
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -99,7 +99,7 @@ why an `$effect` reading `andco.current` re-runs on a sign-in but not on a
99
99
  silent refresh. `useAndcoAuthed().current` is the same change rule narrowed to
100
100
  `AndcoClientAuthed | null`, for the "do this once signed in" path.
101
101
 
102
- `useAndcoSession().current` changes on *every* republication, rotations
102
+ `useAndcoSession().current` changes on _every_ republication, rotations
103
103
  included — reach for it when you need the credential as data, such as an
104
104
  expiry, or to observe the unresolved-to-anonymous transition `useAndco`
105
105
  deliberately hides. `useAndcoUser().current` changes only when the person
@@ -115,24 +115,25 @@ changes — identifier, name, email, or avatar.
115
115
 
116
116
  ## Intents
117
117
 
118
- `andco.intents` is domain-neutral: it only knows how to create, read, execute, and observe an
119
- Intent generically, regardless of the domain that Intent belongs to. Bind it to the signed-in
120
- identity once, then use it directly:
118
+ Deposit and withdrawal creation live on the AndCo Bank Resource Server Definition, not on the
119
+ core client's domain-neutral `intents`. Bind it to the signed-in identity once, then use it:
121
120
 
122
121
  ```svelte
123
122
  <script lang="ts">
124
123
  import { useAndcoAuthed } from "@andco/sdk-svelte";
124
+ import { Bank } from "@andco/bank-sdk";
125
125
 
126
126
  const andco = useAndcoAuthed();
127
+ const bankDefinition = new Bank({ clientId: "client_123", resource: "https://api.andco.cl" });
128
+ const bank = $derived(andco.current ? bankDefinition.use(andco.current) : null);
127
129
  </script>
128
130
  ```
129
131
 
130
132
  ```svelte
131
133
  <script lang="ts">
132
134
  async function topUp() {
133
- if (!andco.current) return;
134
- const { data: intent, error } = await andco.current.intents.create(
135
- "deposit",
135
+ if (!bank) return;
136
+ const { data: deposit, error } = await bank.intents.createDeposit(
136
137
  {
137
138
  expires_in: "30 minutes",
138
139
  amount: { currency: "CLP", suggested: "40000", editable: false },
@@ -154,8 +155,8 @@ its DOM and code stay Andco's, never the Project's. It takes the same props as `
154
155
  (`authorization`, `busy`, `disabled`, `locale`, `release`, `themeMode`, and the `onready` /
155
156
  `onactivate` / `oncomplete` / `ondismiss` / `onerror` callbacks); there is currently no prop to
156
157
  target a specific, already-created Intent, and `oncomplete` takes no arguments — read the Intent's
157
- state with `andco.current.intents.get(intentId)` after it fires, or through
158
- `andco.current.intents.events(intentId)` / `andco.current.intents.subscribe(...)`, rather than
158
+ state with `bank.intents.get(intentId)` after it fires, or through `bank.intents.getEvents(intentId)`
159
+ or the domain-specific listeners (`onIntentDepositEvent`, `onIntentWithdrawalEvent`), rather than
159
160
  expecting it on the callback.
160
161
 
161
162
  ```svelte
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andco/sdk-svelte",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -23,7 +23,7 @@
23
23
  "svelte": "^5.0.0"
24
24
  },
25
25
  "dependencies": {
26
- "@andco/sdk": "0.0.1"
26
+ "@andco/sdk": "0.0.2"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@sveltejs/package": "^2.0.0",