@universal-everything/sdk-core 1.2.0 → 1.3.0-dev.483b732
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/index.d.ts +64 -8
- package/dist/index.js +33 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -184,9 +184,10 @@ type ChainStatus = {
|
|
|
184
184
|
type CoveredBy = {
|
|
185
185
|
subscriptionId: string;
|
|
186
186
|
/**
|
|
187
|
-
* `self` = owned by the caller's account
|
|
188
|
-
*
|
|
189
|
-
*
|
|
187
|
+
* `self` = owned by the caller's account (its allowance pays for every
|
|
188
|
+
* profile it holds). `other` = a live subscription of another account that
|
|
189
|
+
* lists this profile as a member — it pays once the holder's own allowance
|
|
190
|
+
* is spent.
|
|
190
191
|
*/
|
|
191
192
|
owner: "self" | "other";
|
|
192
193
|
tier: string;
|
|
@@ -283,10 +284,20 @@ type Catalog = {
|
|
|
283
284
|
store: BillingStore;
|
|
284
285
|
plans: CatalogPlan[];
|
|
285
286
|
};
|
|
286
|
-
/**
|
|
287
|
+
/** A profile a subscription pays for (its holder may be another account). */
|
|
288
|
+
type SubscriptionMember = {
|
|
289
|
+
address: string;
|
|
290
|
+
/** Added by a client sync rather than by hand. */
|
|
291
|
+
auto: boolean;
|
|
292
|
+
attachedAt: string;
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* One entry of `GET /v1/subscriptions`: a subscription of the caller's account
|
|
296
|
+
* (`owner: "self"`), or a live subscription of another account that covers
|
|
297
|
+
* some of the caller's profiles (`owner: "other"`, listed after the own ones).
|
|
298
|
+
*/
|
|
287
299
|
type SubscriptionSummary = {
|
|
288
300
|
subscriptionId: string;
|
|
289
|
-
/** Always `self` today; `other` (a subscription that only covers one of your profiles) arrives with explicit membership. */
|
|
290
301
|
owner: "self" | "other";
|
|
291
302
|
tier: string;
|
|
292
303
|
status: string;
|
|
@@ -296,10 +307,28 @@ type SubscriptionSummary = {
|
|
|
296
307
|
/** Bought in the store sandbox (TestFlight / App Review / sandbox tester) — no real money. */
|
|
297
308
|
sandbox: boolean;
|
|
298
309
|
currentPeriodEnd: string | null;
|
|
299
|
-
/** Where Manage goes: `stripe` ⇒ {@link RelayerClient.createPortalSession}; `apple` / `google` ⇒ the store; `admin` ⇒ nothing. */
|
|
310
|
+
/** Where Manage goes: `stripe` ⇒ {@link RelayerClient.createPortalSession}; `apple` / `google` ⇒ the store; `admin` ⇒ nothing; `none` ⇒ another account's subscription, read-only. */
|
|
300
311
|
manage: {
|
|
301
|
-
kind: "stripe" | "apple" | "google" | "admin";
|
|
312
|
+
kind: "stripe" | "apple" | "google" | "admin" | "none";
|
|
302
313
|
};
|
|
314
|
+
/** `owner: "self"` only — the profiles it pays for beyond the account's own. */
|
|
315
|
+
members?: SubscriptionMember[];
|
|
316
|
+
/** `owner: "other"` only — which of the caller's profiles it covers (lowercase). */
|
|
317
|
+
covers?: string[];
|
|
318
|
+
};
|
|
319
|
+
/** Result of {@link RelayerClient.addSubscriptionProfile}. */
|
|
320
|
+
type AddSubscriptionProfileResult = {
|
|
321
|
+
subscriptionId: string;
|
|
322
|
+
address: string;
|
|
323
|
+
status: "attached";
|
|
324
|
+
auto: boolean;
|
|
325
|
+
attachedAt: string;
|
|
326
|
+
}
|
|
327
|
+
/** An `auto` add of a profile the owner removed — left removed. */
|
|
328
|
+
| {
|
|
329
|
+
subscriptionId: string;
|
|
330
|
+
address: string;
|
|
331
|
+
status: "detached";
|
|
303
332
|
};
|
|
304
333
|
/**
|
|
305
334
|
* Result of {@link RelayerClient.submitAppleTransaction} /
|
|
@@ -703,6 +732,33 @@ declare class WalletKitClient {
|
|
|
703
732
|
listSubscriptions(): Promise<{
|
|
704
733
|
subscriptions: SubscriptionSummary[];
|
|
705
734
|
}>;
|
|
735
|
+
/** The profiles one of the caller's subscriptions pays for. */
|
|
736
|
+
listSubscriptionProfiles(subscriptionId: string): Promise<{
|
|
737
|
+
profiles: SubscriptionMember[];
|
|
738
|
+
}>;
|
|
739
|
+
/**
|
|
740
|
+
* Have one of the caller's subscriptions pay for a profile — typically one
|
|
741
|
+
* held by the person's other account (a second email, or email + the mobile
|
|
742
|
+
* app). One shared pool: the subscription pays once the holder's own
|
|
743
|
+
* allowance is spent. No `proof` is needed for a profile the caller's
|
|
744
|
+
* account holds; otherwise pass a SIWE proof (the `POST /v1/profiles/attach` body: a SIWE message whose Address is the profile) signed
|
|
745
|
+
* by a key holding ADDCONTROLLER + EDITPERMISSIONS + SIGN +
|
|
746
|
+
* EXECUTE_RELAY_CALL on the profile (`403 insufficient_permissions` names
|
|
747
|
+
* what's missing). Set `auto` from a background sync: it never re-adds a
|
|
748
|
+
* profile the owner removed. `404 subscription_not_found` = not the
|
|
749
|
+
* caller's subscription.
|
|
750
|
+
*/
|
|
751
|
+
addSubscriptionProfile(subscriptionId: string, input: {
|
|
752
|
+
address: string;
|
|
753
|
+
auto?: boolean;
|
|
754
|
+
proof?: {
|
|
755
|
+
message: string;
|
|
756
|
+
signature: string;
|
|
757
|
+
chainId?: number;
|
|
758
|
+
};
|
|
759
|
+
}): Promise<AddSubscriptionProfileResult>;
|
|
760
|
+
/** Stop paying for a profile. A later `auto` add leaves it removed. */
|
|
761
|
+
removeSubscriptionProfile(subscriptionId: string, address: string): Promise<void>;
|
|
706
762
|
/**
|
|
707
763
|
* Hand a StoreKit 2 purchase to the relayer (DEV-16570): pass the
|
|
708
764
|
* transaction's `jwsRepresentation` after a purchase and for every
|
|
@@ -776,4 +832,4 @@ declare class IdentityError extends Error {
|
|
|
776
832
|
constructor(code: IdentityErrorCode, message: string);
|
|
777
833
|
}
|
|
778
834
|
|
|
779
|
-
export { type BillingStore, type Catalog, type CatalogDefaultPrice, type CatalogPlan, type CatalogProduct, type ChainStatus, type CheckoutSession, type ControlProof, type ControllerSummary, type CoveredBy, type DeployProfileInput, type DeployProfileMultiChainResponse, type DeployProfileResponse, type DeployProfileSingleChainResponse, type DeployQueueStatus, type ExportCompleteResponse, type ExportRequestInput, type ExportRequestResponse, type ExportedKey, type ExtendVerdict, type ExtendVerdictReason, type FreeDefaultSnapshot, type Hex, IdentityError, type IdentityErrorCode, type IdentityProvider, type ImportBeginResponse, type ImportCompleteInput, type ImportCompleteResponse, type IpfsUploadTokenResponse, KeyCustodyError, type KeyCustodyErrorCode, type KeyCustodyOpContext, type KeyCustodyProvider, type Me, type NonceResponse, type OpContext, type OpenCheckoutInput, type Profile, type ProfileStatus, type ProfileWithChains, type QuotaSnapshot, type RelaySponsoredInput, type RelaySponsoredResponse, type SignLsp25Input, type SignLsp25Response, type SignMessageResponse, type SignTransactionInput, type SignTransactionResponse, type SignTxRequest, type StoreTransactionResult, type Subject, type SubscriptionResponse, type SubscriptionSnapshot, type SubscriptionSummary, TIER_ERROR_CODES, TierError, type VerifiedToken, type VerifyOptions, type Wallet, type WalletInfo, WalletKitClient, type WalletKitClientConfig, WalletKitError, createWalletKitClient };
|
|
835
|
+
export { type AddSubscriptionProfileResult, type BillingStore, type Catalog, type CatalogDefaultPrice, type CatalogPlan, type CatalogProduct, type ChainStatus, type CheckoutSession, type ControlProof, type ControllerSummary, type CoveredBy, type DeployProfileInput, type DeployProfileMultiChainResponse, type DeployProfileResponse, type DeployProfileSingleChainResponse, type DeployQueueStatus, type ExportCompleteResponse, type ExportRequestInput, type ExportRequestResponse, type ExportedKey, type ExtendVerdict, type ExtendVerdictReason, type FreeDefaultSnapshot, type Hex, IdentityError, type IdentityErrorCode, type IdentityProvider, type ImportBeginResponse, type ImportCompleteInput, type ImportCompleteResponse, type IpfsUploadTokenResponse, KeyCustodyError, type KeyCustodyErrorCode, type KeyCustodyOpContext, type KeyCustodyProvider, type Me, type NonceResponse, type OpContext, type OpenCheckoutInput, type Profile, type ProfileStatus, type ProfileWithChains, type QuotaSnapshot, type RelaySponsoredInput, type RelaySponsoredResponse, type SignLsp25Input, type SignLsp25Response, type SignMessageResponse, type SignTransactionInput, type SignTransactionResponse, type SignTxRequest, type StoreTransactionResult, type Subject, type SubscriptionMember, type SubscriptionResponse, type SubscriptionSnapshot, type SubscriptionSummary, TIER_ERROR_CODES, TierError, type VerifiedToken, type VerifyOptions, type Wallet, type WalletInfo, WalletKitClient, type WalletKitClientConfig, WalletKitError, createWalletKitClient };
|
package/dist/index.js
CHANGED
|
@@ -191,6 +191,39 @@ var WalletKitClient = class {
|
|
|
191
191
|
async listSubscriptions() {
|
|
192
192
|
return this.#request("GET", "/v1/subscriptions");
|
|
193
193
|
}
|
|
194
|
+
/** The profiles one of the caller's subscriptions pays for. */
|
|
195
|
+
async listSubscriptionProfiles(subscriptionId) {
|
|
196
|
+
return this.#request(
|
|
197
|
+
"GET",
|
|
198
|
+
`/v1/subscriptions/${encodeURIComponent(subscriptionId)}/profiles`
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Have one of the caller's subscriptions pay for a profile — typically one
|
|
203
|
+
* held by the person's other account (a second email, or email + the mobile
|
|
204
|
+
* app). One shared pool: the subscription pays once the holder's own
|
|
205
|
+
* allowance is spent. No `proof` is needed for a profile the caller's
|
|
206
|
+
* account holds; otherwise pass a SIWE proof (the `POST /v1/profiles/attach` body: a SIWE message whose Address is the profile) signed
|
|
207
|
+
* by a key holding ADDCONTROLLER + EDITPERMISSIONS + SIGN +
|
|
208
|
+
* EXECUTE_RELAY_CALL on the profile (`403 insufficient_permissions` names
|
|
209
|
+
* what's missing). Set `auto` from a background sync: it never re-adds a
|
|
210
|
+
* profile the owner removed. `404 subscription_not_found` = not the
|
|
211
|
+
* caller's subscription.
|
|
212
|
+
*/
|
|
213
|
+
async addSubscriptionProfile(subscriptionId, input) {
|
|
214
|
+
return this.#request(
|
|
215
|
+
"POST",
|
|
216
|
+
`/v1/subscriptions/${encodeURIComponent(subscriptionId)}/profiles`,
|
|
217
|
+
input
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
/** Stop paying for a profile. A later `auto` add leaves it removed. */
|
|
221
|
+
async removeSubscriptionProfile(subscriptionId, address) {
|
|
222
|
+
await this.#request(
|
|
223
|
+
"DELETE",
|
|
224
|
+
`/v1/subscriptions/${encodeURIComponent(subscriptionId)}/profiles/${encodeURIComponent(address)}`
|
|
225
|
+
);
|
|
226
|
+
}
|
|
194
227
|
/**
|
|
195
228
|
* Hand a StoreKit 2 purchase to the relayer (DEV-16570): pass the
|
|
196
229
|
* transaction's `jwsRepresentation` after a purchase and for every
|