@sunbay/checkout-sdk-js 0.0.9 → 0.1.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.
package/README.md CHANGED
@@ -55,7 +55,7 @@ with a CSS selector or an empty `HTMLElement`.
55
55
  | --- | --- | --- |
56
56
  | `card` | `showBillingAddress`, `showShippingAddress`, `showPostalCode`, `appearance` | Combined card form. Exclusive with split fields. |
57
57
  | `cardNumber` / `cardExpiry` / `cardCvc` | `appearance` | Split fields. Exclusive with `card`. |
58
- | `address` | `mode: 'billing' \| 'shipping'` (required), `appearance` | One per mode. |
58
+ | `address` | `mode: 'billing' \| 'shipping'` (required), `style: 'full' \| 'simple'` (default `'full'`), `appearance` | One per mode. `simple` = country, address line 1, postal code (+ first and last name for shipping). |
59
59
  | `expressCheckout` | `paymentMethods.applePay` / `googlePay` (`false` hides; or `{ buttonTheme, buttonType }`), `layout.maxColumns`, `buttonHeight` (30-64, default 40) | Singleton. Wallet buttons. |
60
60
 
61
61
  Handle methods: `mount`, `unmount`, `update(patch)`, `destroy`, `getStatus`,
@@ -91,6 +91,9 @@ registration. Handler exceptions are isolated and rethrown asynchronously (they
91
91
  - `pending` or any unknown state is **not a failure**. Do **not** retry or let the user
92
92
  pay again. Reconcile with `getPaymentStatus()` (`txnStatus`: `I|S|F|R`) and wait for the
93
93
  terminal `paymentResult` event.
94
+ - `failed` ends the attempt, not the session: on a multi-attempt session (created without
95
+ `transactionRequestId`) the buyer can retry, so one session may emit several
96
+ `paymentResult` events. De-duplicate by `operationId`; the first `succeeded` is final.
94
97
  - The confirm slot stays held (`CHECKOUT_BUSY`) until a terminal result arrives, or you
95
98
  call `destroy()` and create a new instance with `createCheckout`. This also applies
96
99
  after the watchdog resolved `pending`.
package/dist/index.cjs CHANGED
@@ -852,10 +852,13 @@ var CheckoutElement = class _CheckoutElement {
852
852
  let query = `?checkoutId=${encodeURIComponent(this.checkoutId)}`;
853
853
  query += `&elementId=${encodeURIComponent(this.elementId)}`;
854
854
  if (this.type === "address") {
855
- const mode = this.options?.mode;
855
+ const { mode, style } = this.options ?? {};
856
856
  if (mode) {
857
857
  query += `&mode=${encodeURIComponent(mode)}`;
858
858
  }
859
+ if (style === "simple" || style === "full") {
860
+ query += `&style=${style}`;
861
+ }
859
862
  }
860
863
  if (this.colorScheme) {
861
864
  query += `&colorScheme=${encodeURIComponent(this.colorScheme)}`;
@@ -1175,7 +1178,7 @@ var CheckoutInstance = class {
1175
1178
  /**
1176
1179
  * Query the payment status (returns TxnStatus as-is, no transformation).
1177
1180
  *
1178
- * @returns txnStatus (may include txnId).
1181
+ * @returns txnStatus (may be absent when the session is expired), sessionStatus and txnId.
1179
1182
  * @throws rejects INSTANCE_DESTROYED when destroyed.
1180
1183
  */
1181
1184
  async getPaymentStatus() {
@@ -1459,7 +1462,7 @@ if (typeof window !== "undefined") {
1459
1462
  const w = window;
1460
1463
  w.SunbayCheckout = { ...w.SunbayCheckout ?? {}, createCheckout };
1461
1464
  }
1462
- var version = true ? "0.0.9" : "0.0.0";
1465
+ var version = true ? "0.1.0" : "0.0.0";
1463
1466
  // Annotate the CommonJS export names for ESM import in node:
1464
1467
  0 && (module.exports = {
1465
1468
  CheckoutElement,