straumur-web-component 2.0.0-alpha.2 → 2.0.0-alpha.20

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,17 @@ 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";
87
+ /**
88
+ * Which payment method to open (expand) on load via `openDefaultPaymentMethod`. "firstStoredCard"
89
+ * opens the first saved card. Ignored (nothing pre-opened, chooser stays collapsed) when the
90
+ * requested method isn't available (e.g. a wallet that's in `instantPayments`, or no saved cards).
91
+ */
92
+ type OpenDefaultPaymentMethod = "card" | "firstStoredCard" | "googlepay" | "applepay";
82
93
 
83
94
  interface ICreatePaymentBody {
84
95
  sessionId: string;
@@ -124,12 +135,43 @@ type StraumurWebBaseConfiguration = {
124
135
  onCardValidityChanged?: (isValid: boolean, isActive: boolean) => void;
125
136
  allowedPaymentMethods?: PaymentMethod[];
126
137
  /**
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".
138
+ * Top-to-bottom order of the payment-method options. Tokens: "card", "storedcard", "googlepay",
139
+ * "applepay", and "instantpayments" (the express wallet row). A wallet listed in `instantPayments`
140
+ * renders only inside the "instantpayments" slot, never standalone, so its standalone token here is
141
+ * effectively ignored. Any available method you omit is appended in the default order. Defaults to
142
+ * ["instantpayments", "storedcard", "card", "googlepay", "applepay"].
129
143
  */
130
- theme?: Theme;
144
+ orderPaymentMethods?: PaymentMethodOrder[];
145
+ /**
146
+ * Which payment method to open (expand) on load: "card", "firstStoredCard", "googlepay" or
147
+ * "applepay". If that method isn't available — a wallet that's in `instantPayments`, or
148
+ * "firstStoredCard" with no saved cards — it's ignored and no method is pre-opened (the chooser
149
+ * stays collapsed). Omit for the same collapsed default.
150
+ */
151
+ openDefaultPaymentMethod?: OpenDefaultPaymentMethod;
152
+ /**
153
+ * Color theme for the widget. Accepts a mode ("light" | "dark" | "system"), or a
154
+ * {@link ThemeConfiguration} object to also override the wallet button styling. "system" follows
155
+ * the shopper's OS/browser preference (`prefers-color-scheme`) and updates live if it changes.
156
+ * Defaults to "light".
157
+ */
158
+ theme?: Theme | ThemeConfiguration;
131
159
  };
132
160
  type Theme = "light" | "dark" | "system";
161
+ /** Google Pay button style override: "white" = light button, "dark" = black button. */
162
+ type GooglePayButtonTheme = "dark" | "white";
163
+ /** Apple Pay button style override: "light" = white button, "dark" = black button. */
164
+ type ApplePayButtonTheme = "dark" | "light";
165
+ /**
166
+ * Object form of `theme`: the widget color mode plus optional per-wallet button overrides.
167
+ * When an override is omitted the wallet button follows the mode — a light widget gets a
168
+ * light/white button, a dark widget gets a black one.
169
+ */
170
+ type ThemeConfiguration = {
171
+ theme: Theme;
172
+ googlePayButtonTheme?: GooglePayButtonTheme;
173
+ applePayButtonTheme?: ApplePayButtonTheme;
174
+ };
133
175
  type StraumurWebConfiguration = StraumurWebBaseConfiguration & {
134
176
  sessionId: string;
135
177
  };
@@ -183,7 +225,11 @@ type StraumurCheckoutConfiguration = {
183
225
  hideSubmitButton?: boolean;
184
226
  onCardValidityChanged?: (isValid: boolean, isActive: boolean) => void;
185
227
  allowedPaymentMethods?: PaymentMethod[];
228
+ orderPaymentMethods?: PaymentMethodOrder[];
229
+ openDefaultPaymentMethod?: OpenDefaultPaymentMethod;
186
230
  theme: Theme;
231
+ googlePayButtonTheme?: GooglePayButtonTheme;
232
+ applePayButtonTheme?: ApplePayButtonTheme;
187
233
  };
188
234
  type StraumurCheckoutUpdateOptions = Partial<Omit<StraumurCheckoutConfiguration, "mode" | "paymentFlow" | "locale">> & {
189
235
  locale?: PublicLocale;
@@ -212,4 +258,4 @@ declare class StraumurCheckout {
212
258
  submitCard(): boolean;
213
259
  }
214
260
 
215
- export { type PaymentCompletedData, type PaymentFailedData, type Placeholders, type ResultCode, StraumurCheckout, type StraumurWebConfiguration };
261
+ export { type ApplePayButtonTheme, type GooglePayButtonTheme, type OpenDefaultPaymentMethod, 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,17 @@ 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";
87
+ /**
88
+ * Which payment method to open (expand) on load via `openDefaultPaymentMethod`. "firstStoredCard"
89
+ * opens the first saved card. Ignored (nothing pre-opened, chooser stays collapsed) when the
90
+ * requested method isn't available (e.g. a wallet that's in `instantPayments`, or no saved cards).
91
+ */
92
+ type OpenDefaultPaymentMethod = "card" | "firstStoredCard" | "googlepay" | "applepay";
82
93
 
83
94
  interface ICreatePaymentBody {
84
95
  sessionId: string;
@@ -124,12 +135,43 @@ type StraumurWebBaseConfiguration = {
124
135
  onCardValidityChanged?: (isValid: boolean, isActive: boolean) => void;
125
136
  allowedPaymentMethods?: PaymentMethod[];
126
137
  /**
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".
138
+ * Top-to-bottom order of the payment-method options. Tokens: "card", "storedcard", "googlepay",
139
+ * "applepay", and "instantpayments" (the express wallet row). A wallet listed in `instantPayments`
140
+ * renders only inside the "instantpayments" slot, never standalone, so its standalone token here is
141
+ * effectively ignored. Any available method you omit is appended in the default order. Defaults to
142
+ * ["instantpayments", "storedcard", "card", "googlepay", "applepay"].
129
143
  */
130
- theme?: Theme;
144
+ orderPaymentMethods?: PaymentMethodOrder[];
145
+ /**
146
+ * Which payment method to open (expand) on load: "card", "firstStoredCard", "googlepay" or
147
+ * "applepay". If that method isn't available — a wallet that's in `instantPayments`, or
148
+ * "firstStoredCard" with no saved cards — it's ignored and no method is pre-opened (the chooser
149
+ * stays collapsed). Omit for the same collapsed default.
150
+ */
151
+ openDefaultPaymentMethod?: OpenDefaultPaymentMethod;
152
+ /**
153
+ * Color theme for the widget. Accepts a mode ("light" | "dark" | "system"), or a
154
+ * {@link ThemeConfiguration} object to also override the wallet button styling. "system" follows
155
+ * the shopper's OS/browser preference (`prefers-color-scheme`) and updates live if it changes.
156
+ * Defaults to "light".
157
+ */
158
+ theme?: Theme | ThemeConfiguration;
131
159
  };
132
160
  type Theme = "light" | "dark" | "system";
161
+ /** Google Pay button style override: "white" = light button, "dark" = black button. */
162
+ type GooglePayButtonTheme = "dark" | "white";
163
+ /** Apple Pay button style override: "light" = white button, "dark" = black button. */
164
+ type ApplePayButtonTheme = "dark" | "light";
165
+ /**
166
+ * Object form of `theme`: the widget color mode plus optional per-wallet button overrides.
167
+ * When an override is omitted the wallet button follows the mode — a light widget gets a
168
+ * light/white button, a dark widget gets a black one.
169
+ */
170
+ type ThemeConfiguration = {
171
+ theme: Theme;
172
+ googlePayButtonTheme?: GooglePayButtonTheme;
173
+ applePayButtonTheme?: ApplePayButtonTheme;
174
+ };
133
175
  type StraumurWebConfiguration = StraumurWebBaseConfiguration & {
134
176
  sessionId: string;
135
177
  };
@@ -183,7 +225,11 @@ type StraumurCheckoutConfiguration = {
183
225
  hideSubmitButton?: boolean;
184
226
  onCardValidityChanged?: (isValid: boolean, isActive: boolean) => void;
185
227
  allowedPaymentMethods?: PaymentMethod[];
228
+ orderPaymentMethods?: PaymentMethodOrder[];
229
+ openDefaultPaymentMethod?: OpenDefaultPaymentMethod;
186
230
  theme: Theme;
231
+ googlePayButtonTheme?: GooglePayButtonTheme;
232
+ applePayButtonTheme?: ApplePayButtonTheme;
187
233
  };
188
234
  type StraumurCheckoutUpdateOptions = Partial<Omit<StraumurCheckoutConfiguration, "mode" | "paymentFlow" | "locale">> & {
189
235
  locale?: PublicLocale;
@@ -212,4 +258,4 @@ declare class StraumurCheckout {
212
258
  submitCard(): boolean;
213
259
  }
214
260
 
215
- export { type PaymentCompletedData, type PaymentFailedData, type Placeholders, type ResultCode, StraumurCheckout, type StraumurWebConfiguration };
261
+ export { type ApplePayButtonTheme, type GooglePayButtonTheme, type OpenDefaultPaymentMethod, type PaymentCompletedData, type PaymentFailedData, type PaymentMethod, type PaymentMethodOrder, type Placeholders, type ResultCode, StraumurCheckout, type StraumurWebConfiguration, type Theme, type ThemeConfiguration };