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

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
@@ -11,6 +11,8 @@ declare const translations: {
11
11
  "cards.saveCardDetails": string;
12
12
  "googlePay.title": string;
13
13
  "applePay.title": string;
14
+ "kortalan.title": string;
15
+ "kortalan.payButton": string;
14
16
  "stored-cards.expiryDate": string;
15
17
  "stored-cards.securityCode3Digits": string;
16
18
  "stored-cards.securityCode3DigitsOptional": string;
@@ -47,6 +49,8 @@ declare const translations: {
47
49
  "cards.saveCardDetails": string;
48
50
  "googlePay.title": string;
49
51
  "applePay.title": string;
52
+ "kortalan.title": string;
53
+ "kortalan.payButton": string;
50
54
  "stored-cards.expiryDate": string;
51
55
  "stored-cards.securityCode3Digits": string;
52
56
  "stored-cards.securityCode3DigitsOptional": string;
@@ -78,7 +82,18 @@ type TranslationKey = keyof (typeof translations)["en-US"] | keyof (typeof trans
78
82
  /** The locale vocabulary of the public API: short codes only. */
79
83
  type PublicLocale = "is" | "en";
80
84
 
81
- type PaymentMethod = "card" | "storedcard" | "googlepay" | "applepay";
85
+ type PaymentMethod = "card" | "storedcard" | "googlepay" | "applepay" | "kortalan";
86
+ /**
87
+ * A slot in the rendered payment-method list: a standalone method, or "instantpayments" for the
88
+ * express wallet row. Used to order the options via `orderPaymentMethods`.
89
+ */
90
+ type PaymentMethodOrder = PaymentMethod | "instantpayments";
91
+ /**
92
+ * Which payment method to open (expand) on load via `openDefaultPaymentMethod`. "firstStoredCard"
93
+ * opens the first saved card. Ignored (nothing pre-opened, chooser stays collapsed) when the
94
+ * requested method isn't available (e.g. a wallet that's in `instantPayments`, or no saved cards).
95
+ */
96
+ type OpenDefaultPaymentMethod = "card" | "firstStoredCard" | "googlepay" | "applepay";
82
97
 
83
98
  interface ICreatePaymentBody {
84
99
  sessionId: string;
@@ -105,6 +120,7 @@ interface BrowserInfo {
105
120
  }
106
121
  interface ICreateDetailsBody {
107
122
  sessionId: string;
123
+ paymentCheckoutReference?: string;
108
124
  details: {
109
125
  redirectResult?: string;
110
126
  threeDSResult?: string;
@@ -124,12 +140,43 @@ type StraumurWebBaseConfiguration = {
124
140
  onCardValidityChanged?: (isValid: boolean, isActive: boolean) => void;
125
141
  allowedPaymentMethods?: PaymentMethod[];
126
142
  /**
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".
143
+ * Top-to-bottom order of the payment-method options. Tokens: "card", "storedcard", "googlepay",
144
+ * "applepay", and "instantpayments" (the express wallet row). A wallet listed in `instantPayments`
145
+ * renders only inside the "instantpayments" slot, never standalone, so its standalone token here is
146
+ * effectively ignored. Any available method you omit is appended in the default order. Defaults to
147
+ * ["instantpayments", "storedcard", "card", "googlepay", "applepay"].
129
148
  */
130
- theme?: Theme;
149
+ orderPaymentMethods?: PaymentMethodOrder[];
150
+ /**
151
+ * Which payment method to open (expand) on load: "card", "firstStoredCard", "googlepay" or
152
+ * "applepay". If that method isn't available — a wallet that's in `instantPayments`, or
153
+ * "firstStoredCard" with no saved cards — it's ignored and no method is pre-opened (the chooser
154
+ * stays collapsed). Omit for the same collapsed default.
155
+ */
156
+ openDefaultPaymentMethod?: OpenDefaultPaymentMethod;
157
+ /**
158
+ * Color theme for the widget. Accepts a mode ("light" | "dark" | "system"), or a
159
+ * {@link ThemeConfiguration} object to also override the wallet button styling. "system" follows
160
+ * the shopper's OS/browser preference (`prefers-color-scheme`) and updates live if it changes.
161
+ * Defaults to "light".
162
+ */
163
+ theme?: Theme | ThemeConfiguration;
131
164
  };
132
165
  type Theme = "light" | "dark" | "system";
166
+ /** Google Pay button style override: "white" = light button, "dark" = black button. */
167
+ type GooglePayButtonTheme = "dark" | "white";
168
+ /** Apple Pay button style override: "light" = white button, "dark" = black button. */
169
+ type ApplePayButtonTheme = "dark" | "light";
170
+ /**
171
+ * Object form of `theme`: the widget color mode plus optional per-wallet button overrides.
172
+ * When an override is omitted the wallet button follows the mode — a light widget gets a
173
+ * light/white button, a dark widget gets a black one.
174
+ */
175
+ type ThemeConfiguration = {
176
+ theme: Theme;
177
+ googlePayButtonTheme?: GooglePayButtonTheme;
178
+ applePayButtonTheme?: ApplePayButtonTheme;
179
+ };
133
180
  type StraumurWebConfiguration = StraumurWebBaseConfiguration & {
134
181
  sessionId: string;
135
182
  };
@@ -183,7 +230,11 @@ type StraumurCheckoutConfiguration = {
183
230
  hideSubmitButton?: boolean;
184
231
  onCardValidityChanged?: (isValid: boolean, isActive: boolean) => void;
185
232
  allowedPaymentMethods?: PaymentMethod[];
233
+ orderPaymentMethods?: PaymentMethodOrder[];
234
+ openDefaultPaymentMethod?: OpenDefaultPaymentMethod;
186
235
  theme: Theme;
236
+ googlePayButtonTheme?: GooglePayButtonTheme;
237
+ applePayButtonTheme?: ApplePayButtonTheme;
187
238
  };
188
239
  type StraumurCheckoutUpdateOptions = Partial<Omit<StraumurCheckoutConfiguration, "mode" | "paymentFlow" | "locale">> & {
189
240
  locale?: PublicLocale;
@@ -193,7 +244,6 @@ type Placeholders = Partial<Record<PlaceholderKeys, string>>;
193
244
 
194
245
  declare class StraumurCheckout {
195
246
  private configuration;
196
- private advancedConfiguration;
197
247
  private paymentMethods;
198
248
  private mountElement;
199
249
  private i18n;
@@ -204,12 +254,11 @@ declare class StraumurCheckout {
204
254
  private renderComponent;
205
255
  handleSuccess(message: ResultMessage): void;
206
256
  handleError(message: ResultMessage): void;
207
- private resolveRedirectContext;
208
- submitDetails(redirectResult: string, selector?: HTMLElement | string): Promise<void>;
257
+ submitDetails(redirectResult: string, paymentCheckoutReference?: string, selector?: HTMLElement | string): Promise<void>;
209
258
  updateConfig(newConfig: StraumurCheckoutUpdateOptions): void;
210
259
  setLanguage(locale: PublicLocale): void;
211
260
  destroy(): void;
212
261
  submitCard(): boolean;
213
262
  }
214
263
 
215
- export { type PaymentCompletedData, type PaymentFailedData, type Placeholders, type ResultCode, StraumurCheckout, type StraumurWebConfiguration };
264
+ 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
@@ -11,6 +11,8 @@ declare const translations: {
11
11
  "cards.saveCardDetails": string;
12
12
  "googlePay.title": string;
13
13
  "applePay.title": string;
14
+ "kortalan.title": string;
15
+ "kortalan.payButton": string;
14
16
  "stored-cards.expiryDate": string;
15
17
  "stored-cards.securityCode3Digits": string;
16
18
  "stored-cards.securityCode3DigitsOptional": string;
@@ -47,6 +49,8 @@ declare const translations: {
47
49
  "cards.saveCardDetails": string;
48
50
  "googlePay.title": string;
49
51
  "applePay.title": string;
52
+ "kortalan.title": string;
53
+ "kortalan.payButton": string;
50
54
  "stored-cards.expiryDate": string;
51
55
  "stored-cards.securityCode3Digits": string;
52
56
  "stored-cards.securityCode3DigitsOptional": string;
@@ -78,7 +82,18 @@ type TranslationKey = keyof (typeof translations)["en-US"] | keyof (typeof trans
78
82
  /** The locale vocabulary of the public API: short codes only. */
79
83
  type PublicLocale = "is" | "en";
80
84
 
81
- type PaymentMethod = "card" | "storedcard" | "googlepay" | "applepay";
85
+ type PaymentMethod = "card" | "storedcard" | "googlepay" | "applepay" | "kortalan";
86
+ /**
87
+ * A slot in the rendered payment-method list: a standalone method, or "instantpayments" for the
88
+ * express wallet row. Used to order the options via `orderPaymentMethods`.
89
+ */
90
+ type PaymentMethodOrder = PaymentMethod | "instantpayments";
91
+ /**
92
+ * Which payment method to open (expand) on load via `openDefaultPaymentMethod`. "firstStoredCard"
93
+ * opens the first saved card. Ignored (nothing pre-opened, chooser stays collapsed) when the
94
+ * requested method isn't available (e.g. a wallet that's in `instantPayments`, or no saved cards).
95
+ */
96
+ type OpenDefaultPaymentMethod = "card" | "firstStoredCard" | "googlepay" | "applepay";
82
97
 
83
98
  interface ICreatePaymentBody {
84
99
  sessionId: string;
@@ -105,6 +120,7 @@ interface BrowserInfo {
105
120
  }
106
121
  interface ICreateDetailsBody {
107
122
  sessionId: string;
123
+ paymentCheckoutReference?: string;
108
124
  details: {
109
125
  redirectResult?: string;
110
126
  threeDSResult?: string;
@@ -124,12 +140,43 @@ type StraumurWebBaseConfiguration = {
124
140
  onCardValidityChanged?: (isValid: boolean, isActive: boolean) => void;
125
141
  allowedPaymentMethods?: PaymentMethod[];
126
142
  /**
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".
143
+ * Top-to-bottom order of the payment-method options. Tokens: "card", "storedcard", "googlepay",
144
+ * "applepay", and "instantpayments" (the express wallet row). A wallet listed in `instantPayments`
145
+ * renders only inside the "instantpayments" slot, never standalone, so its standalone token here is
146
+ * effectively ignored. Any available method you omit is appended in the default order. Defaults to
147
+ * ["instantpayments", "storedcard", "card", "googlepay", "applepay"].
129
148
  */
130
- theme?: Theme;
149
+ orderPaymentMethods?: PaymentMethodOrder[];
150
+ /**
151
+ * Which payment method to open (expand) on load: "card", "firstStoredCard", "googlepay" or
152
+ * "applepay". If that method isn't available — a wallet that's in `instantPayments`, or
153
+ * "firstStoredCard" with no saved cards — it's ignored and no method is pre-opened (the chooser
154
+ * stays collapsed). Omit for the same collapsed default.
155
+ */
156
+ openDefaultPaymentMethod?: OpenDefaultPaymentMethod;
157
+ /**
158
+ * Color theme for the widget. Accepts a mode ("light" | "dark" | "system"), or a
159
+ * {@link ThemeConfiguration} object to also override the wallet button styling. "system" follows
160
+ * the shopper's OS/browser preference (`prefers-color-scheme`) and updates live if it changes.
161
+ * Defaults to "light".
162
+ */
163
+ theme?: Theme | ThemeConfiguration;
131
164
  };
132
165
  type Theme = "light" | "dark" | "system";
166
+ /** Google Pay button style override: "white" = light button, "dark" = black button. */
167
+ type GooglePayButtonTheme = "dark" | "white";
168
+ /** Apple Pay button style override: "light" = white button, "dark" = black button. */
169
+ type ApplePayButtonTheme = "dark" | "light";
170
+ /**
171
+ * Object form of `theme`: the widget color mode plus optional per-wallet button overrides.
172
+ * When an override is omitted the wallet button follows the mode — a light widget gets a
173
+ * light/white button, a dark widget gets a black one.
174
+ */
175
+ type ThemeConfiguration = {
176
+ theme: Theme;
177
+ googlePayButtonTheme?: GooglePayButtonTheme;
178
+ applePayButtonTheme?: ApplePayButtonTheme;
179
+ };
133
180
  type StraumurWebConfiguration = StraumurWebBaseConfiguration & {
134
181
  sessionId: string;
135
182
  };
@@ -183,7 +230,11 @@ type StraumurCheckoutConfiguration = {
183
230
  hideSubmitButton?: boolean;
184
231
  onCardValidityChanged?: (isValid: boolean, isActive: boolean) => void;
185
232
  allowedPaymentMethods?: PaymentMethod[];
233
+ orderPaymentMethods?: PaymentMethodOrder[];
234
+ openDefaultPaymentMethod?: OpenDefaultPaymentMethod;
186
235
  theme: Theme;
236
+ googlePayButtonTheme?: GooglePayButtonTheme;
237
+ applePayButtonTheme?: ApplePayButtonTheme;
187
238
  };
188
239
  type StraumurCheckoutUpdateOptions = Partial<Omit<StraumurCheckoutConfiguration, "mode" | "paymentFlow" | "locale">> & {
189
240
  locale?: PublicLocale;
@@ -193,7 +244,6 @@ type Placeholders = Partial<Record<PlaceholderKeys, string>>;
193
244
 
194
245
  declare class StraumurCheckout {
195
246
  private configuration;
196
- private advancedConfiguration;
197
247
  private paymentMethods;
198
248
  private mountElement;
199
249
  private i18n;
@@ -204,12 +254,11 @@ declare class StraumurCheckout {
204
254
  private renderComponent;
205
255
  handleSuccess(message: ResultMessage): void;
206
256
  handleError(message: ResultMessage): void;
207
- private resolveRedirectContext;
208
- submitDetails(redirectResult: string, selector?: HTMLElement | string): Promise<void>;
257
+ submitDetails(redirectResult: string, paymentCheckoutReference?: string, selector?: HTMLElement | string): Promise<void>;
209
258
  updateConfig(newConfig: StraumurCheckoutUpdateOptions): void;
210
259
  setLanguage(locale: PublicLocale): void;
211
260
  destroy(): void;
212
261
  submitCard(): boolean;
213
262
  }
214
263
 
215
- export { type PaymentCompletedData, type PaymentFailedData, type Placeholders, type ResultCode, StraumurCheckout, type StraumurWebConfiguration };
264
+ 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 };