@base44-preview/sdk 0.8.63-pr.393.32eac0e → 0.8.63-pr.394.7e3e1a1

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.
@@ -64,7 +64,7 @@ export interface AiGatewayModuleConfig {
64
64
  *
65
65
  * You can use any of the [models available through `InvokeLLM`](/developers/references/sdk/docs/type-aliases/integrations#invokellm).
66
66
  * Pass `'automatic'` to let Base44 choose one, or pin a specific model such
67
- * as `'claude_sonnet_4_6'`, `'gpt_5_5'`, or `'gemini_3_1_pro'`.
67
+ * as `'claude_fable_5_2'`, `'gpt_6_2_sol'`, or `'gemini_3_8_flash'`.
68
68
  *
69
69
  * ## Images
70
70
  *
@@ -43,9 +43,9 @@ export interface InvokeLLMParams {
43
43
  prompt: string;
44
44
  /** Optionally specify a model to override the app-level model setting for this specific call.
45
45
  *
46
- * Options: `"gemini_3_8_flash"`, `"gpt_6_luna"`, `"claude-sonnet-5"`, `"claude_opus_5_5"`, `"gpt_6_sol"`, `"gpt_6_astra"`, `"claude_fable_5_1"`, `"glm_5_2"`, `"gemini_3_1_pro"`, `"gpt_5_4"`, `"claude_sonnet_4_6"`, `"claude_opus_4_6"`, `"claude_opus_4_7"`, `"claude_opus_4_8"`, `"claude_opus_5"`, `"gpt_5_6_terra"`, `"gpt_5_6_sol"`, `"gpt_5_6_luna"`
46
+ * Options: `"gemini_3_8_flash"`, `"gpt_6_luna"`, `"claude-sonnet-5"`, `"claude_opus_5_5"`, `"gpt_6_sol"`, `"gpt_6_astra"`, `"claude_fable_5_1"`, `"glm_5_2"`, `"claude_fable_5_2"`, `"gpt_6_2_sol"`, `"gpt_6_2_astra"`, `"gemini_3_1_pro"`, `"gpt_5_4"`, `"claude_sonnet_4_6"`, `"claude_opus_4_6"`, `"claude_opus_4_7"`, `"claude_opus_4_8"`, `"claude_opus_5"`, `"gpt_5_6_terra"`, `"gpt_5_6_sol"`, `"gpt_5_6_luna"`
47
47
  */
48
- model?: 'gemini_3_8_flash' | 'gpt_6_luna' | 'claude-sonnet-5' | 'claude_opus_5_5' | 'gpt_6_sol' | 'gpt_6_astra' | 'claude_fable_5_1' | 'glm_5_2' | 'gemini_3_1_pro' | 'gpt_5_4' | 'claude_sonnet_4_6' | 'claude_opus_4_6' | 'claude_opus_4_7' | 'claude_opus_4_8' | 'claude_opus_5' | 'gpt_5_6_terra' | 'gpt_5_6_sol' | 'gpt_5_6_luna';
48
+ model?: 'gemini_3_8_flash' | 'gpt_6_luna' | 'claude-sonnet-5' | 'claude_opus_5_5' | 'gpt_6_sol' | 'gpt_6_astra' | 'claude_fable_5_1' | 'glm_5_2' | 'claude_fable_5_2' | 'gpt_6_2_sol' | 'gpt_6_2_astra' | 'gemini_3_1_pro' | 'gpt_5_4' | 'claude_sonnet_4_6' | 'claude_opus_4_6' | 'claude_opus_4_7' | 'claude_opus_4_8' | 'claude_opus_5' | 'gpt_5_6_terra' | 'gpt_5_6_sol' | 'gpt_5_6_luna';
49
49
  /** If set to `true`, the LLM will use Google Search, Maps, and News to gather real-time context before answering.
50
50
  * @default false
51
51
  */
@@ -1,5 +1,4 @@
1
1
  import type { CheckoutElement, CheckoutMount, CompleteCheckoutResult, MountableCheckout, MountCheckoutOptions, PayPalCheckoutOnClick, PayPalEmbeddedCheckout } from "./payments.types.js";
2
- type ScriptProvider = "paypal" | "stripe" | "paddle";
3
2
  /** @internal */
4
3
  export type LoadScript = (src: string) => Promise<void>;
5
4
  /**
@@ -14,9 +13,6 @@ export interface PaymentsCheckoutConfig {
14
13
  stripe?: {
15
14
  script_url?: string;
16
15
  };
17
- paddle?: {
18
- script_url?: string;
19
- };
20
16
  }
21
17
  type PayPalButtonConfig = Pick<PayPalEmbeddedCheckout, "client_id" | "merchant_id" | "partner_attribution_id">;
22
18
  /** @internal */
@@ -34,7 +30,7 @@ export declare const loadScript: LoadScript;
34
30
  * Fetches the payments config and loads the provider's script ahead of mountCheckout().
35
31
  * @internal
36
32
  */
37
- export declare function preloadCheckout(provider: ScriptProvider, deps: Pick<MountCheckoutDeps, "getConfig" | "loadScript">): Promise<void>;
33
+ export declare function preloadCheckout(provider: "paypal" | "stripe", deps: Pick<MountCheckoutDeps, "getConfig" | "loadScript">): Promise<void>;
38
34
  /**
39
35
  * Mounts the embedded checkout that createCheckout() returned.
40
36
  * @internal
@@ -2,9 +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
- paddle: ["cdn.paddle.com"],
6
5
  };
7
- const PROVIDER_NAMES = { paypal: "PayPal", stripe: "Stripe", paddle: "Paddle" };
8
6
  async function scriptUrlFor(provider, deps) {
9
7
  var _a, _b;
10
8
  const value = (_b = (_a = (await deps.getConfig())) === null || _a === void 0 ? void 0 : _a[provider]) === null || _b === void 0 ? void 0 : _b.script_url;
@@ -21,7 +19,8 @@ async function scriptUrlFor(provider, deps) {
21
19
  url.username !== "" ||
22
20
  url.password !== "" ||
23
21
  !ALLOWED_SCRIPT_HOSTS[provider].includes(url.hostname)) {
24
- throw new Error(`The payments config has no valid ${PROVIDER_NAMES[provider]} script URL`);
22
+ const name = provider === "paypal" ? "PayPal" : "Stripe";
23
+ throw new Error(`The payments config has no valid ${name} script URL`);
25
24
  }
26
25
  return url.href;
27
26
  }
@@ -237,101 +236,6 @@ checkout, options, deps) {
237
236
  },
238
237
  };
239
238
  }
240
- // Paddle.js takes one token per page and reports every checkout's events to the callback set then.
241
- let paddleToken = null;
242
- let onPaddleEvent = null;
243
- async function mountPaddle(element, scriptUrl, embedded, checkoutId, options, deps) {
244
- const Paddle = await loadGlobal(scriptUrl, () => browserGlobals().Paddle, deps.loadScript);
245
- if (paddleToken === null) {
246
- if (embedded.environment === "sandbox")
247
- Paddle.Environment.set("sandbox");
248
- Paddle.Initialize({ token: embedded.client_token, eventCallback: (event) => onPaddleEvent === null || onPaddleEvent === void 0 ? void 0 : onPaddleEvent(event) });
249
- paddleToken = embedded.client_token;
250
- }
251
- else if (paddleToken !== embedded.client_token) {
252
- throw new Error("Paddle is already set up on this page for another seller. Reload the page to check out.");
253
- }
254
- let destroyed = false;
255
- let open = false;
256
- let completing = false;
257
- // Set once the payment goes through: the transaction is paid, so the button stays off.
258
- let paid = false;
259
- const notify = (callback) => {
260
- if (destroyed)
261
- return;
262
- try {
263
- callback();
264
- }
265
- catch (error) {
266
- console.error("[Base44 SDK] A mountCheckout() callback threw", error);
267
- }
268
- };
269
- const handle = async (event) => {
270
- if (event.name === "checkout.completed") {
271
- completing = true;
272
- button.disabled = true;
273
- let result;
274
- try {
275
- // Paddle charged inside its own window; this asks the backend, which reads Paddle, whether it did.
276
- result = await deps.completeCheckout(checkoutId);
277
- }
278
- catch (error) {
279
- completing = false;
280
- button.disabled = false;
281
- notify(() => { var _a; return (_a = options.onError) === null || _a === void 0 ? void 0 : _a.call(options, error); });
282
- return;
283
- }
284
- completing = false;
285
- paid = true;
286
- notify(() => { var _a; return (_a = options.onComplete) === null || _a === void 0 ? void 0 : _a.call(options, result); });
287
- }
288
- else if (event.name === "checkout.closed") {
289
- open = false;
290
- if (!paid && !completing)
291
- notify(() => { var _a; return (_a = options.onCancel) === null || _a === void 0 ? void 0 : _a.call(options); });
292
- }
293
- else if (event.name === "checkout.error") {
294
- notify(() => { var _a, _b; return (_a = options.onError) === null || _a === void 0 ? void 0 : _a.call(options, (_b = event.error) !== null && _b !== void 0 ? _b : event); });
295
- }
296
- };
297
- const button = document.createElement("button");
298
- button.type = "button";
299
- button.textContent = "Pay";
300
- button.setAttribute("data-base44-checkout", "paddle");
301
- const onClick = () => {
302
- if (paid || completing || open || button.disabled)
303
- return;
304
- open = true;
305
- onPaddleEvent = (event) => void handle(event);
306
- try {
307
- Paddle.Checkout.open({
308
- transactionId: embedded.transaction_id,
309
- ...(embedded.customer_email ? { customer: { email: embedded.customer_email } } : {}),
310
- });
311
- }
312
- catch (error) {
313
- open = false;
314
- notify(() => { var _a; return (_a = options.onError) === null || _a === void 0 ? void 0 : _a.call(options, error); });
315
- }
316
- };
317
- button.addEventListener("click", onClick);
318
- element.appendChild(button);
319
- return {
320
- destroy() {
321
- if (destroyed)
322
- return;
323
- destroyed = true;
324
- button.removeEventListener("click", onClick);
325
- button.remove();
326
- if (open)
327
- Paddle.Checkout.close();
328
- },
329
- setDisabled(disabled) {
330
- if (!completing && !paid)
331
- button.disabled = disabled;
332
- },
333
- };
334
- }
335
239
  /** The new checkout's id, refused unless it is the checkout the button was drawn for. */
336
240
  function onClickCheckoutId(spec, button) {
337
241
  return async () => {
@@ -354,7 +258,7 @@ function onClickCheckoutId(spec, button) {
354
258
  export async function preloadCheckout(provider, deps) {
355
259
  if (typeof window === "undefined" || typeof document === "undefined")
356
260
  return;
357
- const read = () => provider === "paypal" ? browserGlobals().paypal : provider === "paddle" ? browserGlobals().Paddle : browserGlobals().Stripe;
261
+ const read = () => (provider === "paypal" ? browserGlobals().paypal : browserGlobals().Stripe);
358
262
  try {
359
263
  if (!read()) {
360
264
  await deps.loadScript(await scriptUrlFor(provider, deps));
@@ -387,8 +291,6 @@ export async function mountCheckout(element, checkout, options, deps) {
387
291
  return mountStripe(element, await scriptUrlFor("stripe", deps), embedded, deps);
388
292
  case "paypal":
389
293
  return mountPayPal(element, await scriptUrlFor("paypal", deps), checkout.currency, embedded, checkout.checkout_id, options, deps);
390
- case "paddle":
391
- return mountPaddle(element, await scriptUrlFor("paddle", deps), embedded, checkout.checkout_id, options, deps);
392
294
  default:
393
295
  throw new Error(`Embedded checkout isn't supported for provider ${embedded.provider}`);
394
296
  }
@@ -146,25 +146,10 @@ 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 Paddle's checkout needs to open.
151
- */
152
- export interface PaddleEmbeddedCheckout {
153
- /** Payment provider. */
154
- provider: "paddle";
155
- /** Paddle client-side token of the app's seller account. Public by design. */
156
- client_token: string;
157
- /** ID of the Paddle transaction the buyer pays. */
158
- transaction_id: string;
159
- /** Paddle environment the transaction lives in. */
160
- environment: "sandbox" | "production";
161
- /** Buyer email to prefill, when the checkout named one. */
162
- customer_email?: string | null;
163
- }
164
149
  /**
165
150
  * Data that an embedded checkout needs to render, by provider.
166
151
  */
167
- export type EmbeddedCheckout = StripeEmbeddedCheckout | PayPalEmbeddedCheckout | PaddleEmbeddedCheckout;
152
+ export type EmbeddedCheckout = StripeEmbeddedCheckout | PayPalEmbeddedCheckout;
168
153
  /**
169
154
  * Result of [`createCheckout()`](#createcheckout).
170
155
  *
@@ -335,12 +320,12 @@ export type PaymentsErrorCode = "forbidden" | "unauthenticated" | "not_found" |
335
320
  */
336
321
  export interface MountCheckoutOptions {
337
322
  /**
338
- * Called after the buyer approves a PayPal payment, or pays in Paddle's checkout, and the SDK completes the checkout. Use it to update the page, not to grant access.
323
+ * Called after the buyer approves a PayPal payment and the SDK completes the checkout. Use it to update the page, not to grant access.
339
324
  *
340
325
  * 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).
341
326
  */
342
327
  onComplete?: (result: CompleteCheckoutResult) => void;
343
- /** Called when the buyer closes the PayPal or Paddle window without paying. The button stays mounted so the buyer can try again. */
328
+ /** Called when the buyer closes the PayPal window without paying. The button stays mounted so the buyer can try again. */
344
329
  onCancel?: () => void;
345
330
  /**
346
331
  * 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.
@@ -390,7 +375,7 @@ export interface PayPalCheckoutOnClick {
390
375
  export interface CheckoutMount {
391
376
  /** 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. */
392
377
  destroy: () => void;
393
- /** Grays out PayPal's or Paddle'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. */
378
+ /** 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. */
394
379
  setDisabled: (disabled: boolean) => void;
395
380
  }
396
381
  /**
@@ -442,7 +427,7 @@ export interface PaymentsModule {
442
427
  * base44.payments.preloadCheckout('paypal');
443
428
  * ```
444
429
  */
445
- preloadCheckout(provider: "paypal" | "stripe" | "paddle"): Promise<void>;
430
+ preloadCheckout(provider: "paypal" | "stripe"): Promise<void>;
446
431
  /**
447
432
  * Renders an embedded checkout inside an element on the page.
448
433
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.63-pr.393.32eac0e",
3
+ "version": "0.8.63-pr.394.7e3e1a1",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",