@misiki/gocommerce-connector 0.4.8 → 0.4.9

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.
@@ -2247,11 +2247,16 @@ var AuthService = class extends UserService {
2247
2247
  return { errorCode: err.code ?? "invalid_token", message: err.message };
2248
2248
  }
2249
2249
  }
2250
- /** Texts a 4-digit sign-in code to `phone`, which needs its country code. */
2251
- async getOtp({ phone }) {
2250
+ /**
2251
+ * Texts a 4-digit sign-in code to `phone`, which needs its country code. `domain`, the page's
2252
+ * host and in the browser read from it, lets the engine end the text "@domain #code" when the
2253
+ * host is the store's own, which Chrome on Android reads to fill the code in (D124).
2254
+ */
2255
+ async getOtp({ phone, domain }) {
2256
+ const site = domain ?? (typeof window !== "undefined" ? window.location?.hostname : void 0);
2252
2257
  const res = await this.account("/x/identity/otp", {
2253
2258
  method: "POST",
2254
- body: { phone: String(phone ?? "").trim() }
2259
+ body: { phone: String(phone ?? "").trim(), ...site ? { domain: site } : {} }
2255
2260
  });
2256
2261
  return { expiresInMinutes: res?.expires_in_minutes ?? 10 };
2257
2262
  }