@base44-preview/sdk 0.8.63-pr.389.0df9331 → 0.8.63-pr.390.31c1120

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/actor.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  /**
2
- * Type-only base class for Actors.
2
+ * Type definitions for the actor base class.
3
3
  *
4
- * Import and extend this in your actor files:
5
- * import { Actor } from "@base44/sdk";
6
- * export class MyActor extends Actor { ... }
4
+ * Actor files don't import `Actor` from this package. They import it from the
5
+ * actor runtime instead:
6
+ * import { Actor } from "base44:runtime/actors";
7
+ * export default class MyActor extends Actor { ... }
7
8
  *
8
- * At deploy time the bundler replaces this import with the compiled
9
- * Cloudflare Durable Object implementation — this file provides types only.
9
+ * This class's runtime methods, such as `broadcast()` and `schedule()`, throw. An
10
+ * actor that imports `Actor` from `npm:@base44/sdk` bundles this class instead of
11
+ * the runtime's, and a bare `@base44/sdk` import fails to bundle.
10
12
  */
11
13
  import type { Base44Client } from "./client";
12
14
  /** Who a client is, verified by the platform: a logged-in user or an anonymous visitor. */
package/dist/actor.js CHANGED
@@ -1,12 +1,14 @@
1
1
  /**
2
- * Type-only base class for Actors.
2
+ * Type definitions for the actor base class.
3
3
  *
4
- * Import and extend this in your actor files:
5
- * import { Actor } from "@base44/sdk";
6
- * export class MyActor extends Actor { ... }
4
+ * Actor files don't import `Actor` from this package. They import it from the
5
+ * actor runtime instead:
6
+ * import { Actor } from "base44:runtime/actors";
7
+ * export default class MyActor extends Actor { ... }
7
8
  *
8
- * At deploy time the bundler replaces this import with the compiled
9
- * Cloudflare Durable Object implementation — this file provides types only.
9
+ * This class's runtime methods, such as `broadcast()` and `schedule()`, throw. An
10
+ * actor that imports `Actor` from `npm:@base44/sdk` bundles this class instead of
11
+ * the runtime's, and a bare `@base44/sdk` import fails to bundle.
10
12
  */
11
13
  /** Throw from a callable method to refuse the call with a 4xx status. */
