@wvdsh/api 0.1.71 → 0.1.73

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.
@@ -84,6 +84,17 @@ export declare const LEADERBOARD_METADATA_LIMITS: {
84
84
  readonly MAX_STRING_VALUE_LENGTH: 256;
85
85
  readonly MAX_TOTAL_BYTES: 2048;
86
86
  };
87
+ export declare const PAID_CONTENT_TYPE: {
88
+ readonly DURABLE: "DURABLE";
89
+ readonly CONSUMABLE: "CONSUMABLE";
90
+ };
91
+ export type PaidContentType = (typeof PAID_CONTENT_TYPE)[keyof typeof PAID_CONTENT_TYPE];
92
+ export declare const FULFILL_PURCHASE_STATUS: {
93
+ readonly FULFILLED: "FULFILLED";
94
+ readonly ALREADY_FULFILLED: "ALREADY_FULFILLED";
95
+ readonly NOT_FOUND: "NOT_FOUND";
96
+ };
97
+ export type FulfillPurchaseStatus = (typeof FULFILL_PURCHASE_STATUS)[keyof typeof FULFILL_PURCHASE_STATUS];
87
98
  export declare const UGC_TYPE: {
88
99
  readonly SCREENSHOT: 0;
89
100
  readonly VIDEO: 1;
@@ -137,7 +148,6 @@ export declare const IFRAME_MESSAGE_TYPE: {
137
148
  readonly GAMEPLAY_JWT_READY: "GameplayJwtReady";
138
149
  readonly END_SESSION: "EndSession";
139
150
  readonly TRIGGER_PAYWALL: "TriggerPaywall";
140
- readonly ENTITLEMENTS_GRANTED: "EntitlementsGranted";
141
151
  readonly LINK_COPIED: "LinkCopied";
142
152
  };
143
153
  export declare const GAME_ISOLATION_ERROR_PATTERN: RegExp;
@@ -201,9 +211,7 @@ export type IFrameEventPayloadMap = {
201
211
  };
202
212
  [IFRAME_MESSAGE_TYPE.TRIGGER_PAYWALL]: {
203
213
  purchased: boolean;
204
- };
205
- [IFRAME_MESSAGE_TYPE.ENTITLEMENTS_GRANTED]: {
206
- contentIdentifiers: string[];
214
+ type?: PaidContentType;
207
215
  };
208
216
  [IFRAME_MESSAGE_TYPE.LOADING_FAILED]: {
209
217
  message: string;
@@ -62,6 +62,17 @@ export const LEADERBOARD_METADATA_LIMITS = {
62
62
  MAX_STRING_VALUE_LENGTH: 256,
63
63
  MAX_TOTAL_BYTES: 2048
64
64
  };
65
+ // ========== PAID CONTENT ==========
66
+ // DURABLE: purchased once, never expires, gates build files. CONSUMABLE: repeatable, fulfilled by the game.
67
+ export const PAID_CONTENT_TYPE = {
68
+ DURABLE: 'DURABLE',
69
+ CONSUMABLE: 'CONSUMABLE'
70
+ };
71
+ export const FULFILL_PURCHASE_STATUS = {
72
+ FULFILLED: 'FULFILLED',
73
+ ALREADY_FULFILLED: 'ALREADY_FULFILLED',
74
+ NOT_FOUND: 'NOT_FOUND'
75
+ };
65
76
  // ========== USER GENERATED CONTENT ==========
66
77
  export const UGC_TYPE = {
67
78
  SCREENSHOT: 0,
@@ -117,7 +128,6 @@ export const IFRAME_MESSAGE_TYPE = {
117
128
  GAMEPLAY_JWT_READY: 'GameplayJwtReady',
118
129
  END_SESSION: 'EndSession',
119
130
  TRIGGER_PAYWALL: 'TriggerPaywall',
120
- ENTITLEMENTS_GRANTED: 'EntitlementsGranted',
121
131
  LINK_COPIED: 'LinkCopied'
122
132
  };
123
133
  // Errors that mean a threaded build ran without cross-origin isolation, only meaningful when crossOriginIsolated is false.
@@ -355,10 +355,30 @@ export type PublicApiType = {
355
355
  }>>;
356
356
  };
357
357
  paidContent: {
358
+ fulfillPurchase: FunctionReference<"mutation", "public", {
359
+ purchaseId: Id<"userPaidContent">;
360
+ }, {
361
+ status: "FULFILLED" | "ALREADY_FULFILLED" | "NOT_FOUND";
362
+ }>;
363
+ listNewAndUnfulfilled: FunctionReference<"query", "public", {
364
+ since: number;
365
+ }, Array<{
366
+ contentIdentifier: string;
367
+ fulfilled: boolean;
368
+ purchaseId: Id<"userPaidContent">;
369
+ purchasedAt: number;
370
+ receiptJwt: string;
371
+ type: "DURABLE" | "CONSUMABLE";
372
+ }>>;
358
373
  mockPurchase: FunctionReference<"mutation", "public", {
359
374
  contentIdentifier: string;
360
375
  }, {
361
- granted: boolean;
376
+ contentIdentifier: string;
377
+ fulfilled: boolean;
378
+ purchaseId: Id<"userPaidContent">;
379
+ purchasedAt: number;
380
+ receiptJwt: string;
381
+ type: "DURABLE" | "CONSUMABLE";
362
382
  }>;
363
383
  };
364
384
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wvdsh/api",
3
- "version": "0.1.71",
3
+ "version": "0.1.73",
4
4
  "description": "Public API types and shared constants for the Wavedash platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",