@easy-cms/plugin-ecommerce 0.47.4 → 0.49.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.
package/dist/admin.js CHANGED
@@ -38,12 +38,12 @@ var x={en:{amount:"Amount",status:"Status",paid:"Payment received",fulfilled:"Ma
38
38
  p { margin: 0 0 0.6rem; font-size: 0.85rem; }
39
39
  .warn { color: var(--warning, #9a6700); }
40
40
  .error { color: var(--danger, #c0392b); }
41
- `,L={pending:[{action:"paid",style:"primary"},{action:"cancelled",style:"danger"}],paid:[{action:"fulfilled",style:"primary"},{action:"refunded",style:"danger"}],fulfilled:[{action:"refunded",style:"danger"}]},T={paid:"confirmPaid",fulfilled:"confirmFulfilled",cancelled:"confirmCancelled",refunded:"confirmRefunded"},b=class o extends c{#t=!1;#e="";static{u(o,p)}async#n(t){let e=this.props.api,n=this.props.id;if(!(!e||n===void 0||n===null)&&window.confirm(this.t(T[t]))){this.#t=!0,this.#e="",this.update();try{await e("POST",`/shop/orders/${encodeURIComponent(String(n))}/${t}`,{}),window.location.reload()}catch(r){this.#t=!1,this.#e=this.t("failed",{message:r.message}),this.update()}}}update(){let t=this.shadowRoot;if(!t)return;let e=this.props.doc??{},n=this.props.id,r;if(n==null)r=`<p class="muted">${i(this.t("unsaved"))}</p>`;else{let s=String(e.status??""),a=(L[s]??[]).map(({action:d,style:l})=>`<button type="button" data-action="${d}" class="${l??""}" ${this.#t?"disabled":""}>${i(this.t(d))}</button>`).join("");r=`
41
+ `,L={pending:[{action:"paid",style:"primary"},{action:"cancelled",style:"danger"}],paid:[{action:"fulfilled",style:"primary"},{action:"refunded",style:"danger"}],fulfilled:[{action:"refunded",style:"danger"}]},T={paid:"confirmPaid",fulfilled:"confirmFulfilled",cancelled:"confirmCancelled",refunded:"confirmRefunded"},y=class o extends c{#t=!1;#e="";static{u(o,p)}async#n(t){let e=this.props.api,n=this.props.id;if(!(!e||n===void 0||n===null)&&window.confirm(this.t(T[t]))){this.#t=!0,this.#e="",this.update();try{await e("POST",`/shop/orders/${encodeURIComponent(String(n))}/${t}`,{}),window.location.reload()}catch(r){this.#t=!1,this.#e=this.t("failed",{message:r.message}),this.update()}}}update(){let t=this.shadowRoot;if(!t)return;let e=this.props.doc??{},n=this.props.id,r;if(n==null)r=`<p class="muted">${i(this.t("unsaved"))}</p>`;else{let s=String(e.status??""),a=(L[s]??[]).map(({action:d,style:l})=>`<button type="button" data-action="${d}" class="${l??""}" ${this.#t?"disabled":""}>${i(this.t(d))}</button>`).join("");r=`
42
42
  <span class="badge ${i(s)}">${i(this.status(s))}</span>
43
43
  ${e.stockShort===!0?`<p class="warn">${i(this.t("short"))}</p>`:""}
44
44
  ${typeof e.total=="number"&&typeof e.currency=="string"?`<p>${i(this.money(e.total,e.currency))}</p>`:""}
45
45
  ${a?`<div class="actions">${a}</div>`:""}
46
- ${this.#e?`<p class="error" role="alert">${i(this.#e)}</p>`:""}`}t.innerHTML=`<style>${R}</style><section aria-label="${i(this.t("status"))}"><h3>${i(this.t("status"))}</h3>${r}</section>`;for(let s of t.querySelectorAll("button[data-action]"))s.addEventListener("click",()=>{this.#n(s.dataset.action)})}},F=`
46
+ ${this.#e?`<p class="error" role="alert">${i(this.#e)}</p>`:""}`}t.innerHTML=`<style>${R}</style><section aria-label="${i(this.t("status"))}"><h3>${i(this.t("status"))}</h3>${r}</section>`;for(let s of t.querySelectorAll("button[data-action]"))s.addEventListener("click",()=>{this.#n(s.dataset.action)})}},A=`
47
47
  ${v}
48
48
  h2 { margin: 0 0 0.75rem; font-size: 1rem; font-weight: 600; }
49
49
  .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; }
@@ -54,9 +54,9 @@ var x={en:{amount:"Amount",status:"Status",paid:"Payment received",fulfilled:"Ma
54
54
  a { color: inherit; text-decoration: none; }
55
55
  a.stat:hover { border-color: var(--border-strong); background: var(--surface-2); }
56
56
  p { margin: 0; font-size: 0.875rem; }
57
- `,y=class o extends c{#t=null;#e=!1;#n=!1;static{u(o,p)}async#r(){let t=this.props.api;if(!(!t||this.#n)){this.#n=!0;try{this.#t=await t("GET","/shop/overview")}catch{this.#e=!0}this.update()}}#s(t,e){let n=Object.entries(t);if(n.length===0)return{total:"\u2014",orders:this.t("orders",{n:0})};let r=s=>e.currencies.find(a=>a.code===s)?.decimals??2;return{total:n.map(([s,a])=>this.money(a.total,s,r(s))).join(" \xB7 "),orders:this.t("orders",{n:n.reduce((s,[,a])=>s+a.orders,0)})}}update(){let t=this.shadowRoot;if(!t)return;this.#r();let n=(this.props.options??{}).adminPath??"/admin",r=this.#t,s;if(this.#e)s=`<p class="muted">${i(this.t("loadFailed"))}</p>`;else if(!r)s=`<p class="muted">${i(this.t("loading"))}</p>`;else{let a=this.#s(r.today,r),d=this.#s(r.month,r),l=(w,k,E)=>`<a class="stat" href="${i(n+w)}" data-to="${i(w)}"><span>${i(k)}</span><strong>${E}</strong></a>`;s=`<div class="grid">
57
+ `,b=class o extends c{#t=null;#e=!1;#n=!1;static{u(o,p)}async#r(){let t=this.props.api;if(!(!t||this.#n)){this.#n=!0;try{this.#t=await t("GET","/shop/overview")}catch{this.#e=!0}this.update()}}#s(t,e){let n=Object.entries(t);if(n.length===0)return{total:"\u2014",orders:this.t("orders",{n:0})};let r=s=>e.currencies.find(a=>a.code===s)?.decimals??2;return{total:n.map(([s,a])=>this.money(a.total,s,r(s))).join(" \xB7 "),orders:this.t("orders",{n:n.reduce((s,[,a])=>s+a.orders,0)})}}update(){let t=this.shadowRoot;if(!t)return;this.#r();let n=(this.props.options??{}).adminPath??"/admin",r=this.#t,s;if(this.#e)s=`<p class="muted">${i(this.t("loadFailed"))}</p>`;else if(!r)s=`<p class="muted">${i(this.t("loading"))}</p>`;else{let a=this.#s(r.today,r),d=this.#s(r.month,r),l=(w,E,k)=>`<a class="stat" href="${i(n+w)}" data-to="${i(w)}"><span>${i(E)}</span><strong>${k}</strong></a>`;s=`<div class="grid">
58
58
  <div class="stat"><span>${i(this.t("today"))}</span><strong>${i(a.total)}</strong><small>${i(a.orders)}</small></div>
59
59
  <div class="stat"><span>${i(this.t("month"))}</span><strong>${i(d.total)}</strong><small>${i(d.orders)}</small></div>
60
60
  ${l("/collections/orders?f_status=pending",this.t("pending"),r.pending)}
61
61
  ${l("/collections/orders?f_status=paid",this.t("toFulfil"),r.toFulfil)}
62
- </div>`}t.innerHTML=`<style>${F}</style><section aria-labelledby="title"><h2 id="title">${i(this.t("widget"))}</h2>${s}</section>`;for(let a of t.querySelectorAll("a[data-to]"))a.addEventListener("click",d=>{d.metaKey||d.ctrlKey||d.shiftKey||d.altKey||d.button!==0||(d.preventDefault(),this.dispatchEvent(new CustomEvent("navigate",{detail:a.dataset.to??"/"})))})}},m=(o,t)=>{customElements.get(o)||customElements.define(o,t)};m("ecms-price-field",f);m("ecms-price-cell",g);m("ecms-order-actions",b);m("ecms-shop-overview",y);export{$ as parseMoney,h as showMoney};
62
+ </div>`}t.innerHTML=`<style>${A}</style><section aria-labelledby="title"><h2 id="title">${i(this.t("widget"))}</h2>${s}</section>`;for(let a of t.querySelectorAll("a[data-to]"))a.addEventListener("click",d=>{d.metaKey||d.ctrlKey||d.shiftKey||d.altKey||d.button!==0||(d.preventDefault(),this.dispatchEvent(new CustomEvent("navigate",{detail:a.dataset.to??"/"})))})}},m=(o,t)=>{customElements.get(o)||customElements.define(o,t)};m("ecms-price-field",f);m("ecms-price-cell",g);m("ecms-order-actions",y);m("ecms-shop-overview",b);export{$ as parseMoney,h as showMoney};
@@ -32,7 +32,7 @@ var TRANSACTION_STATUSES = [
32
32
  // src/collections.ts
33
33
  import {
34
34
  anyone,
35
- isLoggedIn,
35
+ isStaff,
36
36
  ValidationError
37
37
  } from "@easy-cms/core";
38
38
  var PRODUCTS = "products";
@@ -67,7 +67,7 @@ var price = {
67
67
  },
68
68
  typescript: "number"
69
69
  };
70
- var staff = isLoggedIn;
70
+ var staff = isStaff;
71
71
  var staffOrOwner = ({ user }) => {
72
72
  if (!user) return false;
73
73
  if (user.member !== true) return true;
@@ -142,10 +142,10 @@ function shopCollections(o) {
142
142
  singular: { en: "Product", th: "\u0E2A\u0E34\u0E19\u0E04\u0E49\u0E32" },
143
143
  plural: { en: "Products", th: "\u0E2A\u0E34\u0E19\u0E04\u0E49\u0E32" }
144
144
  },
145
- icon: "shopping-bag",
146
145
  useAsTitle: "title",
147
146
  drafts: true,
148
147
  admin: {
148
+ icon: "shopping-bag",
149
149
  group: "shop.catalog",
150
150
  layout: productLayout(o),
151
151
  empty: {
@@ -195,10 +195,8 @@ function shopCollections(o) {
195
195
  singular: { en: "Option type", th: "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01" },
196
196
  plural: { en: "Option types", th: "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01" }
197
197
  },
198
- icon: "sliders-horizontal",
199
198
  useAsTitle: "name",
200
- editIn: "drawer",
201
- admin: { group: "shop.catalog" },
199
+ admin: { editIn: "drawer", icon: "sliders-horizontal", group: "shop.catalog" },
202
200
  access: { read: anyone, create: staff, update: staff, delete: staff },
203
201
  fields: [
204
202
  {
@@ -215,10 +213,8 @@ function shopCollections(o) {
215
213
  singular: { en: "Option", th: "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01" },
216
214
  plural: { en: "Options", th: "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01" }
217
215
  },
218
- icon: "tags",
219
216
  useAsTitle: "label",
220
- editIn: "drawer",
221
- admin: { group: "shop.catalog" },
217
+ admin: { editIn: "drawer", icon: "tags", group: "shop.catalog" },
222
218
  access: { read: anyone, create: staff, update: staff, delete: staff },
223
219
  fields: [
224
220
  {
@@ -244,9 +240,8 @@ function shopCollections(o) {
244
240
  singular: { en: "Variant", th: "\u0E2A\u0E34\u0E19\u0E04\u0E49\u0E32\u0E22\u0E48\u0E2D\u0E22" },
245
241
  plural: { en: "Variants", th: "\u0E2A\u0E34\u0E19\u0E04\u0E49\u0E32\u0E22\u0E48\u0E2D\u0E22" }
246
242
  },
247
- icon: "layers",
248
243
  useAsTitle: "title",
249
- admin: { group: "shop.catalog" },
244
+ admin: { icon: "layers", group: "shop.catalog" },
250
245
  access: { read: anyone, create: staff, update: staff, delete: staff },
251
246
  fields: [
252
247
  {
@@ -293,8 +288,7 @@ function shopCollections(o) {
293
288
  singular: { en: "Cart", th: "\u0E15\u0E30\u0E01\u0E23\u0E49\u0E32" },
294
289
  plural: { en: "Carts", th: "\u0E15\u0E30\u0E01\u0E23\u0E49\u0E32" }
295
290
  },
296
- icon: "shopping-cart",
297
- admin: { group: "shop.sales", list: { sort: "-updatedAt" } },
291
+ admin: { icon: "shopping-cart", group: "shop.sales", list: { sort: "-updatedAt" } },
298
292
  // Changed through the shop's endpoints only.
299
293
  access: { read: staffOrOwner, create: nobody, update: nobody, delete: staff },
300
294
  fields: [
@@ -360,9 +354,8 @@ function shopCollections(o) {
360
354
  singular: { en: "Address", th: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48" },
361
355
  plural: { en: "Addresses", th: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48" }
362
356
  },
363
- icon: "map-pin",
364
357
  useAsTitle: "name",
365
- admin: { group: "shop.customers" },
358
+ admin: { icon: "map-pin", group: "shop.customers" },
366
359
  access: {
367
360
  read: staffOrOwner,
368
361
  create: ({ user }) => user !== null,
@@ -400,9 +393,9 @@ function shopCollections(o) {
400
393
  singular: { en: "Order", th: "\u0E04\u0E33\u0E2A\u0E31\u0E48\u0E07\u0E0B\u0E37\u0E49\u0E2D" },
401
394
  plural: { en: "Orders", th: "\u0E04\u0E33\u0E2A\u0E31\u0E48\u0E07\u0E0B\u0E37\u0E49\u0E2D" }
402
395
  },
403
- icon: "package",
404
396
  useAsTitle: "orderNumber",
405
397
  admin: {
398
+ icon: "package",
406
399
  group: "shop.sales",
407
400
  list: { sort: "-createdAt" },
408
401
  // What to do next, at the top of the side column.
@@ -437,8 +430,7 @@ function shopCollections(o) {
437
430
  defaultValue: "pending",
438
431
  index: true,
439
432
  access: bySystem,
440
- position: "sidebar",
441
- admin: { column: true },
433
+ admin: { position: "sidebar", column: true },
442
434
  label: { en: "Status", th: "\u0E2A\u0E16\u0E32\u0E19\u0E30" }
443
435
  },
444
436
  {
@@ -576,8 +568,7 @@ function shopCollections(o) {
576
568
  singular: { en: "Payment", th: "\u0E01\u0E32\u0E23\u0E0A\u0E33\u0E23\u0E30\u0E40\u0E07\u0E34\u0E19" },
577
569
  plural: { en: "Payments", th: "\u0E01\u0E32\u0E23\u0E0A\u0E33\u0E23\u0E30\u0E40\u0E07\u0E34\u0E19" }
578
570
  },
579
- icon: "ticket",
580
- admin: { group: "shop.sales", list: { sort: "-createdAt" } },
571
+ admin: { icon: "ticket", group: "shop.sales", list: { sort: "-createdAt" } },
581
572
  access: { read: staff, create: nobody, update: nobody, delete: nobody },
582
573
  fields: [
583
574
  {
@@ -652,7 +643,7 @@ var idOf = (value) => {
652
643
  if (typeof value === "object") return value.id ?? null;
653
644
  return value;
654
645
  };
655
- var checkVariant = async ({ data, cms, originalDoc }) => {
646
+ var checkVariant = async ({ data, cms, previousDoc }) => {
656
647
  const fail = (field, message) => new ValidationError(VARIANTS, [{ field, message }]);
657
648
  const productId = idOf(data.product);
658
649
  if (productId === null) return data;
@@ -680,7 +671,7 @@ var checkVariant = async ({ data, cms, originalDoc }) => {
680
671
  depth: 0
681
672
  });
682
673
  for (const other of siblings.docs) {
683
- if (originalDoc && String(other.id) === String(originalDoc.id)) continue;
674
+ if (previousDoc && String(other.id) === String(previousDoc.id)) continue;
684
675
  const theirs = (Array.isArray(other.options) ? other.options : []).map((v) => String(idOf(v)));
685
676
  if (theirs.sort().join(",") === key)
686
677
  throw fail("options", "the product has a variant with these options");
@@ -703,8 +694,10 @@ import { AsyncLocalStorage } from "async_hooks";
703
694
  import {
704
695
  definePlugin,
705
696
  ForbiddenError as ForbiddenError2,
697
+ NotFoundError as NotFoundError2,
706
698
  UnauthorizedError
707
699
  } from "@easy-cms/core";
700
+ import { checkRenamedOptions } from "@easy-cms/core/internal";
708
701
 
709
702
  // src/emails.ts
710
703
  var esc = (value) => value.replace(
@@ -781,7 +774,9 @@ var newOrder = ({ order, locale, currency }) => {
781
774
  // src/info.ts
782
775
  var INFO = {
783
776
  name: "@easy-cms/plugin-ecommerce",
784
- ...true ? { version: "0.47.4" } : {}
777
+ // The plugin API it is written for (`PLUGIN_API_VERSION` of @easy-cms/core).
778
+ apiVersion: 1,
779
+ ...true ? { version: "0.49.0" } : {}
785
780
  };
786
781
 
787
782
  // src/shop.ts
@@ -1553,6 +1548,7 @@ function cartRef(body) {
1553
1548
  return { id, secret: cart.secret };
1554
1549
  }
1555
1550
  function ecommercePlugin(options) {
1551
+ checkRenamedOptions("ecommercePlugin.customers", options.customers, { signup: "signUp" });
1556
1552
  const currencies = (options.currencies?.supported ?? ["THB"]).map((c) => {
1557
1553
  if (typeof c !== "string") return c;
1558
1554
  const known = CURRENCIES[c.toUpperCase()];
@@ -1765,7 +1761,8 @@ function ecommercePlugin(options) {
1765
1761
  handler: async (req) => {
1766
1762
  staffOnly(req);
1767
1763
  const action = req.params.action;
1768
- if (!ORDER_ACTIONS.has(action)) throw new ForbiddenError2();
1764
+ if (!ORDER_ACTIONS.has(action))
1765
+ throw new NotFoundError2("orders", `${req.params.id}/${action}`);
1769
1766
  const order = await runtime(req.cms).orders.act(req.params.id, action, who(req));
1770
1767
  return { order };
1771
1768
  }
@@ -1827,9 +1824,9 @@ function ecommercePlugin(options) {
1827
1824
  const auth = config.auth ?? {};
1828
1825
  const roles = auth.roles ?? ["admin", "editor"];
1829
1826
  const members = auth.members;
1830
- const signup = options.customers?.signup ?? true;
1827
+ const signUp = options.customers?.signUp ?? true;
1831
1828
  const pages = members?.pages ?? options.customers?.pages;
1832
- const memberSignup = members?.signup ?? (signup === false ? void 0 : { role, ...signup === true ? {} : signup });
1829
+ const memberSignup = members?.signUp ?? (signUp === false ? void 0 : { role, ...signUp === true ? {} : signUp });
1833
1830
  return {
1834
1831
  ...config,
1835
1832
  collections: [...config.collections ?? [], ...collections],
@@ -1871,7 +1868,7 @@ function ecommercePlugin(options) {
1871
1868
  members: {
1872
1869
  ...members,
1873
1870
  roles: [.../* @__PURE__ */ new Set([...members?.roles ?? [], role])],
1874
- ...memberSignup ? { signup: memberSignup } : {},
1871
+ ...memberSignup ? { signUp: memberSignup } : {},
1875
1872
  ...pages ? { pages } : {}
1876
1873
  }
1877
1874
  },
@@ -1896,13 +1893,13 @@ function ecommercePlugin(options) {
1896
1893
  ...config.admin?.commands ?? [],
1897
1894
  {
1898
1895
  label: { en: "Orders to send", th: "\u0E04\u0E33\u0E2A\u0E31\u0E48\u0E07\u0E0B\u0E37\u0E49\u0E2D\u0E17\u0E35\u0E48\u0E23\u0E2D\u0E08\u0E31\u0E14\u0E2A\u0E48\u0E07" },
1899
- to: "/collections/orders?f_status=paid",
1896
+ href: "/collections/orders?f_status=paid",
1900
1897
  icon: "package",
1901
1898
  keywords: ["ship", "\u0E2A\u0E48\u0E07\u0E02\u0E2D\u0E07"]
1902
1899
  },
1903
1900
  {
1904
1901
  label: { en: "Orders awaiting payment", th: "\u0E04\u0E33\u0E2A\u0E31\u0E48\u0E07\u0E0B\u0E37\u0E49\u0E2D\u0E17\u0E35\u0E48\u0E23\u0E2D\u0E0A\u0E33\u0E23\u0E30\u0E40\u0E07\u0E34\u0E19" },
1905
- to: "/collections/orders?f_status=pending",
1902
+ href: "/collections/orders?f_status=pending",
1906
1903
  icon: "package"
1907
1904
  }
1908
1905
  ],
@@ -111,7 +111,7 @@ function createShopClient(options = {}) {
111
111
  }
112
112
  }
113
113
  async function me() {
114
- const result = await call("GET", "/users/me");
114
+ const result = await call("GET", "/auth/me");
115
115
  csrf = result.csrfToken;
116
116
  return result.user;
117
117
  }
@@ -189,7 +189,7 @@ function createShopClient(options = {}) {
189
189
  },
190
190
  async login(email, password) {
191
191
  return busy(async () => {
192
- const result = await call("POST", "/users/login", {
192
+ const result = await call("POST", "/auth/login", {
193
193
  email,
194
194
  password
195
195
  });
@@ -198,21 +198,21 @@ function createShopClient(options = {}) {
198
198
  });
199
199
  },
200
200
  async logout() {
201
- await call("POST", "/users/logout").catch(() => {
201
+ await call("POST", "/auth/logout").catch(() => {
202
202
  });
203
203
  csrf = void 0;
204
204
  set({ user: null, cart: null });
205
205
  },
206
- async signup(data) {
206
+ async signUp(data) {
207
207
  return busy(async () => {
208
208
  if (!signupToken || Date.now() - signupToken.at > 12 * 36e5) {
209
- const form = await call("GET", "/users/signup");
209
+ const form = await call("GET", "/auth/signup");
210
210
  signupToken = { token: form.token, at: Date.now() };
211
211
  await new Promise((resolve) => setTimeout(resolve, 2100));
212
212
  }
213
213
  const result = await call(
214
214
  "POST",
215
- "/users/signup",
215
+ "/auth/signup",
216
216
  { ...data, token: signupToken.token, locale }
217
217
  );
218
218
  if (result.verify) return { verify: true };
@@ -224,19 +224,19 @@ function createShopClient(options = {}) {
224
224
  async verifyEmail(token) {
225
225
  const result = await call(
226
226
  "POST",
227
- "/users/verify-email",
227
+ "/auth/verify-email",
228
228
  { token }
229
229
  );
230
230
  csrf = result.csrfToken;
231
231
  return signedIn(result.user);
232
232
  },
233
233
  async forgotPassword(email) {
234
- await call("POST", "/users/forgot-password", { email, locale });
234
+ await call("POST", "/auth/forgot-password", { email, locale });
235
235
  },
236
236
  async resetPassword(token, password) {
237
237
  const result = await call(
238
238
  "POST",
239
- "/users/reset-password",
239
+ "/auth/reset-password",
240
240
  { token, password, locale }
241
241
  );
242
242
  csrf = result.csrfToken;
package/dist/client.d.ts CHANGED
@@ -197,7 +197,7 @@ interface ShopClient {
197
197
  * Creates an account. With email confirmation (the default) resolves `{ verify: true }`: a link
198
198
  * is on its way; otherwise signs in.
199
199
  */
200
- signup(data: {
200
+ signUp(data: {
201
201
  email: string;
202
202
  password: string;
203
203
  name?: string;
package/dist/client.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  createShopClient,
7
7
  formatPrice,
8
8
  priceField
9
- } from "./chunk-KON3VWC6.js";
9
+ } from "./chunk-U57EXASA.js";
10
10
  export {
11
11
  CURRENCIES,
12
12
  ORDER_STATUSES,
package/dist/index.d.ts CHANGED
@@ -77,7 +77,7 @@ interface OrderEmail {
77
77
  }
78
78
  type OrderEmailFn = (args: OrderEmailArgs) => OrderEmail | Promise<OrderEmail>;
79
79
 
80
- interface EcommerceOptions<Cur extends string = string> {
80
+ interface EcommercePluginOptions<Cur extends string = string> {
81
81
  /** How customers pay: `stripeAdapter()` from `@easy-cms/plugin-ecommerce/stripe`, `manualAdapter()`. */
82
82
  readonly payments: {
83
83
  readonly methods: readonly PaymentAdapter[];
@@ -119,10 +119,10 @@ interface EcommerceOptions<Cur extends string = string> {
119
119
  /** Default `customer`. */
120
120
  readonly role?: string;
121
121
  /**
122
- * Visitors create an account themselves (`POST <api>/users/signup`), confirming their email.
122
+ * Visitors create an account themselves (`POST <api>/auth/signup`), confirming their email.
123
123
  * `false` to make accounts some other way. Default `true`.
124
124
  */
125
- readonly signup?: boolean | Omit<MembersSignup, 'role'>;
125
+ readonly signUp?: boolean | Omit<MembersSignup, 'role'>;
126
126
  /** The site's pages for email links (`auth.members.pages`). */
127
127
  readonly pages?: MembersConfig['pages'];
128
128
  };
@@ -157,7 +157,7 @@ type Price<C extends string> = {
157
157
  };
158
158
  /** What `ecommercePlugin(options)` adds, for the types the Local API infers from the config. */
159
159
  type EcommercePluginTypes<Cur extends string> = {
160
- /** Accounts made by signing up confirm their email (`auth.members.signup`). */
160
+ /** Accounts made by signing up confirm their email (`auth.members.signUp`). */
161
161
  readonly fields: {
162
162
  readonly users: readonly [{
163
163
  readonly name: 'emailVerified';
@@ -525,6 +525,6 @@ declare function paymentFailed(reference: string, error: string): Promise<void>;
525
525
  * with Stripe or a bank transfer, orders made exactly once, stock, customer accounts, emails and
526
526
  * events. Pages use the `/client`, `/react` or `/vue` kit.
527
527
  */
528
- declare function ecommercePlugin<const Cur extends string = 'THB'>(options: EcommerceOptions<Cur>): TypedPlugin<EcommercePluginTypes<Cur>>;
528
+ declare function ecommercePlugin<const Cur extends string = 'THB'>(options: EcommercePluginOptions<Cur>): TypedPlugin<EcommercePluginTypes<Cur>>;
529
529
 
530
- export { Address, Adjustment, type CartRef, CartView, Currency, type EcommerceOptions, type EcommercePluginTypes, ORDER_EVENTS, ORDER_STATUSES, type OrderDoc, type OrderEmail, type OrderEmailArgs, type OrderEmailFn, type OrderEvent, OrderStatus, PaymentAdapter, SHOP_COLLECTIONS, STATUS_LABELS, type ShopCollection, type TotalsArgs, type TotalsFn, addressFields, ecommercePlugin, paymentFailed, paymentSucceeded, price };
530
+ export { Address, Adjustment, type CartRef, CartView, Currency, type EcommercePluginOptions, type EcommercePluginTypes, ORDER_EVENTS, ORDER_STATUSES, type OrderDoc, type OrderEmail, type OrderEmailArgs, type OrderEmailFn, type OrderEvent, OrderStatus, PaymentAdapter, SHOP_COLLECTIONS, STATUS_LABELS, type ShopCollection, type TotalsArgs, type TotalsFn, addressFields, ecommercePlugin, paymentFailed, paymentSucceeded, price };
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  paymentSucceeded,
13
13
  price,
14
14
  priceField
15
- } from "./chunk-6TTXJZ3P.js";
15
+ } from "./chunk-7HMAFDY3.js";
16
16
 
17
17
  // src/payments.ts
18
18
  var definePaymentAdapter = (adapter) => adapter;
package/dist/react.d.ts CHANGED
@@ -34,7 +34,7 @@ declare function useCustomer(): {
34
34
  loading: boolean;
35
35
  login: (email: string, password: string) => Promise<ShopUser>;
36
36
  logout: () => Promise<void>;
37
- signup: (data: {
37
+ signUp: (data: {
38
38
  email: string;
39
39
  password: string;
40
40
  name?: string;
package/dist/react.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  createShopClient,
7
7
  formatPrice,
8
8
  priceField
9
- } from "./chunk-KON3VWC6.js";
9
+ } from "./chunk-U57EXASA.js";
10
10
 
11
11
  // src/react.ts
12
12
  import {
@@ -70,7 +70,7 @@ function useCustomer() {
70
70
  loading: state.loading,
71
71
  login: client.login,
72
72
  logout: client.logout,
73
- signup: client.signup,
73
+ signUp: client.signUp,
74
74
  verifyEmail: client.verifyEmail,
75
75
  forgotPassword: client.forgotPassword,
76
76
  resetPassword: client.resetPassword
package/dist/stripe.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  paymentFailed,
3
3
  paymentSucceeded
4
- } from "./chunk-6TTXJZ3P.js";
4
+ } from "./chunk-7HMAFDY3.js";
5
5
 
6
6
  // src/stripe.ts
7
7
  function stripeAdapter(options) {
package/dist/vue.d.ts CHANGED
@@ -37,7 +37,7 @@ declare function useCustomer(): {
37
37
  loading: vue.ComputedRef<boolean>;
38
38
  login: (email: string, password: string) => Promise<ShopUser>;
39
39
  logout: () => Promise<void>;
40
- signup: (data: {
40
+ signUp: (data: {
41
41
  email: string;
42
42
  password: string;
43
43
  name?: string;
package/dist/vue.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  createShopClient,
7
7
  formatPrice,
8
8
  priceField
9
- } from "./chunk-KON3VWC6.js";
9
+ } from "./chunk-U57EXASA.js";
10
10
 
11
11
  // src/vue.ts
12
12
  import {
@@ -71,7 +71,7 @@ function useCustomer() {
71
71
  loading: computed(() => state.value.loading),
72
72
  login: client.login,
73
73
  logout: client.logout,
74
- signup: client.signup,
74
+ signUp: client.signUp,
75
75
  verifyEmail: client.verifyEmail,
76
76
  forgotPassword: client.forgotPassword,
77
77
  resetPassword: client.resetPassword
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easy-cms/plugin-ecommerce",
3
- "version": "0.47.4",
3
+ "version": "0.49.0",
4
4
  "description": "A shop for Easy CMS: products and variants, prices in several currencies, carts (guests too), checkout with Stripe or bank transfer, orders, stock, customer accounts, and React and Vue hooks",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -36,7 +36,7 @@
36
36
  "react": ">=18.0.0",
37
37
  "stripe": ">=17.0.0",
38
38
  "vue": "^3.4.0",
39
- "@easy-cms/core": "^0.47.4"
39
+ "@easy-cms/core": "^0.49.0"
40
40
  },
41
41
  "peerDependenciesMeta": {
42
42
  "react": {
@@ -54,9 +54,9 @@
54
54
  "happy-dom": "^20.14.5",
55
55
  "react": "^19.2.0",
56
56
  "vue": "^3.5.43",
57
- "@easy-cms/core": "^0.47.4",
58
- "@easy-cms/plugin-multi-tenant": "^0.47.4",
59
- "@easy-cms/db-sqlite": "^0.47.4"
57
+ "@easy-cms/core": "^0.49.0",
58
+ "@easy-cms/db-sqlite": "^0.49.0",
59
+ "@easy-cms/plugin-multi-tenant": "^0.49.0"
60
60
  },
61
61
  "engines": {
62
62
  "node": ">=22.12"