@moonbase.sh/storefront 0.3.18 → 0.3.20

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/dist/moonbase.js CHANGED
@@ -3338,13 +3338,15 @@ var Cr = v.record(v.number()), k0 = v.object({
3338
3338
  description: v.string().optional(),
3339
3339
  percentage: v.number(),
3340
3340
  total: Cr.optional(),
3341
- isExclusive: v.boolean()
3341
+ isExclusive: v.boolean(),
3342
+ recurringPaymentUseCount: v.number().optional()
3342
3343
  }), O0 = v.object({
3343
3344
  type: v.literal("FlatAmountOffDiscount"),
3344
3345
  name: v.string(),
3345
3346
  description: v.string().optional(),
3346
3347
  total: Cr.optional(),
3347
- isExclusive: v.boolean()
3348
+ isExclusive: v.boolean(),
3349
+ recurringPaymentUseCount: v.number().optional()
3348
3350
  }), rs = v.object({
3349
3351
  currency: v.string(),
3350
3352
  amount: v.number()
@@ -3535,7 +3537,7 @@ var Qd = {};
3535
3537
  lu(Qd, {
3536
3538
  addressSchema: () => du,
3537
3539
  communicationPreferencesSchema: () => ef,
3538
- identityUserSchema: () => na,
3540
+ identitySchema: () => na,
3539
3541
  userAccountConfirmedSchema: () => $l,
3540
3542
  userSchema: () => ws
3541
3543
  });
@@ -3928,7 +3930,7 @@ var Oo = /* @__PURE__ */ ((e) => (e.Open = "Open", e.PaymentProcessing = "Paymen
3928
3930
  this.baseUrl = e, this.tokenStore = t;
3929
3931
  }
3930
3932
  async authenticatedFetch(e, t, n) {
3931
- if (!this.tokenStore.hasAccessToken)
3933
+ if (!this.tokenStore.user)
3932
3934
  throw new Sa();
3933
3935
  return await this.fetch(e, t, n);
3934
3936
  }
@@ -3975,7 +3977,7 @@ var Oo = /* @__PURE__ */ ((e) => (e.Open = "Open", e.PaymentProcessing = "Paymen
3975
3977
  }
3976
3978
  async reportParsingProblem(e, t, n) {
3977
3979
  try {
3978
- await Ao(this.baseUrl + "/api/customer/insights/error", {
3980
+ await Ao(`${this.baseUrl}/api/customer/insights/error`, {
3979
3981
  mode: "cors",
3980
3982
  method: "POST",
3981
3983
  headers: {
@@ -3997,7 +3999,7 @@ var Oo = /* @__PURE__ */ ((e) => (e.Open = "Open", e.PaymentProcessing = "Paymen
3997
3999
  }
3998
4000
  async reportRequestProblem(e, t, n, r) {
3999
4001
  try {
4000
- await Ao(this.baseUrl + "/api/customer/insights/warn", {
4002
+ await Ao(`${this.baseUrl}/api/customer/insights/warn`, {
4001
4003
  mode: "cors",
4002
4004
  method: "POST",
4003
4005
  headers: {
@@ -4032,9 +4034,6 @@ var Oo = /* @__PURE__ */ ((e) => (e.Open = "Open", e.PaymentProcessing = "Paymen
4032
4034
  get user() {
4033
4035
  return this.tokens ? this.tokens : null;
4034
4036
  }
4035
- get hasAccessToken() {
4036
- return !!this.tokens;
4037
- }
4038
4037
  async getAccessToken() {
4039
4038
  var t, n, r;
4040
4039
  if (this.isExpired) {
@@ -4131,7 +4130,8 @@ lu(mu, {
4131
4130
  });
4132
4131
  var Z0 = class {
4133
4132
  constructor(e) {
4134
- this.configuration = e, this.configuration.endpoint = this.configuration.endpoint.replace(/\/$/, ""), this.tokenStore = new hf(e), this.api = new H0(this.configuration.endpoint, this.tokenStore), this.storefront = new B0(this.api, this.configuration), this.identity = new D0(this.api, this.tokenStore), this.vouchers = new W0(this.api), this.orders = new U0(this.api), this.inventory = new F0(this.api, this.configuration), this.activationRequests = new P0(this.api), this.vendor = new z0(this.api);
4133
+ var t;
4134
+ this.configuration = e, this.configuration.endpoint = this.configuration.endpoint.replace(/\/$/, ""), this.tokenStore = (t = e.tokenStore) != null ? t : new hf(e), this.api = new H0(this.configuration.endpoint, this.tokenStore), this.storefront = new B0(this.api, this.configuration), this.identity = new D0(this.api, this.tokenStore), this.vouchers = new W0(this.api), this.orders = new U0(this.api), this.inventory = new F0(this.api, this.configuration), this.activationRequests = new P0(this.api), this.vendor = new z0(this.api);
4135
4135
  }
4136
4136
  }, pf = {};
4137
4137
  /**
@@ -9812,7 +9812,7 @@ var pi = class it {
9812
9812
  suggestedCurrency: "",
9813
9813
  bundles: [],
9814
9814
  products: []
9815
- }), this.loadedStorefront = r(`${it.storefrontKey}_loaded`, !1)), this.client.tokenStore.hasAccessToken && (this.currentUser.value = mu.identity.userSchema.parse(this.client.tokenStore.user)), this.updateStorefront(), this.updateUser(), window.location) {
9815
+ }), this.loadedStorefront = r(`${it.storefrontKey}_loaded`, !1)), this.client.tokenStore.user && (this.currentUser.value = mu.identity.userSchema.parse(this.client.tokenStore.user)), this.updateStorefront(), this.updateUser(), window.location) {
9816
9816
  const l = new URLSearchParams(window.location.search), u = l.get("mb_intent"), c = l.get("mb_endpoint");
9817
9817
  if (u === "checkout" && l.get("mb_complete") && c) {
9818
9818
  const d = Object.fromEntries([...l.entries()].filter(([h]) => !h.startsWith("mb_"))), f = new URL(decodeURIComponent(c));
@@ -9822,7 +9822,7 @@ var pi = class it {
9822
9822
  }
9823
9823
  }
9824
9824
  window.addEventListener("moonbase-checkout-completed", (l) => {
9825
- l.detail.order.id === this.currentOrder.value.id && this.resetOrder();
9825
+ l.detail.order.id === this.currentOrder.value.id && this.resetOrder(), this.updateUser();
9826
9826
  });
9827
9827
  }
9828
9828
  get loadedStorefrontPromise() {
@@ -17063,7 +17063,7 @@ function J2(e, t) {
17063
17063
  const Re = /* @__PURE__ */ ir(K2, [["render", J2]]), Q2 = { class: "moonbase:about" }, eE = /* @__PURE__ */ pe({
17064
17064
  __name: "About",
17065
17065
  setup(e) {
17066
- const t = Te(), n = "0.3.18";
17066
+ const t = Te(), n = "0.3.20";
17067
17067
  return (r, o) => (g(), C("div", Q2, [
17068
17068
  o[2] || (o[2] = Rh('<svg viewBox="0 0 512 512" height="56px" width="56px"><g><path fill="currentColor" d="m493.17795,174.6135c6.257,75.3 -30.577,150.948 -100.579,190.758c-66.292,37.697 -145.001,33.405 -205.402,-4.415c0.409,-1.248 0.638,-2.577 0.638,-3.96c0,-7.026 -5.717,-12.743 -12.743,-12.743c-2.876,0 -5.524,0.969 -7.659,2.582c-18.813,-15.259 -35.159,-34.207 -47.856,-56.534c-54.663,-96.122 -21.054,-218.358 75.069,-273.021a201.218,201.218 0 0 1 33.302,-15.124c-32.428,3.667 -64.663,13.809 -94.827,30.962c-104.526,59.443 -149.511,183.241 -113.473,293.249c-3.376,3.057 -5.513,7.459 -5.513,12.362c0,9.207 7.491,16.698 16.698,16.698c0.136,0 0.267,-0.017 0.401,-0.02a252.205,252.205 0 0 0 8.683,16.691c67.869,119.344 219.635,161.073 338.98,93.204a250.416,250.416 0 0 0 32.893,-22.333c1.045,0.331 2.157,0.513 3.311,0.513c6.047,0 10.968,-4.921 10.968,-10.968c0,-0.605 -0.063,-1.196 -0.157,-1.775c69.545,-64.988 96.008,-165.054 67.266,-256.126m-446.526,25.112a5.071,5.071 0 0 1 -5.066,-5.066a5.072,5.072 0 0 1 5.066,-5.067a5.073,5.073 0 0 1 5.066,5.067a5.072,5.072 0 0 1 -5.066,5.066m-15.819,153.944c-8.238,0 -14.94,-6.702 -14.94,-14.94c0,-8.239 6.702,-14.941 14.94,-14.941c8.239,0 14.941,6.702 14.941,14.941c-0.001,8.238 -6.703,14.94 -14.941,14.94m144.258,-7.659c6.057,0 10.985,4.928 10.985,10.986c0,6.058 -4.928,10.985 -10.985,10.985c-6.058,0 -10.986,-4.928 -10.986,-10.985c0.001,-6.059 4.928,-10.986 10.986,-10.986m70.829,133.004c-5.079,0 -9.21,-4.132 -9.21,-9.21c0,-5.079 4.131,-9.21 9.21,-9.21c5.078,0 9.209,4.131 9.209,9.21c0,5.078 -4.13,9.21 -9.209,9.21m169.18,-37.289c-5.078,0 -9.209,-4.132 -9.209,-9.21s4.131,-9.209 9.209,-9.209s9.21,4.131 9.21,9.209s-4.132,9.21 -9.21,9.21"></path><path fill="currentColor" d="m144.78195,275.9675c46.746,82.201 151.278,110.943 233.48,64.197c59.864,-34.044 91.363,-98.736 86.013,-163.13a170.094,170.094 0 0 0 -5.515,-31.052c-23.045,0.567 -63.864,10.137 -104.194,61.671c-52.045,66.5 -186.285,49.153 -228.855,17.372c3.503,17.443 9.796,34.632 19.071,50.942m233.513,-65.677a8.663,8.663 0 1 1 -8.663,8.663a8.662,8.662 0 0 1 8.663,-8.663m-37.006,62.618c7.02,0 12.712,5.691 12.712,12.712s-5.692,12.712 -12.712,12.712c-7.021,0 -12.712,-5.691 -12.712,-12.712s5.691,-12.712 12.712,-12.712m-102.544,12.712a6.78,6.78 0 1 1 0,13.56a6.78,6.78 0 0 1 0,-13.56"></path><ellipse fill="currentColor" ry="7.3075" rx="7.3075" cy="152.05851" cx="251.33138"></ellipse><ellipse fill="currentColor" ry="5.35076" rx="5.35076" cy="210.31151" cx="204.89499"></ellipse><ellipse fill="currentColor" ry="12.09273" rx="12.09273" cy="200.15625" cx="302.28597"></ellipse></g></svg>', 1)),
17069
17069
  w(b(bp), { as: "h3" }, {