12
14
  export class ActorError extends Error {
@@ -132,7 +132,7 @@ export interface Base44Client {
132
132
  appLogs: AppLogsModule;
133
133
  /** {@link AppModule | App module} for reading the app's own public configuration. */
134
134
  app: AppModule;
135
- /** {@link ActorsModule | Actors module} for connecting to actor sessions and exchanging messages with actors. */
135
+ /** {@link ActorsModule | Actors module} for connecting to actor sessions, exchanging messages, and calling an actor's methods. */
136
136
  actors: ActorsModule;
137
137
  /** {@link AuthModule | Auth module} for user authentication and management. */
138
138
  auth: AuthModule;
@@ -229,7 +229,7 @@ export interface Base44Client {
229
229
  * @throws {Error} When accessed without providing a serviceToken during client creation
230
230
  */
231
231
  readonly asServiceRole: {
232
- /** {@link ServiceRoleActorsModule | Actors module} for sending requests to actor sessions as the app's server code. */
232
+ /** [Actors module](/developers/references/sdk/docs/type-aliases/actors) for calling an actor's methods as the app's server code. */
233
233
  actors: ServiceRoleActorsModule;
234
234
  /** {@link AgentsModule | Agents module} with elevated permissions. */
235
235
  agents: AgentsModule;
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export type { AppModule, AppPublicSettings, AppPublicSettingsResponse, } from ".
15
15
  export type { McpModule, McpConsentAction, McpConsentInfo, McpConsentResponse, McpConsentTool, } from "./modules/mcp.types.js";
16
16
  export type { ActorsModule, ActorClient, ActorRef, Connection, ActorSubscription, ActorConnectOptions, ActorNameRegistry, ActorRegistry, ActorConnectable, ActorMethods, ServiceRoleActorRef, ServiceRoleActorsModule, } from "./modules/actors.types.js";
17
17
  export type { SsoModule, SsoAccessTokenResponse } from "./modules/sso.types.js";
18
- export type { PaymentsModule, ServiceRolePaymentsModule, PaymentsErrorCode, PaymentsRecurringFrequency, CheckoutBuyer, CheckoutFreeTrial, CheckoutItem, CheckoutItemRecurring, CheckoutPresentation, CheckoutShipping, CheckoutElement, CheckoutMount, MountableCheckout, CreateCheckoutParams, CreateCheckoutResult, CompleteCheckoutResult, EmbeddedCheckout, PayPalCheckoutOnClick, PayPalEmbeddedCheckout, StripeEmbeddedCheckout, MountCheckoutOptions, ListPurchasesParams, ServiceRoleListPurchasesParams, ListPurchasesResult, Purchase, PurchaseItem, PurchaseStatus, RefundParams, ShippingAddress, RefundResult, CancelSubscriptionOptions, SubscriptionResult, } from "./modules/payments.types.js";
18
+ export type { PaymentsModule, ServiceRolePaymentsModule, PaymentsErrorCode, PaymentsRecurringFrequency, CheckoutBuyer, CheckoutFreeTrial, CheckoutItem, CheckoutItemRecurring, CheckoutPresentation, CheckoutShipping, CheckoutElement, CheckoutMount, MountableCheckout, CreateCheckoutParams, CreateCheckoutResult, CompleteCheckoutResult, EmbeddedCheckout, PayPalCheckoutOnClick, PayPalEmbeddedCheckout, StripeEmbeddedCheckout, WixEmbeddedCheckout, MountCheckoutOptions, ListPurchasesParams, ServiceRoleListPurchasesParams, ListPurchasesResult, Purchase, PurchaseItem, PurchaseStatus, RefundParams, ShippingAddress, RefundResult, CancelSubscriptionOptions, SubscriptionResult, } from "./modules/payments.types.js";
19
19
  export type { BrowserModule, BrowserSession, BrowserSessionOptions, } from "./modules/browser.types.js";
20
20
  export type { VoiceModule, VoiceSession, VoiceSessionMessage, VoiceSessionOptions, } from "./modules/voice.types.js";
21
21
  export { Actor, type Conn, type ActorConnectionIdentity, ActorError, type ActorCallIdentity, type ActorCallContext, } from "./actor.js";
@@ -1,10 +1,12 @@
1
1
  /**
2
- * Maps actor names to their incoming and outgoing message types.
2
+ * Maps actor names to their message types and method types.
3
3
  *
4
- * Extend this interface when you want typed actor
5
- * messages without generating types with the CLI:
6
- * - `toServer`: Defines incoming messages that a client sends to the actor.
7
- * - `toClient`: Defines outgoing messages that the actor sends to connected clients.
4
+ * Extend this interface when you want typed actor messages and method calls without generating
5
+ * types with the CLI:
6
+ * - `toServer`: Defines incoming messages that a client sends to the actor.
7
+ * - `toClient`: Defines outgoing messages that the actor sends to connected clients.
8
+ * - `methods`: Defines the actor's methods that you can call on a session. Each entry's argument
9
+ * and return types become the types of the matching [method call](#session-methods).
8
10
  *
9
11
  * To generate types from deployed actors, use the
10
12
  * [`types generate`](/developers/references/cli/commands/types-generate) CLI command.
@@ -147,22 +149,38 @@ export interface Connection<N extends string = string> {
147
149
  /**
148
150
  * Represents a reference to an actor session, identified by actor name and session ID.
149
151
  *
150
- * Call {@linkcode ActorConnectable.connect | connect()} to open the WebSocket and get a [connection](/developers/backend/resources/actors/overview#connections),
151
- * or call one of the actor's callable methods by name, such as `ref.kick({ userId })`: it runs
152
- * the actor's method with your identity, even when no client is connected, and resolves to
153
- * its return value. A refusal rejects with a `Base44Error` carrying the actor's status (404 for
154
- * a method the actor doesn't list in `static callable`).
152
+ * Call {@linkcode ActorConnectable.connect | connect()} to open a WebSocket and get a
153
+ * [connection](/developers/backend/resources/actors/overview#connections) that sends and receives
154
+ * messages.
155
155
  *
156
- * A call takes one argument, any JSON value: pass several values as an object, such as
157
- * `ref.videoReady({ id, url })`, or an array. Further arguments are dropped, so `ref.m(a, b)`
158
- * sends only `a`. Arguments and the reply are JSON-encoded: a `Date` arrives as a string,
159
- * `undefined` is dropped (`null` inside an array), and functions, `Map` and `Set` values don't
160
- * survive. A request is at most 64 KB and calls are rate-limited per caller.
156
+ * You can also call a method you wrote in the actor by name, such as a `kick()` method that
157
+ * removes a user from a chat room. The method runs on the session even when no client is
158
+ * connected, and the call resolves to its return value.
159
+ *
160
+ * A method call takes one argument, which can be any JSON value. To pass several values, wrap
161
+ * them in an object. The actor receives the caller's identity, which is the current user, or an
162
+ * anonymous visitor when the client uses anonymous authentication. If the actor refuses the call,
163
+ * the promise rejects with a
164
+ * [`Base44Error`](/developers/references/sdk/getting-started/work-with-sdk#error-handling).
165
+ *
166
+ * To type a method's argument and return value, add the actor's `methods` to
167
+ * {@linkcode ActorRegistry}. To learn which methods an actor accepts, how arguments are
168
+ * encoded, and the size and rate limits, see
169
+ * [callable methods](/developers/backend/resources/actors/reference#callable-methods).
170
+ *
171
+ * @example
172
+ * ```typescript
173
+ * // Connect to a session and listen for messages
174
+ * const conn = base44.actors.chatRoom("session-1").connect();
175
+ * conn.subscribe((msg) => {
176
+ * console.log(msg);
177
+ * });
178
+ * ```
161
179
  *
162
180
  * @example
163
181
  * ```typescript
164
182
  * // Call a method on a session
165
- * const { kicked } = await base44.actors.chatRoom("session-1").kick({ userId });
183
+ * const { kicked } = await base44.actors.chatRoom("session-1").kick({ userId: "user-123" });
166
184
  * ```
167
185
  */
168
186
  export interface ActorConnectable<N extends string = string> {
@@ -190,13 +208,13 @@ export type ActorRef<N extends string = string> = ActorConnectable<N> & ActorMet
190
208
  /**
191
209
  * Represents a reference to an actor session for server code running with the
192
210
  * [service role](/developers/references/sdk/getting-started/client#service-role).
193
- * Server code can't hold a connection, so it only calls methods; the actor sees the
194
- * `service` identity.
211
+ * Server code can't hold a connection, so it can only call the actor's methods. The actor
212
+ * receives the `service` identity.
195
213
  *
196
214
  * @example
197
215
  * ```typescript
198
- * // Tell a user's session that their video is ready
199
- * await base44.asServiceRole.actors.VideoRoom(userId).videoReady({ id });
216
+ * // Remove a user from a chat room from server code
217
+ * await base44.asServiceRole.actors.chatRoom("session-1").kick({ userId: "user-123" });
200
218
  * ```
201
219
  */
202
220
  export type ServiceRoleActorRef<N extends string = string> = ActorMethods<N>;
@@ -209,7 +227,7 @@ export type ServiceRoleActorsModule = {
209
227
  /**
210
228
  * Selects a session for a named actor.
211
229
  *
212
- * TypeScript infers message types when you register the actor in
230
+ * TypeScript infers message types and method types when you register the actor in
213
231
  * {@linkcode ActorRegistry}. {@linkcode ActorNameRegistry}
214
232
  * provides autocomplete for actor names only.
215
233
  */
@@ -220,7 +238,7 @@ export interface ActorClient<N extends string = string> {
220
238
  * Clients that specify the same actor name and session ID join the same session.
221
239
  *
222
240
  * @param instanceId - Session ID that identifies which session to connect to.
223
- * @returns A reference to the actor session.
241
+ * @returns A [reference to the actor session](#session-methods).
224
242
  *
225
243
  * @example
226
244
  * ```typescript
@@ -242,17 +260,20 @@ export interface ActorClient<N extends string = string> {
242
260
  * - Manage connections: {@link ActorConnectable.connect | Open} and {@link Connection.close | close} a WebSocket connection to a session.
243
261
  * - Exchange messages: {@link Connection.send | Send} and {@link Connection.subscribe | listen} for messages to and from an actor.
244
262
  * - Manage subscriptions: {@link Connection.subscribe | Subscribe} and {@link ActorSubscription.unsubscribe | unsubscribe} from actor messages without closing the connection.
245
- * - Call methods: run one of an actor's callable methods on a session, without connecting.
263
+ * - Call methods: {@link ActorConnectable | Run} a method you wrote in the actor on a session, without connecting to it.
246
264
  *
247
265
  * For a sample flow, see
248
266
  * [connect a client to a session](/developers/backend/resources/actors/sample-flows#connect-a-client-to-a-session).
249
267
  *
250
268
  * ## Authentication modes
251
269
  *
252
- * This module is available to use with a client in anonymous or user authentication mode. Access it
253
- * through `base44.actors`. In
254
- * [service role authentication mode](/developers/references/sdk/getting-started/client#service-role),
255
- * `base44.asServiceRole.actors` only calls methods.
270
+ * This module is available to use with a client in all authentication modes:
271
+ *
272
+ * - **Anonymous or user authentication** (`base44.actors`): Opens connections to sessions,
273
+ * exchanges messages, and calls an actor's methods.
274
+ * - **[Service role authentication](/developers/references/sdk/getting-started/client#service-role)**
275
+ * (`base44.asServiceRole.actors`): Calls an actor's methods. Server code can't hold a
276
+ * connection, so it can't connect to a session.
256
277
  *
257
278
  * The actor receives each client's [identity](/developers/backend/resources/actors/reference#connections)
258
279
  * when the client connects or calls a method. A client that hasn't logged in is anonymous, a client that
@@ -13,6 +13,9 @@ export interface PaymentsCheckoutConfig {
13
13
  stripe?: {
14
14
  script_url?: string;
15
15
  };
16
+ wix?: {
17
+ script_url?: string;
18
+ };
16
19
  }
17
20
  type PayPalButtonConfig = Pick<PayPalEmbeddedCheckout, "client_id" | "merchant_id" | "partner_attribution_id">;
18
21
  /** @internal */
@@ -2,6 +2,7 @@
2
2
  const ALLOWED_SCRIPT_HOSTS = {
3
3
  paypal: ["www.paypal.com", "www.sandbox.paypal.com"],
4
4
  stripe: ["js.stripe.com"],
5
+ wix: ["tpa.wixapps.net"],
5
6
  };
6
7
  async function scriptUrlFor(provider, deps) {
7
8
  var _a, _b;
@@ -19,7 +20,7 @@ async function scriptUrlFor(provider, deps) {
19
20
  url.username !== "" ||
20
21
  url.password !== "" ||
21
22
  !ALLOWED_SCRIPT_HOSTS[provider].includes(url.hostname)) {
22
- const name = provider === "paypal" ? "PayPal" : "Stripe";
23
+ const name = { paypal: "PayPal", stripe: "Stripe", wix: "Wix" }[provider];
23
24
  throw new Error(`The payments config has no valid ${name} script URL`);
24
25
  }
25
26
  return url.href;
@@ -236,6 +237,84 @@ checkout, options, deps) {
236
237
  },
237
238
  };
238
239
  }
240
+ async function mountWix(element, scriptUrl, checkoutId, embedded, options, deps) {
241
+ var _a;
242
+ const wpe = await loadGlobal(scriptUrl, () => browserGlobals().wpe, deps.loadScript);
243
+ const locale = (((_a = document.documentElement) === null || _a === void 0 ? void 0 : _a.lang) || navigator.language || "en").split("-")[0];
244
+ const paymentElement = wpe(embedded.client_id, { locale }).create("checkout", {
245
+ intentId: embedded.order_id,
246
+ });
247
+ const box = document.createElement("div");
248
+ element.appendChild(box);
249
+ try {
250
+ await paymentElement.mount(box);
251
+ }
252
+ catch (error) {
253
+ box.remove();
254
+ paymentElement.destroy();
255
+ throw error;
256
+ }
257
+ let destroyed = false;
258
+ let paying = false;
259
+ let paid = false;
260
+ // What the app last passed to setDisabled().
261
+ let disabled = false;
262
+ const notify = (callback) => {
263
+ if (destroyed)
264
+ return;
265
+ try {
266
+ callback();
267
+ }
268
+ catch (error) {
269
+ console.error("[Base44 SDK] A mountCheckout() callback threw", error);
270
+ }
271
+ };
272
+ const button = document.createElement("button");
273
+ button.type = "button";
274
+ button.className = "base44-checkout-pay";
275
+ button.textContent = "Pay";
276
+ const onClick = () => {
277
+ if (paying || paid || disabled)
278
+ return;
279
+ paying = true;
280
+ button.disabled = true;
281
+ // The executor runs now, so confirmPayment() is called inside the click, before any await.
282
+ new Promise((resolve) => resolve(paymentElement.confirmPayment()))
283
+ .then(async (status) => {
284
+ if (status !== "succeeded") {
285
+ notify(() => { var _a; return (_a = options.onCancel) === null || _a === void 0 ? void 0 : _a.call(options); });
286
+ return;
287
+ }
288
+ // Runs even after destroy(), so a paid order is still completed.
289
+ const result = await deps.completeCheckout(checkoutId);
290
+ paid = true;
291
+ notify(() => { var _a; return (_a = options.onComplete) === null || _a === void 0 ? void 0 : _a.call(options, result); });
292
+ })
293
+ .catch((error) => notify(() => { var _a; return (_a = options.onError) === null || _a === void 0 ? void 0 : _a.call(options, error); }))
294
+ .finally(() => {
295
+ paying = false;
296
+ button.disabled = paid || disabled;
297
+ });
298
+ };
299
+ button.addEventListener("click", onClick);
300
+ element.appendChild(button);
301
+ return {
302
+ destroy() {
303
+ if (destroyed)
304
+ return;
305
+ destroyed = true;
306
+ button.removeEventListener("click", onClick);
307
+ button.remove();
308
+ box.remove();
309
+ paymentElement.destroy();
310
+ },
311
+ setDisabled(value) {
312
+ disabled = value;
313
+ if (!paying && !paid)
314
+ button.disabled = value;
315
+ },
316
+ };
317
+ }
239
318
  /** The new checkout's id, refused unless it is the checkout the button was drawn for. */
240
319
  function onClickCheckoutId(spec, button) {
241
320
  return async () => {
@@ -291,6 +370,8 @@ export async function mountCheckout(element, checkout, options, deps) {
291
370
  return mountStripe(element, await scriptUrlFor("stripe", deps), embedded, deps);
292
371
  case "paypal":
293
372
  return mountPayPal(element, await scriptUrlFor("paypal", deps), checkout.currency, embedded, checkout.checkout_id, options, deps);
373
+ case "wix":
374
+ return mountWix(element, await scriptUrlFor("wix", deps), checkout.checkout_id, embedded, options, deps);
294
375
  default:
295
376
  throw new Error(`Embedded checkout isn't supported for provider ${embedded.provider}`);
296
377
  }
@@ -111,7 +111,7 @@ export interface CreateCheckoutParams {
111
111
  metadata?: Record<string, string>;
112
112
  /** Key that makes retries return the same checkout instead of creating another, 1 to 200 characters. Not supported for Base44 Payments or PayPal subscriptions. */
113
113
  idempotency_key?: string;
114
- /** How the buyer pays. Defaults to `'redirect'`. PayPal apps must pass `'embedded'`, and Base44 Payments supports only `'redirect'`. */
114
+ /** How the buyer pays. Defaults to `'redirect'`. PayPal apps must pass `'embedded'`. */
115
115
  presentation?: CheckoutPresentation;
116
116
  /**
117
117
  * Shipping address and fee. Allowed only when at least one item is `shippable`. Supported for PayPal one-time checkouts only. Other providers and subscriptions reject it with [`invalid_request`](#paymentserrorcode).
@@ -146,10 +146,21 @@ export interface PayPalEmbeddedCheckout {
146
146
  /** Whether the checkout is a one-time payment or a subscription. */
147
147
  intent: "capture" | "subscription";
148
148
  }
149
+ /**
150
+ * Data that the Wix Payment Element needs to render, for Base44 Payments.
151
+ */
152
+ export interface WixEmbeddedCheckout {
153
+ /** Payment provider. */
154
+ provider: "wix";
155
+ /** Client ID the payment element signs in with. */
156
+ client_id: string;
157
+ /** ID of the order the buyer pays. */
158
+ order_id: string;
159
+ }
149
160
  /**
150
161
  * Data that an embedded checkout needs to render, by provider.
151
162
  */
152
- export type EmbeddedCheckout = StripeEmbeddedCheckout | PayPalEmbeddedCheckout;
163
+ export type EmbeddedCheckout = StripeEmbeddedCheckout | PayPalEmbeddedCheckout | WixEmbeddedCheckout;
153
164
  /**
154
165
  * Result of [`createCheckout()`](#createcheckout).
155
166
  *
@@ -316,17 +327,17 @@ export type PaymentsErrorCode = "forbidden" | "unauthenticated" | "not_found" |
316
327
  */
317
328
  export interface MountCheckoutOptions {
318
329
  /**
319
- * Called after the buyer approves a PayPal payment and the SDK completes the checkout. Use it to update the page, not to grant access.
330
+ * Called after the buyer approves a PayPal payment, or pays with Base44 Payments, and the SDK completes the checkout. Use it to update the page, not to grant access.
320
331
  *
321
332
  * Stripe doesn't call this. After a Stripe payment, the buyer returns to the checkout's `success_path` with a `session_id` query parameter. That parameter is the `checkout_id`. Show the result there with [`listPurchases()`](#listpurchases).
322
333
  */
323
334
  onComplete?: (result: CompleteCheckoutResult) => void;
324
- /** Called when the buyer closes the PayPal window without paying. The button stays mounted so the buyer can try again. */
335
+ /** Called when the buyer closes the PayPal window without paying, or when a Base44 Payments payment doesn't go through, a declined one included. The button stays mounted so the buyer can try again. */
325
336
  onCancel?: () => void;
326
337
  /**
327
- * Called when a PayPal checkout fails after it's mounted, including a declined payment with the [`payment_declined`](#paymentserrorcode) code. The button stays mounted so the buyer can try again. If it keeps failing with `payment_declined`, create a new checkout and mount it. Stripe shows its own errors inside the checkout.
338
+ * Called when a PayPal or Base44 Payments checkout fails after it's mounted. The button stays mounted so the buyer can try again. For PayPal this includes a declined payment with the [`payment_declined`](#paymentserrorcode) code. If it keeps failing with `payment_declined`, create a new checkout and mount it. A declined Base44 Payments payment calls `onCancel` instead. Stripe shows its own errors inside the checkout.
328
339
  *
329
- * The error is a `Base44Error` when completing the checkout fails, or PayPal's own error object when the PayPal window fails.
340
+ * The error is a `Base44Error` when completing the checkout fails, or the provider's own error object when the PayPal window or the Wix Payment Element fails.
330
341
  */
331
342
  onError?: (error: unknown) => void;
332
343
  }
@@ -371,7 +382,7 @@ export interface PayPalCheckoutOnClick {
371
382
  export interface CheckoutMount {
372
383
  /** Removes the checkout from the page. Call it when the component that holds it unmounts. For Stripe, mounting another checkout destroys this one for you. */
373
384
  destroy: () => void;
374
- /** Grays out PayPal's button and ignores clicks, for example until a required form is filled in. After a payment completes the button stays off, so `setDisabled(false)` can't start a second payment. Stripe ignores it. */
385
+ /** Grays out the PayPal or Base44 Payments button and ignores clicks, for example until a required form is filled in. After a payment completes the button stays off, so `setDisabled(false)` can't start a second payment. Stripe ignores it. */
375
386
  setDisabled: (disabled: boolean) => void;
376
387
  }
377
388
  /**
@@ -391,14 +402,16 @@ export interface CheckoutMount {
391
402
  * | | Stripe | PayPal | Base44 Payments |
392
403
  * | :- | :- | :- | :- |
393
404
  * | Redirect checkout | Yes | No | Yes |
394
- * | Embedded checkout | Yes | Yes, required | No |
405
+ * | Embedded checkout | Yes | Yes, required | Yes |
395
406
  * | Refunds | Yes | Yes | No |
396
407
  * | Subscription cancellation | Yes, now or at period end | Yes, now only | No |
397
408
  * | Subscription pause and resume | Yes | Yes | No |
398
409
  *
399
410
  * ## Authentication modes
400
411
  *
401
- * - **Anonymous or user authentication** (`base44.payments`): Preloads and mounts embedded checkouts, completes PayPal checkouts, and lists the current user's own purchases.
412
+ * This module is available to use with a client in all authentication modes:
413
+ *
414
+ * - **Anonymous or user authentication** (`base44.payments`): Preloads and mounts embedded checkouts, completes PayPal and embedded Base44 Payments checkouts, and lists the current user's own purchases.
402
415
  * - **Service role authentication** (`base44.asServiceRole.payments`): Creates checkouts, lists any purchase, refunds payments, and changes subscriptions. Use the [service role methods](#service-role-methods) in backend functions.
403
416
  *
404
417
  * @groupDescription Methods
@@ -430,8 +443,9 @@ export interface PaymentsModule {
430
443
  * The SDK loads the provider's library and renders the checkout for you:
431
444
  * - PayPal: Renders a PayPal button. When the buyer approves the payment, the SDK calls {@linkcode completeCheckout | completeCheckout()} and then `onComplete`.
432
445
  * - Stripe: Mounts Stripe Embedded Checkout. After paying, the buyer returns to the checkout's `success_path`. Stripe allows one embedded checkout per page, so mounting another Stripe checkout destroys the previous one.
446
+ * - Base44 Payments: Renders the Wix Payment Element and a **Pay** button below it. Style the button with its `base44-checkout-pay` class. When the payment succeeds, the SDK calls {@linkcode completeCheckout | completeCheckout()} and then `onComplete`.
433
447
  *
434
- * To make the checkout appear faster, load the library ahead of time with [`preloadCheckout()`](#preloadcheckout) when the page opens.
448
+ * For PayPal and Stripe, to make the checkout appear faster, load the library ahead of time with [`preloadCheckout()`](#preloadcheckout) when the page opens.
435
449
  *
436
450
  * Requires a browser environment and can't be used in the backend. Rejects when the checkout isn't embedded, when an on-click PayPal checkout is mounted before the app's PayPal can take payments, when the payments config can't be fetched or has no valid script URL for the provider, when the provider's library fails to load, or when PayPal isn't available for the checkout's currency.
437
451
  *
@@ -505,11 +519,11 @@ export interface PaymentsModule {
505
519
  */
506
520
  mountCheckout(element: CheckoutElement, checkout: MountableCheckout | PayPalCheckoutOnClick, options?: MountCheckoutOptions): Promise<CheckoutMount>;
507
521
  /**
508
- * Completes a PayPal checkout after the buyer approves it.
522
+ * Completes a PayPal or embedded Base44 Payments checkout after the buyer pays.
509
523
  *
510
524
  * When you use {@linkcode mountCheckout | mountCheckout()}, it calls this for you. Call it directly only if you render your own PayPal button. Calling it again for the same checkout returns the same result.
511
525
  *
512
- * Only PayPal checkouts need completing. Other providers reject with [`complete_not_supported`](#paymentserrorcode).
526
+ * Only PayPal and embedded Base44 Payments checkouts need completing. Other checkouts reject with [`complete_not_supported`](#paymentserrorcode).
513
527
  *
514
528
  * To complete the checkout from a backend function instead, use [`completeCheckout()`](#service-role-methods) with the service role.
515
529
  *
@@ -640,11 +654,11 @@ export interface ServiceRolePaymentsModule {
640
654
  */
641
655
  createCheckout(params: CreateCheckoutParams): Promise<CreateCheckoutResult>;
642
656
  /**
643
- * Completes a PayPal checkout from a backend function, after the buyer approves it.
657
+ * Completes a PayPal or embedded Base44 Payments checkout from a backend function, after the buyer pays.
644
658
  *
645
659
  * Use it when you render your own PayPal button and its `onApprove` handler sends the checkout ID to your backend. Calling it again for the same checkout returns the same result.
646
660
  *
647
- * Only PayPal checkouts need completing. Other providers reject with [`complete_not_supported`](#paymentserrorcode).
661
+ * Only PayPal and embedded Base44 Payments checkouts need completing. Other checkouts reject with [`complete_not_supported`](#paymentserrorcode).
648
662
  *
649
663
  * @param checkoutId - The `checkout_id` from {@linkcode createCheckout | createCheckout()}.
650
664
  * @returns Promise resolving to the checkout's payment status.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.63-pr.389.0df9331",
3
+ "version": "0.8.63-pr.390.31c1120",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",