@leatcom/portal-sessions 0.0.61 → 0.0.63

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.
@@ -1,20 +1,6 @@
1
1
  import { JSX as JSX_2 } from 'react/jsx-runtime';
2
2
  import { ReactElement } from 'react';
3
3
 
4
- export declare type Attribute = {
5
- attribute: {
6
- field_type: string;
7
- id: number;
8
- is_hard_read_only: boolean;
9
- is_soft_read_only: boolean;
10
- label: string;
11
- name: string;
12
- options: [];
13
- type: any;
14
- };
15
- value: string;
16
- };
17
-
18
4
  declare type Column = {
19
5
  align?: "left" | "center" | "right";
20
6
  value: ColumnValue;
@@ -62,17 +48,10 @@ export declare type ContactAttributeFormElement = {
62
48
  };
63
49
 
64
50
  export declare type ContactResource = {
65
- id: number;
66
51
  uuid: string;
67
52
  email: string;
68
- attributes: Array<Attribute>;
69
- tier: Tier | null;
70
- subscriptions: Array<Subscription>;
71
53
  credit_balance: CreditBalance;
72
54
  prepaid_balance: PrepaidBalance;
73
- current_values: {
74
- [key: string]: string | number;
75
- };
76
55
  current_display_values: {
77
56
  [key: string]: string;
78
57
  };
@@ -84,20 +63,7 @@ export declare type CreditBalance = {
84
63
  };
85
64
 
86
65
  export declare type CreditReceptionTransactionResource = {
87
- type: string;
88
66
  credits: number;
89
- contact: {
90
- uuid: string;
91
- };
92
- shop: {
93
- name: string;
94
- uuid: string;
95
- };
96
- contact_identifier: string;
97
- created_at: string;
98
- uuid: string;
99
- unit_value: string;
100
- unit: string;
101
67
  };
102
68
 
103
69
  export declare function DefaultSession({ uuid, host }: DefaultSessionProps): JSX_2.Element;
@@ -133,36 +99,10 @@ export declare enum FacingMode {
133
99
  ENVIRONMENT = "environment"
134
100
  }
135
101
 
136
- export declare type GiftcardProgram = {
137
- id: number;
138
- name: string;
139
- uuid: string;
140
- max_amount_in_cents: number;
141
- };
142
-
143
- export declare type GiftcardRecipient = {
144
- id: number;
145
- email: string;
146
- status: number;
147
- opens: number;
148
- clicks: number;
149
- };
150
-
151
102
  export declare type GiftcardResource = {
152
- id: number;
153
103
  uuid: string;
154
- type: string;
155
104
  hash: string;
156
105
  amount_in_cents: number;
157
- upgradeable: boolean;
158
- active: boolean;
159
- expiration_date: string;
160
- amount: number;
161
- url: string;
162
- display_amount: string;
163
- formatted_expiration_date: string;
164
- giftcard_program: GiftcardProgram;
165
- giftcard_recipients: Array<GiftcardRecipient>;
166
106
  };
167
107
 
168
108
  export declare type GiftcardTransactionResource = {
@@ -388,13 +328,6 @@ export declare type TableResponse = {
388
328
  empty_state_url: string;
389
329
  };
390
330
 
391
- export declare type Tier = {
392
- description: string;
393
- name: string;
394
- position: number;
395
- uuid: string;
396
- };
397
-
398
331
  export declare type VoucherResource = {
399
332
  uuid: string;
400
333
  code: string;
@@ -6199,7 +6199,7 @@ const kp = be.use || ((e) => {
6199
6199
  email: t
6200
6200
  });
6201
6201
  return {
6202
- contact: n == null ? void 0 : n.data.data,
6202
+ contact: n == null ? void 0 : n.data,
6203
6203
  data: n,
6204
6204
  error: r,
6205
6205
  isLoading: i,
@@ -6348,9 +6348,7 @@ const Is = (e, t = "EUR") => new Intl.NumberFormat(en.language, {
6348
6348
  }).format(e / 100), oa = (e) => {
6349
6349
  window.parent.postMessage(e, "*");
6350
6350
  }, Dp = (e, t) => Math.abs(Math.round((t.getTime() - e.getTime()) / (1e3 * 3600 * 24))), Mp = (e, t) => Math.abs(Math.round((t.getTime() - e.getTime()) / (1e3 * 3600 * 24 * 7))), Pp = (e, t) => Math.abs(Math.round((t.getTime() - e.getTime()) / (1e3 * 3600 * 24 * 365.25))), bA = async (e, t) => {
6351
- const {
6352
- data: { data: n }
6353
- } = await or.get(e);
6351
+ const { data: n } = await or.get(e);
6354
6352
  n && t(n);
6355
6353
  }, Mo = async (e, t, n, r) => {
6356
6354
  const i = await Do.setContact(e, {
@@ -10644,9 +10642,7 @@ function iT({ value: e, max: t, label: n }) {
10644
10642
  function pu({ state: e }) {
10645
10643
  const t = Mn(), { t: n } = ot(), r = Pt(), [i, s] = Ce(""), [o, c] = Ce(!1), { session: u, mutate: d } = Et(), [f, p] = Ce(!1), l = async (a) => {
10646
10644
  if (t.onContactLink) {
10647
- const {
10648
- data: { data: h }
10649
- } = await or.get(a);
10645
+ const { data: h } = await or.get(a);
10650
10646
  h && t.onContactLink(h);
10651
10647
  }
10652
10648
  }, b = zt(() => {
@@ -16329,7 +16325,7 @@ function uR({ contact: e }) {
16329
16325
  const { t } = ot(), {
16330
16326
  session: { loyalty_program: n }
16331
16327
  } = Et(), r = (s, o) => Pp(s, o) ? `${Pp(s, o)} ${t("yearsAgo")}` : Mp(s, o) ? `${Mp(s, o)} ${t("weeksAgo")}` : Dp(s, o) ? `${Dp(s, o)} ${t("daysAgo")}` : t("today"), i = () => {
16332
- const s = /* @__PURE__ */ new Date(), o = new Date(e.current_display_values.birthdate);
16328
+ const s = /* @__PURE__ */ new Date(), o = new Date(e.current_display_values["contact.birthdate"]);
16333
16329
  return o.setFullYear(s.getFullYear()), s.getTime() > o.getTime() && o.setFullYear(o.getFullYear() + 1), Math.floor((o.getTime() - s.getTime()) / (1e3 * 60 * 60 * 24));
16334
16330
  };
16335
16331
  return /* @__PURE__ */ m.jsxs("div", { className: "h-full justify-between", children: [
@@ -16340,7 +16336,7 @@ function uR({ contact: e }) {
16340
16336
  /* @__PURE__ */ m.jsxs("div", { children: [
16341
16337
  /* @__PURE__ */ m.jsx("p", { className: "text-xs font-semibold", children: r(
16342
16338
  /* @__PURE__ */ new Date(),
16343
- new Date(e.current_display_values.loyalty_last_transaction_date)
16339
+ new Date(e.current_display_values["contact.loyalty_last_transaction_date"])
16344
16340
  ) }),
16345
16341
  /* @__PURE__ */ m.jsx("p", { className: "text-xs text-core-gray-500", children: t("lastVisit") })
16346
16342
  ] })
@@ -16348,24 +16344,27 @@ function uR({ contact: e }) {
16348
16344
  /* @__PURE__ */ m.jsxs("div", { className: "flex items-center gap-2", children: [
16349
16345
  /* @__PURE__ */ m.jsx(an, { icon: "shopping-bag" }),
16350
16346
  /* @__PURE__ */ m.jsxs("div", { children: [
16351
- /* @__PURE__ */ m.jsx("p", { className: "text-xs font-semibold", children: `${e.current_display_values.loyalty_number_of_transactions} ${t("visits")}` }),
16347
+ /* @__PURE__ */ m.jsx("p", { className: "text-xs font-semibold", children: `${e.current_display_values["contact.loyalty_number_of_transactions"]} ${t("visits")}` }),
16352
16348
  /* @__PURE__ */ m.jsx("p", { className: "text-xs text-core-gray-500", children: t("totalVisits") })
16353
16349
  ] })
16354
16350
  ] }),
16355
16351
  /* @__PURE__ */ m.jsxs("div", { className: "flex items-center gap-2", children: [
16356
16352
  /* @__PURE__ */ m.jsx(an, { icon: "dollar" }),
16357
16353
  /* @__PURE__ */ m.jsxs("div", { children: [
16358
- /* @__PURE__ */ m.jsx("p", { className: "text-xs font-semibold", children: `${e.current_display_values.loyalty_total_credits_received} ${n.custom_credit_name ? n.custom_credit_name : t("points")}` }),
16354
+ /* @__PURE__ */ m.jsx("p", { className: "text-xs font-semibold", children: `${e.current_display_values["contact.loyalty_total_credits_received"]} ${n.custom_credit_name ? n.custom_credit_name : t("points")}` }),
16359
16355
  /* @__PURE__ */ m.jsx("p", { className: "text-xs text-core-gray-500", children: t("totalCredits") })
16360
16356
  ] })
16361
16357
  ] }),
16362
- e.current_values.birthdate && /* @__PURE__ */ m.jsxs("div", { className: "flex items-center gap-2", children: [
16358
+ e.current_display_values["contact.birthdate"] && /* @__PURE__ */ m.jsxs("div", { className: "flex items-center gap-2", children: [
16363
16359
  /* @__PURE__ */ m.jsx(an, { icon: "star" }),
16364
16360
  /* @__PURE__ */ m.jsxs("div", { children: [
16365
- /* @__PURE__ */ m.jsx("p", { className: "text-xs font-semibold", children: new Date(e.current_display_values.birthdate).toLocaleDateString(en.language, {
16366
- day: "numeric",
16367
- month: "long"
16368
- }) }),
16361
+ /* @__PURE__ */ m.jsx("p", { className: "text-xs font-semibold", children: new Date(e.current_display_values["contact.birthdate"]).toLocaleDateString(
16362
+ en.language,
16363
+ {
16364
+ day: "numeric",
16365
+ month: "long"
16366
+ }
16367
+ ) }),
16369
16368
  /* @__PURE__ */ m.jsx("p", { className: "text-xs text-core-gray-500", children: t("birthdayInDays", { number: i() }) })
16370
16369
  ] })
16371
16370
  ] })
@@ -16402,21 +16401,24 @@ function Fv({ subscription: e, onChange: t, editable: n = !1 }) {
16402
16401
  }
16403
16402
  function lR({ contact: e }) {
16404
16403
  const t = Pt(), { t: n } = ot();
16405
- return /* @__PURE__ */ m.jsxs("div", { className: "inline-grid w-full items-center gap-4 py-4 lg:grid-cols-2", children: [
16404
+ return console.log(e.current_display_values), /* @__PURE__ */ m.jsxs("div", { className: "inline-grid w-full items-center gap-4 py-4 lg:grid-cols-2", children: [
16406
16405
  /* @__PURE__ */ m.jsxs("div", { className: "flex items-center gap-4", children: [
16407
- /* @__PURE__ */ m.jsx(Af, { src: e.current_display_values.avatar, size: "2xl" }),
16406
+ /* @__PURE__ */ m.jsx(Af, { src: e.current_display_values["contact.avatar"], size: "2xl" }),
16408
16407
  /* @__PURE__ */ m.jsxs("div", { className: "flex flex-col gap-1", children: [
16409
16408
  /* @__PURE__ */ m.jsxs("div", { className: "flex gap-2", children: [
16410
- /* @__PURE__ */ m.jsx("p", { className: "text-lg", children: e.current_display_values.firstname || e.current_display_values.lastname ? `${e.current_display_values.firstname} ${e.current_display_values.lastname}` : e.current_display_values.email }),
16411
- e.current_display_values.tier && /* @__PURE__ */ m.jsx(Tf, { label: e.current_display_values.tier, size: "sm", stroke: !0 })
16409
+ /* @__PURE__ */ m.jsx("p", { className: "text-lg", children: e.current_display_values["contact.firstname"] || e.current_display_values["contact.lastname"] ? `${e.current_display_values["contact.firstname"]} ${e.current_display_values["contact.lastname"]}` : e.current_display_values["contact.email"] }),
16410
+ e.current_display_values["contact.tier"] && /* @__PURE__ */ m.jsx(Tf, { label: e.current_display_values["contact.tier"], size: "sm", stroke: !0 })
16412
16411
  ] }),
16413
16412
  /* @__PURE__ */ m.jsxs("p", { className: "text-sm text-core-gray-500 ", children: [
16414
16413
  n("joined"),
16415
16414
  " ",
16416
- new Date(e.current_values.created_at).toLocaleDateString(en.language, {
16417
- month: "long",
16418
- year: "numeric"
16419
- })
16415
+ new Date(e.current_display_values["contact.created_at"]).toLocaleDateString(
16416
+ en.language,
16417
+ {
16418
+ month: "long",
16419
+ year: "numeric"
16420
+ }
16421
+ )
16420
16422
  ] })
16421
16423
  ] })
16422
16424
  ] }),
@@ -16452,7 +16454,7 @@ function dR() {
16452
16454
  /* @__PURE__ */ m.jsx(Dt, { children: /* @__PURE__ */ m.jsxs("div", { className: "grid grid-cols-1 gap-x-2 gap-y-2 lg:grid-cols-4", children: [
16453
16455
  /* @__PURE__ */ m.jsxs("div", { className: "flex gap-2 lg:flex-col", children: [
16454
16456
  /* @__PURE__ */ m.jsx(eo, { children: /* @__PURE__ */ m.jsxs("div", { className: "flex h-full flex-col items-center justify-center", children: [
16455
- /* @__PURE__ */ m.jsx("p", { className: "text-2xl leading-8", children: e.current_display_values.loyalty_balance }),
16457
+ /* @__PURE__ */ m.jsx("p", { className: "text-2xl leading-8", children: e.current_display_values["contact.loyalty_balance"] }),
16456
16458
  /* @__PURE__ */ m.jsx("p", { className: "text-sm text-core-gray-500", children: n.custom_credit_name ? n.custom_credit_name : i("points") })
16457
16459
  ] }) }),
16458
16460
  /* @__PURE__ */ m.jsx(eo, { children: /* @__PURE__ */ m.jsxs("div", { className: "flex h-full flex-col items-center justify-center", children: [
@@ -16522,7 +16524,9 @@ function fR() {
16522
16524
  /* @__PURE__ */ m.jsx(Mt, { children: /* @__PURE__ */ m.jsx(da, { label: e("back"), path: "../" }) }),
16523
16525
  /* @__PURE__ */ m.jsx(Dt, { children: /* @__PURE__ */ m.jsxs("div", { className: "md:max-h-[528px]", children: [
16524
16526
  /* @__PURE__ */ m.jsx("p", { className: "text-sm font-medium", children: e("allActivities") }),
16525
- /* @__PURE__ */ m.jsx("p", { className: "mb-4 text-sm text-core-gray-500", children: e("checkOutAllActivitiesOfName", { name: n.current_display_values.firstname }) }),
16527
+ /* @__PURE__ */ m.jsx("p", { className: "mb-4 text-sm text-core-gray-500", children: e("checkOutAllActivitiesOfName", {
16528
+ name: n.current_display_values["contact.firstname"]
16529
+ }) }),
16526
16530
  /* @__PURE__ */ m.jsx("div", { className: "overflow-auto", children: t == null ? void 0 : t.map((r) => /* @__PURE__ */ m.jsx(Lv, { loyaltyTransaction: r }, r.uuid)) })
16527
16531
  ] }) })
16528
16532
  ] }) });
@@ -16682,7 +16686,7 @@ function yR() {
16682
16686
  }, f = async () => {
16683
16687
  o && (await Op.update(o), await r(), Ve.success(e("contactAttributesUpdated")), c(void 0));
16684
16688
  };
16685
- return /* @__PURE__ */ m.jsx("div", { className: "h-full md:container", children: /* @__PURE__ */ m.jsxs(Gt, { children: [
16689
+ return console.log("current display values", t.current_display_values), /* @__PURE__ */ m.jsx("div", { className: "h-full md:container", children: /* @__PURE__ */ m.jsxs(Gt, { children: [
16686
16690
  /* @__PURE__ */ m.jsx(Mt, { children: /* @__PURE__ */ m.jsx(da, { label: e("back"), path: "../" }) }),
16687
16691
  /* @__PURE__ */ m.jsx(Dt, { children: /* @__PURE__ */ m.jsxs("div", { className: "md:max-h-[528px]", children: [
16688
16692
  !n && /* @__PURE__ */ m.jsxs(
@@ -16690,14 +16694,14 @@ function yR() {
16690
16694
  {
16691
16695
  className: "mb-4 flex flex-row items-center gap-4 border-b border-b-core-gray-200 px-1 pb-4",
16692
16696
  children: [
16693
- /* @__PURE__ */ m.jsx(Af, { src: t.current_display_values.avatar, size: "2xl" }),
16697
+ /* @__PURE__ */ m.jsx(Af, { src: t.current_display_values["contact.avatar"], size: "2xl" }),
16694
16698
  /* @__PURE__ */ m.jsxs("div", { children: [
16695
16699
  /* @__PURE__ */ m.jsx("div", { className: "flex flex-row items-center gap-2 ", children: /* @__PURE__ */ m.jsxs("h1", { className: "text-lg text-core-gray-900", children: [
16696
- t.current_display_values.firstname,
16700
+ t.current_display_values["contact.firstname"],
16697
16701
  " ",
16698
- t.current_display_values.lastname
16702
+ t.current_display_values["contact.lastname"]
16699
16703
  ] }) }),
16700
- /* @__PURE__ */ m.jsx("p", { className: "text-sm text-core-gray-500", children: t.current_display_values.email })
16704
+ /* @__PURE__ */ m.jsx("p", { className: "text-sm text-core-gray-500", children: t.current_display_values["contact.email"] })
16701
16705
  ] })
16702
16706
  ]
16703
16707
  }
@@ -16711,8 +16715,8 @@ function yR() {
16711
16715
  {
16712
16716
  name: p.name,
16713
16717
  label: p.label,
16714
- value: o && o[p.name] ? o[p.name] : t.current_display_values[p.name],
16715
- onChange: (l) => d(p.name, l),
16718
+ value: o && o[p.name] ? o[p.name] : t.current_display_values[`contact.${p.name}`],
16719
+ onChange: (l) => d(`contact.${p.name}`, l),
16716
16720
  disabled: p.disabled,
16717
16721
  children: p.options.map((l) => /* @__PURE__ */ m.jsx(
16718
16722
  ld,
@@ -16728,7 +16732,7 @@ function yR() {
16728
16732
  rT,
16729
16733
  {
16730
16734
  name: p.name,
16731
- value: o && o[p.name] ? o[p.name] : p.defaultValue,
16735
+ value: o && o[`contact.${p.name}`] ? o[`contact.${p.name}`] : p.defaultValue,
16732
16736
  label: p.label,
16733
16737
  onChange: d,
16734
16738
  disabled: p.disabled,
@@ -16742,7 +16746,7 @@ function yR() {
16742
16746
  name: p.name,
16743
16747
  label: p.label,
16744
16748
  type: p.type === "date_time" ? "date_time" : "date",
16745
- value: o && o[p.name] ? o[p.name] : t.current_display_values[p.name],
16749
+ value: o && o[`contact.${p.name}`] ? o[`contact.${p.name}`] : t.current_display_values[`contact.${p.name}`],
16746
16750
  disabled: p.disabled,
16747
16751
  onChange: u
16748
16752
  },
@@ -16753,7 +16757,7 @@ function yR() {
16753
16757
  disabled: p.disabled,
16754
16758
  label: p.label,
16755
16759
  name: p.name,
16756
- value: o && o[p.name] !== "undefined" ? o[p.name] : t.current_display_values[p.name],
16760
+ value: o && o[`contact.${p.name}`] !== "undefined" ? o[`contact.${p.name}`] : t.current_display_values[`contact.${p.name}`],
16757
16761
  onChange: u
16758
16762
  },
16759
16763
  p.id
@@ -17299,9 +17303,7 @@ function fa() {
17299
17303
  function AR() {
17300
17304
  const e = Pt(), { t } = ot(), { session: n, mutate: r } = Et(), { onContactLink: i } = Mn(), [s, o] = Ce(""), [c, u] = Ce(!1), [d, f] = Ce(!1), [p, l] = Ce(!1), [b, a] = Ce(), h = async (g) => {
17301
17305
  if (i) {
17302
- const {
17303
- data: { data: v }
17304
- } = await or.get(g);
17306
+ const { data: v } = await or.get(g);
17305
17307
  v && i(v);
17306
17308
  }
17307
17309
  }, y = zt(async () => {
@@ -17554,7 +17556,7 @@ function MR() {
17554
17556
  return De(() => {
17555
17557
  !c && !s && !d && (async () => await p())();
17556
17558
  }, []), r ? /* @__PURE__ */ m.jsx(m.Fragment, {}) : n ? /* @__PURE__ */ m.jsx(hn, { children: /* @__PURE__ */ m.jsxs(Gt, { children: [
17557
- /* @__PURE__ */ m.jsx(Mt, { children: /* @__PURE__ */ m.jsx("div", { className: "flex h-16 items-center", children: /* @__PURE__ */ m.jsx("p", { children: n.current_display_values.firstname || n.current_display_values.lastname ? `${n.current_display_values.firstname} ${n.current_display_values.lastname}` : n.current_display_values.email }) }) }),
17559
+ /* @__PURE__ */ m.jsx(Mt, { children: /* @__PURE__ */ m.jsx("div", { className: "flex h-16 items-center", children: /* @__PURE__ */ m.jsx("p", { children: n.current_display_values["contact.firstname"] || n.current_display_values["contact.lastname"] ? `${n.current_display_values["contact.firstname"]} ${n.current_display_values["contact.lastname"]}` : n.current_display_values["contact.email"] }) }) }),
17558
17560
  /* @__PURE__ */ m.jsx(Dt, { children: /* @__PURE__ */ m.jsxs("div", { className: "flex h-full flex-col justify-between gap-4", children: [
17559
17561
  /* @__PURE__ */ m.jsx("div", { className: "flex h-full flex-col items-center gap-2 p-6", children: d ? /* @__PURE__ */ m.jsx("p", { className: "text-core-red-500", children: d }) : /* @__PURE__ */ m.jsx("div", { className: "flex h-full items-center justify-center gap-1 text-4xl font-bold", children: s ? /* @__PURE__ */ m.jsxs(m.Fragment, { children: [
17560
17562
  "+",
@@ -17602,7 +17604,7 @@ function jR() {
17602
17604
  return !t || !i ? /* @__PURE__ */ m.jsx(m.Fragment, {}) : /* @__PURE__ */ m.jsx(hn, { children: /* @__PURE__ */ m.jsx(
17603
17605
  A0,
17604
17606
  {
17605
- title: `${i.current_display_values.firstname} ${i.current_display_values.lastname}`,
17607
+ title: `${i.current_display_values["contact.firstname"]} ${i.current_display_values["contact.lastname"]}`,
17606
17608
  balance: (t == null ? void 0 : t.balance_in_cents) ?? 0,
17607
17609
  transaction: s
17608
17610
  }
@@ -17626,7 +17628,7 @@ function BR() {
17626
17628
  }), l;
17627
17629
  }, p = () => Math.min(u + f(), t == null ? void 0 : t.balance_in_cents);
17628
17630
  return /* @__PURE__ */ m.jsx(hn, { children: /* @__PURE__ */ m.jsxs(Gt, { children: [
17629
- /* @__PURE__ */ m.jsx(Mt, { children: /* @__PURE__ */ m.jsx("div", { className: "flex h-16 items-center", children: /* @__PURE__ */ m.jsx("p", { children: `${r.current_display_values.firstname} ${r.current_display_values.lastname}` }) }) }),
17631
+ /* @__PURE__ */ m.jsx(Mt, { children: /* @__PURE__ */ m.jsx("div", { className: "flex h-16 items-center", children: /* @__PURE__ */ m.jsx("p", { children: `${r.current_display_values["contact.firstname"]}} ${r.current_display_values["contact.lastname"]}` }) }) }),
17630
17632
  /* @__PURE__ */ m.jsx(Dt, { children: /* @__PURE__ */ m.jsxs("div", { className: "flex h-full flex-col gap-4", children: [
17631
17633
  /* @__PURE__ */ m.jsx("div", { className: "rounded-lg bg-core-primary-50 p-4", children: /* @__PURE__ */ m.jsxs("div", { className: "flex justify-between", children: [
17632
17634
  /* @__PURE__ */ m.jsx("p", { className: "font-light text-gray-500", children: e("prepaidBalance") }),