tek-ms-recap 1.0.9 → 1.0.11

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.
@@ -17,7 +17,8 @@ export interface RenderInterfaceRecap {
17
17
  customers: Customer[];
18
18
  onConfirm: (items: RecapItem[], customer: Customer) => void;
19
19
  onCancel: (items: RecapItem[]) => void;
20
- onCustomerChange?: (customer: Customer) => void;
20
+ onSaveCustomer?: (customer: Customer) => void;
21
+ selectedCustomer?: (customer: Customer) => void;
21
22
  }
22
23
  export declare class RecapSheet {
23
24
  private el;
@@ -30,7 +31,8 @@ export declare class RecapSheet {
30
31
  private selectedCustomer;
31
32
  private onConfirm?;
32
33
  private onCancel?;
33
- private onCustomerChange?;
34
+ private onSaveCustomer?;
35
+ private setSelectedCustomer?;
34
36
  constructor(mountPoint: HTMLElement);
35
37
  getItems(): RecapItem[];
36
38
  setItems(_items: RecapItem[]): void;
package/dist/ms-recap.js CHANGED
@@ -28,7 +28,8 @@ var t = [
28
28
  selectedCustomer = null;
29
29
  onConfirm;
30
30
  onCancel;
31
- onCustomerChange;
31
+ onSaveCustomer;
32
+ setSelectedCustomer;
32
33
  constructor(e) {
33
34
  this.el = e, this.clientOverlayEl = document.createElement("div"), this.clientOverlayEl.id = "recap-client-overlay", document.body.appendChild(this.clientOverlayEl), this.newClientOverlayEl = document.createElement("div"), this.newClientOverlayEl.id = "recap-new-client-overlay", document.body.appendChild(this.newClientOverlayEl);
34
35
  }
@@ -60,7 +61,7 @@ var t = [
60
61
  return t[n % t.length];
61
62
  }
62
63
  render(t) {
63
- this.setItems(t.items), this.customers = t.customers, this.onConfirm = t.onConfirm, this.onCancel = t.onCancel, this.onCustomerChange = t.onCustomerChange, this.selectedCustomer = null, this.el.innerHTML = `
64
+ this.setItems(t.items), this.customers = t.customers, this.onConfirm = t.onConfirm, this.onCancel = t.onCancel, this.onSaveCustomer = t.onSaveCustomer, this.setSelectedCustomer = t.selectedCustomer, this.selectedCustomer = null, this.el.innerHTML = `
64
65
  <div class="overlay show" id="recap-overlay">
65
66
  <div class="sheet modal-recap" style="max-height:88vh;">
66
67
  <div class="sheet-handle"></div>
@@ -119,7 +120,7 @@ var t = [
119
120
  if (e) {
120
121
  if (this.selectedCustomer) {
121
122
  let t = this.selectedCustomer;
122
- e.innerHTML = `
123
+ this.setSelectedCustomer?.(t), e.innerHTML = `
123
124
  <div style="display:flex; align-items:center; gap:10px; text-align:left;">
124
125
  <div class="avatar" style="background:${this.avatarColorFor(t.phone)}; width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:700; font-size:11px; flex-shrink:0;">
125
126
  ${this.getCustomerInitials(t.firstname, t.lastname)}
@@ -173,7 +174,7 @@ var t = [
173
174
  }
174
175
  selectCustomer(e) {
175
176
  let t = this.customers.find((t) => t.phone === e);
176
- t && (this.selectedCustomer = t, this.renderClientBlock(), this.resetClientSheet(), this.onCustomerChange?.(t));
177
+ t && (this.selectedCustomer = t, this.renderClientBlock(), this.resetClientSheet());
177
178
  }
178
179
  resetClientSheet() {
179
180
  this.clientOverlayEl.innerHTML = "";
@@ -219,7 +220,7 @@ var t = [
219
220
  lastname: c,
220
221
  phone: l
221
222
  };
222
- u || this.customers.unshift(d), this.selectedCustomer = d, this.renderClientBlock(), this.resetClientOverlay(), this.resetClientSheet(), this.onCustomerChange?.(d);
223
+ u || this.customers.unshift(d), this.selectedCustomer = d, this.renderClientBlock(), this.resetClientOverlay(), this.resetClientSheet(), this.onSaveCustomer?.(d);
223
224
  });
224
225
  }
225
226
  extractLocalPhoneDigits(e) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tek-ms-recap",
3
3
  "private": false,
4
- "version": "v1.0.9",
4
+ "version": "v1.0.11",
5
5
  "type": "module",
6
6
  "main": "./dist/ms-recap.js",
7
7
  "module": "./dist/ms-recap.js",