@misiki/gocommerce-connector 0.4.0 → 0.4.1

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.
@@ -992,6 +992,10 @@ var StoreFacts = class extends BaseService {
992
992
  ready() {
993
993
  return remember(this.key("ready"), () => this.data("/health/ready"));
994
994
  }
995
+ /** The store's own name and how a buyer reaches it, as set in its panel. */
996
+ profile() {
997
+ return remember(this.key("profile"), () => this.data("/api/store"));
998
+ }
995
999
  checkoutOptions() {
996
1000
  return remember(this.key("checkout"), () => this.data("/api/checkout"));
997
1001
  }
@@ -2497,17 +2501,22 @@ var StoreService = class extends BaseService {
2497
2501
  return super.post(path, data);
2498
2502
  }
2499
2503
  async live() {
2500
- const [ready, plugins, menus, base] = await Promise.all([
2504
+ const [ready, plugins, menus, base, profile] = await Promise.all([
2501
2505
  this.facts.ready(),
2502
2506
  this.facts.plugins().catch(() => /* @__PURE__ */ new Map()),
2503
2507
  new MenuService(this._fetch).engineMenus(),
2504
- readStaticStore()
2508
+ readStaticStore(),
2509
+ this.facts.profile().catch(() => null)
2505
2510
  ]);
2506
2511
  const code = ready.currency;
2507
2512
  const sameCurrency = (base.currency?.code ?? base.currencyCode) === code;
2508
2513
  const flag = (on) => ({ ...on ? { active: true } : { active: false } });
2509
2514
  const basePlugins = base.plugins ?? {};
2510
2515
  return {
2516
+ // Only what the owner filled in: an empty name keeps the static one.
2517
+ ...profile?.name ? { name: profile.name } : {},
2518
+ ...profile?.email ? { businessEmail: profile.email } : {},
2519
+ ...profile?.phone ? { businessPhone: profile.phone } : {},
2511
2520
  currencyCode: code,
2512
2521
  currencySymbol: sameCurrency ? base.currencySymbol ?? symbolFor(code) : symbolFor(code),
2513
2522
  currency: {