straumur-web-component 2.0.0-alpha.4 → 2.0.0-alpha.6

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/index.d.cts CHANGED
@@ -79,6 +79,11 @@ type TranslationKey = keyof (typeof translations)["en-US"] | keyof (typeof trans
79
79
  type PublicLocale = "is" | "en";
80
80
 
81
81
  type PaymentMethod = "card" | "storedcard" | "googlepay" | "applepay";
82
+ /**
83
+ * A slot in the rendered payment-method list: a standalone method, or "instantpayments" for the
84
+ * express wallet row. Used to order the options via `orderPaymentMethods`.
85
+ */
86
+ type PaymentMethodOrder = PaymentMethod | "instantpayments";
82
87
 
83
88
  interface ICreatePaymentBody {
84
89
  sessionId: string;
@@ -124,12 +129,36 @@ type StraumurWebBaseConfiguration = {
124
129
  onCardValidityChanged?: (isValid: boolean, isActive: boolean) => void;
125
130
  allowedPaymentMethods?: PaymentMethod[];
126
131
  /**
127
- * Color theme for the widget. "system" follows the shopper's OS/browser preference
128
- * (`prefers-color-scheme`) and updates live if it changes. Defaults to "light".
132
+ * Top-to-bottom order of the payment-method options. Tokens: "card", "storedcard", "googlepay",
133
+ * "applepay", and "instantpayments" (the express wallet row). A wallet listed in `instantPayments`
134
+ * renders only inside the "instantpayments" slot, never standalone, so its standalone token here is
135
+ * effectively ignored. Any available method you omit is appended in the default order. Defaults to
136
+ * ["instantpayments", "storedcard", "card", "googlepay", "applepay"].
129
137
  */
130
- theme?: Theme;
138
+ orderPaymentMethods?: PaymentMethodOrder[];
139
+ /**
140
+ * Color theme for the widget. Accepts a mode ("light" | "dark" | "system"), or a
141
+ * {@link ThemeConfiguration} object to also override the wallet button styling. "system" follows
142
+ * the shopper's OS/browser preference (`prefers-color-scheme`) and updates live if it changes.
143
+ * Defaults to "light".
144
+ */
145
+ theme?: Theme | ThemeConfiguration;
131
146
  };
132
147
  type Theme = "light" | "dark" | "system";
148
+ /** Google Pay button style override: "white" = light button, "dark" = black button. */
149
+ type GooglePayButtonTheme = "dark" | "white";
150
+ /** Apple Pay button style override: "light" = white button, "dark" = black button. */
151
+ type ApplePayButtonTheme = "dark" | "light";
152
+ /**
153
+ * Object form of `theme`: the widget color mode plus optional per-wallet button overrides.
154
+ * When an override is omitted the wallet button follows the mode — a light widget gets a
155
+ * light/white button, a dark widget gets a black one.
156
+ */
157
+ type ThemeConfiguration = {
158
+ theme: Theme;
159
+ googlePayButtonTheme?: GooglePayButtonTheme;
160
+ applePayButtonTheme?: ApplePayButtonTheme;
161
+ };
133
162
  type StraumurWebConfiguration = StraumurWebBaseConfiguration & {
134
163
  sessionId: string;
135
164
  };
@@ -183,7 +212,10 @@ type StraumurCheckoutConfiguration = {
183
212
  hideSubmitButton?: boolean;
184
213
  onCardValidityChanged?: (isValid: boolean, isActive: boolean) => void;
185
214
  allowedPaymentMethods?: PaymentMethod[];
215
+ orderPaymentMethods?: PaymentMethodOrder[];
186
216
  theme: Theme;
217
+ googlePayButtonTheme?: GooglePayButtonTheme;
218
+ applePayButtonTheme?: ApplePayButtonTheme;
187
219
  };
188
220
  type StraumurCheckoutUpdateOptions = Partial<Omit<StraumurCheckoutConfiguration, "mode" | "paymentFlow" | "locale">> & {
189
221
  locale?: PublicLocale;
@@ -212,4 +244,4 @@ declare class StraumurCheckout {
212
244
  submitCard(): boolean;
213
245
  }
214
246
 
215
- export { type PaymentCompletedData, type PaymentFailedData, type Placeholders, type ResultCode, StraumurCheckout, type StraumurWebConfiguration };
247
+ export { type ApplePayButtonTheme, type GooglePayButtonTheme, type PaymentCompletedData, type PaymentFailedData, type PaymentMethod, type PaymentMethodOrder, type Placeholders, type ResultCode, StraumurCheckout, type StraumurWebConfiguration, type Theme, type ThemeConfiguration };
package/dist/index.d.ts CHANGED
@@ -79,6 +79,11 @@ type TranslationKey = keyof (typeof translations)["en-US"] | keyof (typeof trans
79
79
  type PublicLocale = "is" | "en";
80
80
 
81
81
  type PaymentMethod = "card" | "storedcard" | "googlepay" | "applepay";
82
+ /**
83
+ * A slot in the rendered payment-method list: a standalone method, or "instantpayments" for the
84
+ * express wallet row. Used to order the options via `orderPaymentMethods`.
85
+ */
86
+ type PaymentMethodOrder = PaymentMethod | "instantpayments";
82
87
 
83
88
  interface ICreatePaymentBody {
84
89
  sessionId: string;
@@ -124,12 +129,36 @@ type StraumurWebBaseConfiguration = {
124
129
  onCardValidityChanged?: (isValid: boolean, isActive: boolean) => void;
125
130
  allowedPaymentMethods?: PaymentMethod[];
126
131
  /**
127
- * Color theme for the widget. "system" follows the shopper's OS/browser preference
128
- * (`prefers-color-scheme`) and updates live if it changes. Defaults to "light".
132
+ * Top-to-bottom order of the payment-method options. Tokens: "card", "storedcard", "googlepay",
133
+ * "applepay", and "instantpayments" (the express wallet row). A wallet listed in `instantPayments`
134
+ * renders only inside the "instantpayments" slot, never standalone, so its standalone token here is
135
+ * effectively ignored. Any available method you omit is appended in the default order. Defaults to
136
+ * ["instantpayments", "storedcard", "card", "googlepay", "applepay"].
129
137
  */
130
- theme?: Theme;
138
+ orderPaymentMethods?: PaymentMethodOrder[];
139
+ /**
140
+ * Color theme for the widget. Accepts a mode ("light" | "dark" | "system"), or a
141
+ * {@link ThemeConfiguration} object to also override the wallet button styling. "system" follows
142
+ * the shopper's OS/browser preference (`prefers-color-scheme`) and updates live if it changes.
143
+ * Defaults to "light".
144
+ */
145
+ theme?: Theme | ThemeConfiguration;
131
146
  };
132
147
  type Theme = "light" | "dark" | "system";
148
+ /** Google Pay button style override: "white" = light button, "dark" = black button. */
149
+ type GooglePayButtonTheme = "dark" | "white";
150
+ /** Apple Pay button style override: "light" = white button, "dark" = black button. */
151
+ type ApplePayButtonTheme = "dark" | "light";
152
+ /**
153
+ * Object form of `theme`: the widget color mode plus optional per-wallet button overrides.
154
+ * When an override is omitted the wallet button follows the mode — a light widget gets a
155
+ * light/white button, a dark widget gets a black one.
156
+ */
157
+ type ThemeConfiguration = {
158
+ theme: Theme;
159
+ googlePayButtonTheme?: GooglePayButtonTheme;
160
+ applePayButtonTheme?: ApplePayButtonTheme;
161
+ };
133
162
  type StraumurWebConfiguration = StraumurWebBaseConfiguration & {
134
163
  sessionId: string;
135
164
  };
@@ -183,7 +212,10 @@ type StraumurCheckoutConfiguration = {
183
212
  hideSubmitButton?: boolean;
184
213
  onCardValidityChanged?: (isValid: boolean, isActive: boolean) => void;
185
214
  allowedPaymentMethods?: PaymentMethod[];
215
+ orderPaymentMethods?: PaymentMethodOrder[];
186
216
  theme: Theme;
217
+ googlePayButtonTheme?: GooglePayButtonTheme;
218
+ applePayButtonTheme?: ApplePayButtonTheme;
187
219
  };
188
220
  type StraumurCheckoutUpdateOptions = Partial<Omit<StraumurCheckoutConfiguration, "mode" | "paymentFlow" | "locale">> & {
189
221
  locale?: PublicLocale;
@@ -212,4 +244,4 @@ declare class StraumurCheckout {
212
244
  submitCard(): boolean;
213
245
  }
214
246
 
215
- export { type PaymentCompletedData, type PaymentFailedData, type Placeholders, type ResultCode, StraumurCheckout, type StraumurWebConfiguration };
247
+ export { type ApplePayButtonTheme, type GooglePayButtonTheme, type PaymentCompletedData, type PaymentFailedData, type PaymentMethod, type PaymentMethodOrder, type Placeholders, type ResultCode, StraumurCheckout, type StraumurWebConfiguration, type Theme, type ThemeConfiguration };