@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.
@@ -4999,9 +4999,14 @@ declare class AuthService extends UserService {
4999
4999
  errorCode: string;
5000
5000
  message: string;
5001
5001
  }>;
5002
- /** Texts a 4-digit sign-in code to `phone`, which needs its country code. */
5003
- getOtp({ phone }: {
5002
+ /**
5003
+ * Texts a 4-digit sign-in code to `phone`, which needs its country code. `domain`, the page's
5004
+ * host and in the browser read from it, lets the engine end the text "@domain #code" when the
5005
+ * host is the store's own, which Chrome on Android reads to fill the code in (D124).
5006
+ */
5007
+ getOtp({ phone, domain }: {
5004
5008
  phone: string;
5009
+ domain?: string;
5005
5010
  }): Promise<{
5006
5011
  expiresInMinutes: number;
5007
5012
  }>;
@@ -4999,9 +4999,14 @@ declare class AuthService extends UserService {
4999
4999
  errorCode: string;
5000
5000
  message: string;
5001
5001
  }>;
5002
- /** Texts a 4-digit sign-in code to `phone`, which needs its country code. */
5003
- getOtp({ phone }: {
5002
+ /**
5003
+ * Texts a 4-digit sign-in code to `phone`, which needs its country code. `domain`, the page's
5004
+ * host and in the browser read from it, lets the engine end the text "@domain #code" when the
5005
+ * host is the store's own, which Chrome on Android reads to fill the code in (D124).
5006
+ */
5007
+ getOtp({ phone, domain }: {
5004
5008
  phone: string;
5009
+ domain?: string;
5005
5010
  }): Promise<{
5006
5011
  expiresInMinutes: number;
5007
5012
  }>;
package/dist/index.cjs CHANGED
@@ -2266,11 +2266,16 @@ var AuthService = class extends UserService {
2266
2266
  return { errorCode: err.code ?? "invalid_token", message: err.message };
2267
2267
  }
2268
2268
  }
2269
- /** Texts a 4-digit sign-in code to `phone`, which needs its country code. */
2270
- async getOtp({ phone }) {
2269
+ /**
2270
+ * Texts a 4-digit sign-in code to `phone`, which needs its country code. `domain`, the page's
2271
+ * host and in the browser read from it, lets the engine end the text "@domain #code" when the
2272
+ * host is the store's own, which Chrome on Android reads to fill the code in (D124).
2273
+ */
2274
+ async getOtp({ phone, domain }) {
2275
+ const site = domain ?? (typeof window !== "undefined" ? window.location?.hostname : void 0);
2271
2276
  const res = await this.account("/x/identity/otp", {
2272
2277
  method: "POST",
2273
- body: { phone: String(phone ?? "").trim() }
2278
+ body: { phone: String(phone ?? "").trim(), ...site ? { domain: site } : {} }
2274
2279
  });
2275
2280
  return { expiresInMinutes: res?.expires_in_minutes ?? 10 };
2276
2281
  }