@amos.com/amos-js 0.9.13 → 0.9.15

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.
@@ -29,16 +29,18 @@ export declare function updateAppearance({ iframe, appearance, }: {
29
29
  /**
30
30
  * Push Apple Pay button visual options into the embedded iframe.
31
31
  */
32
- export declare function updateApplePayButton({ iframe, props, }: {
32
+ export declare function updateApplePayButton({ iframe, props, height, }: {
33
33
  iframe: Iframe;
34
34
  props: ApplePayButtonElementProps;
35
+ height?: string;
35
36
  }): void;
36
37
  /**
37
38
  * Push Google Pay button visual options into the embedded iframe.
38
39
  */
39
- export declare function updateGooglePayButton({ iframe, props, }: {
40
+ export declare function updateGooglePayButton({ iframe, props, height, }: {
40
41
  iframe: Iframe;
41
42
  props: GooglePayButtonElementProps;
43
+ height?: string;
42
44
  }): void;
43
45
  /**
44
46
  * Push the express-checkout amount into the embedded Google Pay iframe.
package/dist/mount.d.ts CHANGED
@@ -95,6 +95,13 @@ export type AmosGooglePayButtonOptions = GooglePayButtonListenerOptions & {
95
95
  * https://dashboard.amos.com.
96
96
  */
97
97
  renderToken: string;
98
+ /** Class names applied to the host-page `<iframe>` element. */
99
+ iframeClassName?: string;
100
+ /**
101
+ * Inline style applied to the host-page `<iframe>` element. Use CSS
102
+ * lengths with units (`{ borderRadius: "8px" }`).
103
+ */
104
+ iframeStyle?: Partial<CSSStyleDeclaration>;
98
105
  };
99
106
  /**
100
107
  * Controller returned by {@link mountAmosGooglePayButton}.
@@ -122,6 +129,13 @@ export type AmosApplePayButtonOptions = ApplePayButtonListenerOptions & {
122
129
  * https://dashboard.amos.com.
123
130
  */
124
131
  renderToken: string;
132
+ /** Class names applied to the host-page `<iframe>` element. */
133
+ iframeClassName?: string;
134
+ /**
135
+ * Inline style applied to the host-page `<iframe>` element. Use CSS
136
+ * lengths with units (`{ borderRadius: "8px" }`).
137
+ */
138
+ iframeStyle?: Partial<CSSStyleDeclaration>;
125
139
  };
126
140
  /**
127
141
  * Controller returned by {@link mountAmosApplePayButton}.
package/dist/types.d.ts CHANGED
@@ -56,7 +56,7 @@ export type ConfirmationResult = {
56
56
  * Amos iframe UI. Only the variables you provide are sent; omitted
57
57
  * variables keep their defaults.
58
58
  */
59
- export type ThemeVariable = "--background" | "--foreground" | "--primary" | "--primary-foreground" | "--secondary" | "--secondary-foreground" | "--muted" | "--muted-foreground" | "--accent" | "--accent-foreground" | "--destructive" | "--destructive-foreground" | "--border" | "--popover" | "--popover-foreground" | "--input" | "--input-background" | "--input-height" | "--input-font-size" | "--input-font-weight" | "--input-padding" | "--input-border-width" | "--input-shadow" | "--floating-input-height" | "--floating-label-font-size" | "--floating-label-font-weight" | "--floating-label-color" | "--floating-label-offset" | "--label-font-size" | "--label-font-weight" | "--field-gap" | "--control-gap" | "--error-font-size" | "--radio-size" | "--ring" | "--ring-width" | "--radius";
59
+ export type ThemeVariable = "--background" | "--foreground" | "--primary" | "--primary-foreground" | "--secondary" | "--secondary-foreground" | "--muted" | "--muted-foreground" | "--accent" | "--accent-foreground" | "--destructive" | "--destructive-foreground" | "--border" | "--popover" | "--popover-foreground" | "--input" | "--input-background" | "--input-height" | "--input-font-size" | "--input-font-weight" | "--input-padding" | "--input-border-width" | "--input-shadow" | "--floating-input-height" | "--floating-label-font-size" | "--floating-label-empty-font-size" | "--floating-label-font-weight" | "--floating-label-color" | "--floating-label-floated-color" | "--floating-label-offset" | "--label-font-size" | "--label-font-weight" | "--field-gap" | "--control-gap" | "--error-font-size" | "--radio-size" | "--ring" | "--ring-width" | "--radius";
60
60
  /**
61
61
  * Placement of field labels in payment method forms.
62
62
  *
@@ -78,53 +78,28 @@ export type Appearance = {
78
78
  labels?: AppearanceLabels;
79
79
  };
80
80
  /**
81
- * Inline style bag sent through `postMessage` to the wallet-button iframe.
81
+ * Apple's `<apple-pay-button>` attributes. `@types/applepayjs` only
82
+ * covers `ApplePaySession`, so this bag is the custom element's HTML
83
+ * attributes plus inner `style`. Posted as-is on `buttonProps`.
82
84
  *
83
- * Matches the serializable subset of a CSSStyleDeclaration / React
84
- * `CSSProperties` object (string or number values). Custom properties such
85
- * as `--apple-pay-button-height` are allowed.
86
- */
87
- export type WalletButtonStyle = {
88
- [property: string]: string | number | undefined;
89
- };
90
- /**
91
- * `buttonstyle` attribute on Apple's `<apple-pay-button>`.
92
- *
93
- * @see https://developer.apple.com/documentation/apple_pay_on_the_web/apple-pay-button
94
- */
95
- export type ApplePayButtonStyle = "black" | "white" | "white-outline";
96
- /**
97
- * `type` attribute on Apple's `<apple-pay-button>`.
98
- *
99
- * @see https://developer.apple.com/documentation/apple_pay_on_the_web/apple-pay-button
100
- */
101
- export type ApplePayButtonType = "plain" | "buy" | "set-up" | "donate" | "check-out" | "book" | "subscribe" | "reload" | "add-money" | "top-up" | "order" | "rent" | "support" | "contribute" | "tip";
102
- /**
103
- * Visual props for Apple's `<apple-pay-button>`, using Apple's attribute
104
- * names. Applied inside the Amos embed iframe.
85
+ * Omitted fields keep the painted button's defaults. Height belongs on
86
+ * the mount `height` option.
105
87
  *
106
88
  * @see https://developer.apple.com/documentation/apple_pay_on_the_web/apple-pay-button
107
89
  */
108
90
  export type ApplePayButtonElementProps = {
109
- /**
110
- * Stretch the button to the iframe width while preserving its default
111
- * compact size when omitted.
112
- *
113
- * @default false
114
- */
115
- fullWidth?: boolean;
116
91
  /**
117
92
  * Apple Pay button color.
118
93
  *
119
94
  * @default "black"
120
95
  */
121
- buttonstyle?: ApplePayButtonStyle;
96
+ buttonstyle?: string;
122
97
  /**
123
98
  * Apple Pay button label / verb.
124
99
  *
125
100
  * @default "plain"
126
101
  */
127
- type?: ApplePayButtonType;
102
+ type?: string;
128
103
  /**
129
104
  * BCP 47 locale for the button label (e.g. `"en-US"`).
130
105
  *
@@ -132,58 +107,29 @@ export type ApplePayButtonElementProps = {
132
107
  */
133
108
  locale?: string;
134
109
  /**
135
- * Inline style for the `<apple-pay-button>`. Height is controlled with
136
- * `--apple-pay-button-height` (Apple ignores CSS `height`). Width uses
137
- * `--apple-pay-button-width` or CSS `width`.
110
+ * Inline style for the `<apple-pay-button>`. Omitted keys keep fill
111
+ * (`width: 100%` and `--apple-pay-button-width`).
138
112
  */
139
- style?: WalletButtonStyle;
113
+ style?: Record<string, string | number | undefined>;
140
114
  };
141
115
  /**
142
- * Visual props for Google's Pay button, using `@google-pay/button-react`
143
- * / Google Pay API names. Applied inside the Amos embed iframe.
116
+ * Google Pay button visuals: {@link google.payments.api.ButtonOptions}
117
+ * without the fields that cannot go through `postMessage`, plus inner
118
+ * `style`. Posted as-is on `buttonProps`.
119
+ *
120
+ * Omitted fields keep the painted button's defaults (`buttonType:
121
+ * "plain"`, `buttonSizeMode: "fill"`). Height belongs on the mount
122
+ * `height` option.
144
123
  *
145
124
  * @see https://developers.google.com/pay/api/web/guides/resources/customize
146
125
  */
147
- export type GooglePayButtonElementProps = {
148
- /**
149
- * Stretch the button to the iframe width while preserving its default
150
- * compact size when omitted.
151
- *
152
- * @default false
153
- */
154
- fullWidth?: boolean;
155
- /**
156
- * Button label / verb.
157
- *
158
- * @default "short"
159
- */
160
- buttonType?: google.payments.api.ButtonType;
161
- /** Button color. */
162
- buttonColor?: google.payments.api.ButtonColor;
163
- /** Corner radius in pixels (0–20). */
164
- buttonRadius?: number;
126
+ export type GooglePayButtonElementProps = Omit<google.payments.api.ButtonOptions, "onClick" | "buttonRootNode" | "allowedPaymentMethods"> & {
165
127
  /**
166
- * `"fill"` stretches the button to the container width; `"static"`
167
- * uses Google's default size.
128
+ * Inline style for the Google Pay button wrapper. Omitted keys keep
129
+ * fill (`width: 100%`).
168
130
  */
169
- buttonSizeMode?: google.payments.api.ButtonSizeMode;
170
- /** BCP 47 locale for the button label (e.g. `"en"`). */
171
- buttonLocale?: string;
172
- /** Whether the button draws a border. */
173
- buttonBorderType?: google.payments.api.ButtonBorderType;
174
- /**
175
- * Inline style for the Google Pay button wrapper. Use `height` /
176
- * `width` here (unlike Apple Pay, Google honors CSS `height`).
177
- */
178
- style?: WalletButtonStyle;
131
+ style?: Record<string, string | number | undefined>;
179
132
  };
180
- /**
181
- * Keep only JSON-cloneable string/number declarations from a style object
182
- * before sending it through `postMessage`.
183
- */
184
- export declare function serializeWalletButtonStyle(style: WalletButtonStyle | undefined): Record<string, string | number> | undefined;
185
- export declare function pickApplePayButtonElementProps(options: ApplePayButtonElementProps): ApplePayButtonElementProps;
186
- export declare function pickGooglePayButtonElementProps(options: GooglePayButtonElementProps): GooglePayButtonElementProps;
187
133
  /**
188
134
  * Typed `postMessage` payloads exchanged between the host page and the
189
135
  * embedded Amos iframe.
@@ -211,16 +157,14 @@ export type Message = {
211
157
  type: "UPDATE_APPEARANCE";
212
158
  appearance: Appearance;
213
159
  } | {
214
- /**
215
- * Parent → embed: visual options for the Apple Pay button. Nested
216
- * under `props` so Apple's `type` attribute does not collide with
217
- * this message discriminant.
218
- */
160
+ /** Parent → embed: visual options for the Apple Pay button. */
219
161
  type: "UPDATE_APPLE_PAY_BUTTON";
162
+ height?: string;
220
163
  props: ApplePayButtonElementProps;
221
164
  } | {
222
165
  /** Parent → embed: visual options for the Google Pay button. */
223
166
  type: "UPDATE_GOOGLE_PAY_BUTTON";
167
+ height?: string;
224
168
  props: GooglePayButtonElementProps;
225
169
  } | {
226
170
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amos.com/amos-js",
3
- "version": "0.9.13",
3
+ "version": "0.9.15",
4
4
  "main": "dist/index.js",
5
5
  "repository": {
6
6
  "type": "git",
package/src/apple-pay.ts CHANGED
@@ -14,7 +14,6 @@ import {
14
14
  updateMerchantName as sendUpdateMerchantName,
15
15
  } from "./messaging";
16
16
  import {
17
- type Appearance,
18
17
  type ApplePayButtonElementProps,
19
18
  type ConfirmationResult,
20
19
  createMessage,
@@ -32,22 +31,28 @@ export function getApplePayButtonSrc(renderToken: string): string {
32
31
  * Default iframe pixel height for the Apple Pay button.
33
32
  */
34
33
  export function getApplePayButtonInitialHeight(): string {
35
- return "40px";
34
+ return "48px";
36
35
  }
37
36
 
38
37
  /**
39
38
  * Options accepted by {@link attachApplePayButtonListeners}.
40
39
  */
41
- export type ApplePayButtonListenerOptions = ApplePayButtonElementProps & {
40
+ export type ApplePayButtonListenerOptions = {
42
41
  /** The amount of the payment, in the same format passed in props. */
43
42
  amount: string;
44
43
  /** A user-visible merchant name. */
45
44
  merchantName: string;
46
45
  /**
47
- * Custom appearance to apply when the iframe first becomes ready and
48
- * whenever the appearance changes.
46
+ * Painted Apple Pay button height. CSS length (e.g. `"48px"`).
47
+ * @default "48px"
49
48
  */
50
- appearance?: Appearance;
49
+ height?: string;
50
+ /**
51
+ * Native `<apple-pay-button>` attributes and inner style. Omitted
52
+ * fields keep Apple's defaults (`black` / `plain` / `en-US`). The
53
+ * button fills the iframe — size the mount slot, not the button.
54
+ */
55
+ buttonProps?: ApplePayButtonElementProps;
51
56
  /**
52
57
  * Called whenever the iframe asks the host page to resize it. Update
53
58
  * the iframe's `height` style here.
@@ -85,9 +90,8 @@ export type ApplePayButtonController = {
85
90
  /**
86
91
  * Update one or more listener options without re-attaching the
87
92
  * message listener. Pass `amount` or `merchantName` to push the new
88
- * value into the iframe; pass `appearance` to update theme variables;
89
- * pass `buttonstyle`, `type`, `locale`, or `style` to restyle the
90
- * Apple Pay button.
93
+ * value into the iframe; pass `height` or `buttonProps` to restyle
94
+ * the Apple Pay button.
91
95
  */
92
96
  update: (patch: Partial<ApplePayButtonListenerOptions>) => void;
93
97
  /**
@@ -118,9 +122,12 @@ function sendApplePayCancel(iframe: HTMLIFrameElement): void {
118
122
  */
119
123
  export function attachApplePayButtonListeners(
120
124
  iframe: HTMLIFrameElement,
121
- options: ApplePayButtonListenerOptions,
125
+ { height = "48px", ...options }: ApplePayButtonListenerOptions,
122
126
  ): ApplePayButtonController {
123
- let current = { ...options };
127
+ let current: ApplePayButtonListenerOptions = {
128
+ ...options,
129
+ height,
130
+ };
124
131
 
125
132
  function pushAmount() {
126
133
  sendUpdateAmount({ iframe, amount: current.amount });
@@ -131,7 +138,11 @@ export function attachApplePayButtonListeners(
131
138
  }
132
139
 
133
140
  function pushButtonProps() {
134
- sendUpdateApplePayButton({ iframe, props: current });
141
+ sendUpdateApplePayButton({
142
+ iframe,
143
+ height: current.height ?? "48px",
144
+ props: current.buttonProps ?? {},
145
+ });
135
146
  }
136
147
 
137
148
  function handleMessage(event: MessageEvent<Message>) {
@@ -143,7 +154,7 @@ export function attachApplePayButtonListeners(
143
154
  switch (event.data.type) {
144
155
  case "IFRAME_READY":
145
156
  sendParentReadyMessage(iframe);
146
- sendUpdateAppearance({ iframe, appearance: current.appearance });
157
+ sendUpdateAppearance({ iframe, appearance: {} });
147
158
  pushAmount();
148
159
  pushMerchantName();
149
160
  pushButtonProps();
@@ -205,19 +216,10 @@ export function attachApplePayButtonListeners(
205
216
 
206
217
  return {
207
218
  update(patch) {
208
- const hadAppearance = "appearance" in patch;
209
219
  const hadAmount = "amount" in patch;
210
220
  const hadMerchantName = "merchantName" in patch;
211
- const hadButtonProps =
212
- "fullWidth" in patch ||
213
- "buttonstyle" in patch ||
214
- "type" in patch ||
215
- "locale" in patch ||
216
- "style" in patch;
221
+ const hadButtonProps = "height" in patch || "buttonProps" in patch;
217
222
  current = { ...current, ...patch };
218
- if (hadAppearance) {
219
- sendUpdateAppearance({ iframe, appearance: current.appearance });
220
- }
221
223
  if (hadAmount) {
222
224
  pushAmount();
223
225
  }
package/src/google-pay.ts CHANGED
@@ -11,7 +11,6 @@ import {
11
11
  updateMerchantName as sendUpdateMerchantName,
12
12
  } from "./messaging";
13
13
  import type {
14
- Appearance,
15
14
  ConfirmationResult,
16
15
  GooglePayButtonElementProps,
17
16
  Message,
@@ -28,22 +27,30 @@ export function getGooglePayButtonSrc(renderToken: string): string {
28
27
  * Default iframe pixel height for the Google Pay button.
29
28
  */
30
29
  export function getGooglePayButtonInitialHeight(): string {
31
- return "40px";
30
+ return "48px";
32
31
  }
33
32
 
34
33
  /**
35
34
  * Options accepted by {@link attachGooglePayButtonListeners}.
36
35
  */
37
- export type GooglePayButtonListenerOptions = GooglePayButtonElementProps & {
36
+ export type GooglePayButtonListenerOptions = {
38
37
  /** The amount of the payment, in the same format passed in props. */
39
38
  amount: string;
40
39
  /** A user-visible merchant name. */
41
40
  merchantName: string;
42
41
  /**
43
- * Custom appearance to apply when the iframe first becomes ready and
44
- * whenever the appearance changes.
42
+ * Painted Google Pay button height. CSS length (e.g. `"48px"`).
43
+ * @default "48px"
45
44
  */
46
- appearance?: Appearance;
45
+ height?: string;
46
+ /**
47
+ * Native Google Pay button attributes and inner style. Omitted fields
48
+ * keep Amos paint defaults (`buttonType: "plain"`,
49
+ * `buttonSizeMode: "fill"`). The button fills the iframe — size the
50
+ * mount slot, not the button. Compact: `buttonSizeMode: "static"` and
51
+ * `style.width`.
52
+ */
53
+ buttonProps?: GooglePayButtonElementProps;
47
54
  /**
48
55
  * Called whenever the iframe asks the host page to resize it. Update
49
56
  * the iframe's `height` style here.
@@ -81,10 +88,8 @@ export type GooglePayButtonController = {
81
88
  /**
82
89
  * Update one or more listener options without re-attaching the
83
90
  * message listener. Pass `amount` or `merchantName` to push the new
84
- * value into the iframe; pass `appearance` to update theme variables;
85
- * pass `buttonType`, `buttonColor`, `buttonRadius`, `buttonSizeMode`,
86
- * `buttonLocale`, `buttonBorderType`, or `style` to restyle the
87
- * Google Pay button.
91
+ * value into the iframe; pass `height` or `buttonProps` to restyle
92
+ * the Google Pay button.
88
93
  */
89
94
  update: (patch: Partial<GooglePayButtonListenerOptions>) => void;
90
95
  /**
@@ -103,9 +108,12 @@ export type GooglePayButtonController = {
103
108
  */
104
109
  export function attachGooglePayButtonListeners(
105
110
  iframe: HTMLIFrameElement,
106
- options: GooglePayButtonListenerOptions,
111
+ { height = "48px", ...options }: GooglePayButtonListenerOptions,
107
112
  ): GooglePayButtonController {
108
- let current = { ...options };
113
+ let current: GooglePayButtonListenerOptions = {
114
+ ...options,
115
+ height,
116
+ };
109
117
 
110
118
  function pushAmount() {
111
119
  sendUpdateAmount({ iframe, amount: current.amount });
@@ -116,7 +124,11 @@ export function attachGooglePayButtonListeners(
116
124
  }
117
125
 
118
126
  function pushButtonProps() {
119
- sendUpdateGooglePayButton({ iframe, props: current });
127
+ sendUpdateGooglePayButton({
128
+ iframe,
129
+ height: current.height ?? "48px",
130
+ props: current.buttonProps ?? {},
131
+ });
120
132
  }
121
133
 
122
134
  function handleMessage(event: MessageEvent<Message>) {
@@ -127,7 +139,7 @@ export function attachGooglePayButtonListeners(
127
139
  switch (event.data.type) {
128
140
  case "IFRAME_READY":
129
141
  sendParentReadyMessage(iframe);
130
- sendUpdateAppearance({ iframe, appearance: current.appearance });
142
+ sendUpdateAppearance({ iframe, appearance: {} });
131
143
  pushAmount();
132
144
  pushMerchantName();
133
145
  pushButtonProps();
@@ -174,22 +186,10 @@ export function attachGooglePayButtonListeners(
174
186
 
175
187
  return {
176
188
  update(patch) {
177
- const hadAppearance = "appearance" in patch;
178
189
  const hadAmount = "amount" in patch;
179
190
  const hadMerchantName = "merchantName" in patch;
180
- const hadButtonProps =
181
- "fullWidth" in patch ||
182
- "buttonType" in patch ||
183
- "buttonColor" in patch ||
184
- "buttonRadius" in patch ||
185
- "buttonSizeMode" in patch ||
186
- "buttonLocale" in patch ||
187
- "buttonBorderType" in patch ||
188
- "style" in patch;
191
+ const hadButtonProps = "height" in patch || "buttonProps" in patch;
189
192
  current = { ...current, ...patch };
190
- if (hadAppearance) {
191
- sendUpdateAppearance({ iframe, appearance: current.appearance });
192
- }
193
193
  if (hadAmount) {
194
194
  pushAmount();
195
195
  }
package/src/index.ts CHANGED
@@ -69,19 +69,11 @@ export type {
69
69
  Appearance,
70
70
  AppearanceLabels,
71
71
  ApplePayButtonElementProps,
72
- ApplePayButtonStyle,
73
- ApplePayButtonType,
74
72
  ConfirmationIncompleteReason,
75
73
  ConfirmationResult,
76
74
  GooglePayButtonElementProps,
77
75
  Message,
78
76
  PaymentMethodFormValidityChangeEvent,
79
77
  ThemeVariable,
80
- WalletButtonStyle,
81
- } from "./types";
82
- export {
83
- createMessage,
84
- pickApplePayButtonElementProps,
85
- pickGooglePayButtonElementProps,
86
- serializeWalletButtonStyle,
87
78
  } from "./types";
79
+ export { createMessage } from "./types";
package/src/messaging.ts CHANGED
@@ -6,8 +6,6 @@ import {
6
6
  createMessage,
7
7
  type GooglePayButtonElementProps,
8
8
  type Message,
9
- pickApplePayButtonElementProps,
10
- pickGooglePayButtonElementProps,
11
9
  } from "./types";
12
10
 
13
11
  type Iframe = HTMLIFrameElement | null | undefined;
@@ -69,9 +67,11 @@ export function updateAppearance({
69
67
  export function updateApplePayButton({
70
68
  iframe,
71
69
  props,
70
+ height,
72
71
  }: {
73
72
  iframe: Iframe;
74
73
  props: ApplePayButtonElementProps;
74
+ height?: string;
75
75
  }): void {
76
76
  if (!iframe?.contentWindow) {
77
77
  return;
@@ -80,7 +80,8 @@ export function updateApplePayButton({
80
80
  iframe.contentWindow.postMessage(
81
81
  createMessage({
82
82
  type: "UPDATE_APPLE_PAY_BUTTON",
83
- props: pickApplePayButtonElementProps(props),
83
+ height,
84
+ props,
84
85
  }),
85
86
  getIframeTargetOrigin(iframe),
86
87
  );
@@ -92,9 +93,11 @@ export function updateApplePayButton({
92
93
  export function updateGooglePayButton({
93
94
  iframe,
94
95
  props,
96
+ height,
95
97
  }: {
96
98
  iframe: Iframe;
97
99
  props: GooglePayButtonElementProps;
100
+ height?: string;
98
101
  }): void {
99
102
  if (!iframe?.contentWindow) {
100
103
  return;
@@ -103,7 +106,8 @@ export function updateGooglePayButton({
103
106
  iframe.contentWindow.postMessage(
104
107
  createMessage({
105
108
  type: "UPDATE_GOOGLE_PAY_BUTTON",
106
- props: pickGooglePayButtonElementProps(props),
109
+ height,
110
+ props,
107
111
  }),
108
112
  getIframeTargetOrigin(iframe),
109
113
  );
package/src/mount.ts CHANGED
@@ -77,6 +77,7 @@ function createIframe({
77
77
  name,
78
78
  height,
79
79
  allow,
80
+ className,
80
81
  style = FORM_IFRAME_STYLE,
81
82
  }: {
82
83
  src: string;
@@ -84,6 +85,7 @@ function createIframe({
84
85
  name: string;
85
86
  height: string;
86
87
  allow?: string;
88
+ className?: string;
87
89
  style?: Partial<CSSStyleDeclaration>;
88
90
  }): HTMLIFrameElement {
89
91
  const iframe = document.createElement("iframe");
@@ -95,6 +97,9 @@ function createIframe({
95
97
  if (allow) {
96
98
  iframe.allow = allow;
97
99
  }
100
+ if (className != null) {
101
+ iframe.className = className;
102
+ }
98
103
  Object.assign(iframe.style, style, { height });
99
104
  return iframe;
100
105
  }
@@ -392,6 +397,13 @@ export type AmosGooglePayButtonOptions = GooglePayButtonListenerOptions & {
392
397
  * https://dashboard.amos.com.
393
398
  */
394
399
  renderToken: string;
400
+ /** Class names applied to the host-page `<iframe>` element. */
401
+ iframeClassName?: string;
402
+ /**
403
+ * Inline style applied to the host-page `<iframe>` element. Use CSS
404
+ * lengths with units (`{ borderRadius: "8px" }`).
405
+ */
406
+ iframeStyle?: Partial<CSSStyleDeclaration>;
395
407
  };
396
408
 
397
409
  /**
@@ -414,16 +426,19 @@ export function mountAmosGooglePayButton(
414
426
  options: AmosGooglePayButtonOptions,
415
427
  ): AmosGooglePayButtonMountController {
416
428
  const host = resolveContainer(container);
417
- const { renderToken, ...listenerOptions } = options;
429
+ const { renderToken, iframeClassName, iframeStyle, ...listenerOptions } =
430
+ options;
418
431
 
419
432
  const iframe = createIframe({
420
433
  src: getGooglePayButtonSrc(renderToken),
421
434
  title: "Secure Google Pay button powered by Amos",
422
435
  name: "amos-google-pay-button",
423
- height: getGooglePayButtonInitialHeight(),
436
+ height: listenerOptions.height ?? getGooglePayButtonInitialHeight(),
424
437
  allow: "payment",
438
+ className: iframeClassName,
425
439
  style: WALLET_IFRAME_STYLE,
426
440
  });
441
+ Object.assign(iframe.style, iframeStyle);
427
442
  host.appendChild(iframe);
428
443
 
429
444
  const controller = attachGooglePayButtonListeners(iframe, {
@@ -459,6 +474,13 @@ export type AmosApplePayButtonOptions = ApplePayButtonListenerOptions & {
459
474
  * https://dashboard.amos.com.
460
475
  */
461
476
  renderToken: string;
477
+ /** Class names applied to the host-page `<iframe>` element. */
478
+ iframeClassName?: string;
479
+ /**
480
+ * Inline style applied to the host-page `<iframe>` element. Use CSS
481
+ * lengths with units (`{ borderRadius: "8px" }`).
482
+ */
483
+ iframeStyle?: Partial<CSSStyleDeclaration>;
462
484
  };
463
485
 
464
486
  /**
@@ -481,16 +503,19 @@ export function mountAmosApplePayButton(
481
503
  options: AmosApplePayButtonOptions,
482
504
  ): AmosApplePayButtonMountController {
483
505
  const host = resolveContainer(container);
484
- const { renderToken, ...listenerOptions } = options;
506
+ const { renderToken, iframeClassName, iframeStyle, ...listenerOptions } =
507
+ options;
485
508
 
486
509
  const iframe = createIframe({
487
510
  src: getApplePayButtonSrc(renderToken),
488
511
  title: "Secure Apple Pay button powered by Amos",
489
512
  name: "amos-apple-pay-button",
490
- height: getApplePayButtonInitialHeight(),
513
+ height: listenerOptions.height ?? getApplePayButtonInitialHeight(),
491
514
  allow: "payment",
515
+ className: iframeClassName,
492
516
  style: WALLET_IFRAME_STYLE,
493
517
  });
518
+ Object.assign(iframe.style, iframeStyle);
494
519
  host.appendChild(iframe);
495
520
 
496
521
  const controller = attachApplePayButtonListeners(iframe, {