@arnaudjnn/billing-tools 0.51.0 → 0.52.0

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.
@@ -13,7 +13,7 @@ export type AddressValue = {
13
13
  export declare function BillingAddressForm({ publishableKey, defaultValue, onChange, appearance, locale,
14
14
  /** Prefilled name line. Stripe requires one when `display.name` is shown; it
15
15
  * is hidden by default here because the invoice name is its own field. */
16
- showName, className, }: {
16
+ showName, googleMapsApiKey, currency, className, }: {
17
17
  publishableKey: string;
18
18
  defaultValue?: AddressValue | null;
19
19
  /**
@@ -24,6 +24,15 @@ showName, className, }: {
24
24
  appearance?: Appearance;
25
25
  locale?: StripeElementLocale;
26
26
  showName?: boolean;
27
+ /**
28
+ * Your own Google Maps Places key. Supplying it is the documented way to get
29
+ * autocomplete standalone, and skips the hidden Payment Element described
30
+ * above.
31
+ */
32
+ googleMapsApiKey?: string;
33
+ /** Required by Stripe for the deferred Elements group. Only used to satisfy
34
+ * that API — nothing is ever charged here. */
35
+ currency?: string;
27
36
  className?: string;
28
37
  }): React.JSX.Element;
29
38
  //# sourceMappingURL=address.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/ui/address.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,UAAU,EAEf,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B;+DAC+D;AAC/D,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;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QAAQ,EAAE,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;IACjD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;mDAC+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,qBAmFA"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { AddressElement, Elements } from "@stripe/react-stripe-js";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { AddressElement, Elements, PaymentElement } from "@stripe/react-stripe-js";
4
4
  import { loadStripe, } from "@stripe/stripe-js";
5
5
  import * as React from "react";
6
6
  const cache = new Map();
@@ -15,7 +15,7 @@ function stripeFor(publishableKey) {
15
15
  export function BillingAddressForm({ publishableKey, defaultValue, onChange, appearance, locale,
16
16
  /** Prefilled name line. Stripe requires one when `display.name` is shown; it
17
17
  * is hidden by default here because the invoice name is its own field. */
18
- showName = false, className, }) {
18
+ showName = false, googleMapsApiKey, currency = "eur", className, }) {
19
19
  const stripe = React.useMemo(() => stripeFor(publishableKey), [publishableKey]);
20
20
  // Read through a ref: callers pass inline arrows, and re-rendering the
21
21
  // element on every keystroke would fight the user for the caret.
@@ -24,7 +24,9 @@ showName = false, className, }) {
24
24
  const options = React.useMemo(() => ({
25
25
  mode: "billing",
26
26
  display: { name: showName ? "full" : "organization" },
27
- autocomplete: { mode: "automatic" },
27
+ autocomplete: googleMapsApiKey
28
+ ? { mode: "google_maps_api", apiKey: googleMapsApiKey }
29
+ : { mode: "automatic" },
28
30
  ...(defaultValue
29
31
  ? {
30
32
  defaultValues: {
@@ -45,6 +47,29 @@ showName = false, className, }) {
45
47
  // starting point, not a controlled value.
46
48
  // eslint-disable-next-line react-hooks/exhaustive-deps
47
49
  []);
48
- return (_jsx(Elements, { stripe: stripe, options: { appearance, locale }, children: _jsx("div", { className: className, children: _jsx(AddressElement, { options: options, onChange: (e) => onChangeRef.current(e.complete ? e.value.address : null) }) }) }));
50
+ return (_jsx(Elements, { stripe: stripe, options: {
51
+ appearance,
52
+ locale,
53
+ // Deferred: describes an intent's shape without creating one.
54
+ mode: "setup",
55
+ currency,
56
+ paymentMethodCreation: "manual",
57
+ }, children: _jsxs("div", { className: className, children: [_jsx(AddressElement, { options: options, onChange: (e) => onChangeRef.current(e.complete ? e.value.address : null) }), !googleMapsApiKey && (
58
+ // Off-screen rather than display:none — a zero-size or hidden
59
+ // container can stop a Stripe iframe mounting at all, and an
60
+ // unmounted Payment Element wouldn't unlock the autocomplete this is
61
+ // here for. aria-hidden + inert keep it out of the a11y tree and the
62
+ // tab order.
63
+ _jsx("div", { "aria-hidden": true,
64
+ // @ts-expect-error -- `inert` lands in React's types after 19.2
65
+ inert: "", style: {
66
+ position: "absolute",
67
+ left: "-9999px",
68
+ top: 0,
69
+ width: "360px",
70
+ height: "360px",
71
+ overflow: "hidden",
72
+ pointerEvents: "none",
73
+ }, children: _jsx(PaymentElement, {}) }))] }) }));
49
74
  }
50
75
  //# sourceMappingURL=address.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"address.js","sourceRoot":"","sources":["../../src/ui/address.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EACL,UAAU,GAIX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA0B/B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkC,CAAC;AACxD,SAAS,SAAS,CAAC,cAAsB;IACvC,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAClC,IA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V,MAAM;YACN,8DAA8D;YAC9D,IAAI,EAAE,OAAO;YACb,QAAQ;YACR,qBAAqB,EAAE,QAAQ;SAChC,YAED,eAAK,SAAS,EAAE,SAAS,aACvB,KAAC,cAAc,IACb,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CACd,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAE,CAAC,CAAC,KAAK,CAAC,OAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,GAE5E,EACD,CAAC,gBAAgB,IAAI;gBACpB,8DAA8D;gBAC9D,6DAA6D;gBAC7D,qEAAqE;gBACrE,qEAAqE;gBACrE,aAAa;gBACb;oBAEE,gEAAgE;oBAChE,KAAK,EAAC,EAAE,EACR,KAAK,EAAE;wBACL,QAAQ,EAAE,UAAU;wBACpB,IAAI,EAAE,SAAS;wBACf,GAAG,EAAE,CAAC;wBACN,KAAK,EAAE,OAAO;wBACd,MAAM,EAAE,OAAO;wBACf,QAAQ,EAAE,QAAQ;wBAClB,aAAa,EAAE,MAAM;qBACtB,YAED,KAAC,cAAc,KAAG,GACd,CACP,IACG,GACG,CACZ,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arnaudjnn/billing-tools",
3
- "version": "0.51.0",
3
+ "version": "0.52.0",
4
4
  "description": "The get-paid engine for Stripe + WorkOS apps, for humans and AI agents. Drop-in API-key auth, token/credit + subscription billing, auth.md agent registration, and MPP machine payments, as MCP tools, a REST API, and a CLI. Framework-agnostic, storage-pluggable.",
5
5
  "license": "MIT",
6
6
  "author": "Arnaud Jeannin",