@misiki/gocommerce-connector 0.27.0 → 0.28.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.
@@ -1536,7 +1536,9 @@ declare class BaseService {
1536
1536
  * Prices a cart at the signed-in shopper's customer-group prices. The
1537
1537
  * engine does this only for an account whose email is confirmed (403
1538
1538
  * otherwise), and the cart stays the shopper's either way — so a refusal
1539
- * is not an error, and neither is a build without ext/identity.
1539
+ * is not an error, and neither is a build without ext/identity. A refused
1540
+ * claim still gives the cart the account's email, which the claim would
1541
+ * have set, or the checkout asks the shopper for it again.
1540
1542
  */
1541
1543
  protected claimCartForAccount(cartId: string): Promise<void>;
1542
1544
  /**
@@ -1536,7 +1536,9 @@ declare class BaseService {
1536
1536
  * Prices a cart at the signed-in shopper's customer-group prices. The
1537
1537
  * engine does this only for an account whose email is confirmed (403
1538
1538
  * otherwise), and the cart stays the shopper's either way — so a refusal
1539
- * is not an error, and neither is a build without ext/identity.
1539
+ * is not an error, and neither is a build without ext/identity. A refused
1540
+ * claim still gives the cart the account's email, which the claim would
1541
+ * have set, or the checkout asks the shopper for it again.
1540
1542
  */
1541
1543
  protected claimCartForAccount(cartId: string): Promise<void>;
1542
1544
  /**
package/dist/index.cjs CHANGED
@@ -440,12 +440,19 @@ var BaseService = class _BaseService {
440
440
  * Prices a cart at the signed-in shopper's customer-group prices. The
441
441
  * engine does this only for an account whose email is confirmed (403
442
442
  * otherwise), and the cart stays the shopper's either way — so a refusal
443
- * is not an error, and neither is a build without ext/identity.
443
+ * is not an error, and neither is a build without ext/identity. A refused
444
+ * claim still gives the cart the account's email, which the claim would
445
+ * have set, or the checkout asks the shopper for it again.
444
446
  */
445
447
  async claimCartForAccount(cartId) {
446
448
  try {
447
449
  await this.engine("/x/identity/me/carts", { method: "POST", body: { cart_id: cartId }, auth: true });
448
450
  } catch {
451
+ const email = currentMe()?.email;
452
+ if (email)
453
+ await this.engine(`/api/carts/${encodeURIComponent(cartId)}/email`, { method: "PUT", body: { email } }).catch(
454
+ () => void 0
455
+ );
449
456
  }
450
457
  }
451
458
  // ------------------------------------------------------------ Litekart verbs