@forgebuild/sidon-booking-widget 3.0.1 → 4.0.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.
@@ -4245,7 +4245,11 @@ function Wa(e) {
4245
4245
  type: e.type ?? "",
4246
4246
  name: e.name ?? "",
4247
4247
  mandatory: e.mandatory !== !1,
4248
- met: e.met === !0
4248
+ met: e.met === !0,
4249
+ latest: e.latest?.id ? {
4250
+ id: String(e.latest.id),
4251
+ expiryDate: typeof e.latest.expiry_date == "string" ? e.latest.expiry_date.slice(0, 10) : null
4252
+ } : null
4249
4253
  }))
4250
4254
  };
4251
4255
  }
@@ -5166,7 +5170,7 @@ async function zo(e, t, n) {
5166
5170
  return Ja((await ko(jo(e, t, n, "/cancel"), "Could not cancel the booking", Ao({}, Mo(n)))).booking);
5167
5171
  }
5168
5172
  async function Bo(e, t, n) {
5169
- await ko(`${e}/api/sailor/documents?type=${encodeURIComponent(n.type)}`, "Upload failed", {
5173
+ await ko(`${e}/api/sailor/documents?${n.documentId ? `document_id=${encodeURIComponent(n.documentId)}` : `type=${encodeURIComponent(n.type)}`}`, "Upload failed", {
5170
5174
  method: "POST",
5171
5175
  headers: {
5172
5176
  "X-Sailor-Token": t,
@@ -5226,94 +5230,105 @@ async function Go(e) {
5226
5230
  }
5227
5231
  //#endregion
5228
5232
  //#region src/components/DocumentsStep.svelte
5229
- var Ko = /* @__PURE__ */ Y("<div class=\"sbw-sailor svelte-1d47278\"><span class=\"sbw-sailor-email svelte-1d47278\"> <strong> </strong></span> <button type=\"button\" class=\"sbw-link svelte-1d47278\"> </button></div>"), qo = /* @__PURE__ */ Y("<p class=\"sbw-docs-note svelte-1d47278\"> </p>"), Jo = /* @__PURE__ */ Y("<p class=\"sbw-docs-note svelte-1d47278\"> </p> <!>", 1), Yo = /* @__PURE__ */ Mr("<svg class=\"sbw-spin svelte-1d47278\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\"><path d=\"M21 12a9 9 0 1 1-6.219-8.56\"></path></svg>"), Xo = /* @__PURE__ */ Mr("<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M5 12.5l4.5 4.5L19 7.5\"></path></svg>"), Zo = /* @__PURE__ */ Mr("<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12\"></path></svg>"), Qo = /* @__PURE__ */ Y("<div class=\"sbw-doc-icon svelte-1d47278\" aria-hidden=\"true\"><!></div>"), $o = /* @__PURE__ */ Y("<span class=\"sbw-required svelte-1d47278\">*</span>"), es = /* @__PURE__ */ Y("<div class=\"sbw-doc-sub svelte-1d47278\"> </div>"), ts = /* @__PURE__ */ Y("<span class=\"sbw-doc-cta svelte-1d47278\"> </span>"), ns = /* @__PURE__ */ Y("<input type=\"file\" accept=\"image/*,application/pdf\" class=\"sbw-visually-hidden svelte-1d47278\"/>"), rs = /* @__PURE__ */ Y("<div class=\"sbw-doc-main svelte-1d47278\"><!> <div class=\"sbw-doc-text svelte-1d47278\"><div class=\"sbw-doc-name svelte-1d47278\"> <!></div> <!></div></div> <!> <!>", 1), is = /* @__PURE__ */ Y("<div class=\"sbw-docs-error svelte-1d47278\" role=\"alert\"> </div>"), as = /* @__PURE__ */ Y("<p class=\"sbw-docs-error svelte-1d47278\" role=\"alert\"> </p>"), os = /* @__PURE__ */ Y("<!> <!> <!> <!>", 1), ss = /* @__PURE__ */ Y("<p class=\"sbw-docs-error svelte-1d47278\" role=\"alert\"> </p> <button type=\"button\" class=\"sbw-auth-btn svelte-1d47278\"> </button>", 1), cs = /* @__PURE__ */ Y("<div class=\"sbw-auth-actions svelte-1d47278\"><button type=\"button\" class=\"sbw-auth-btn sbw-auth-primary svelte-1d47278\"> </button></div> <!>", 1), ls = /* @__PURE__ */ Y("<div><div class=\"sbw-docs-heading svelte-1d47278\"> </div> <!> <!> <!> <!></div>"), us = {
5233
+ var Ko = /* @__PURE__ */ Y("<div class=\"sbw-sailor svelte-1d47278\"><span class=\"sbw-sailor-email svelte-1d47278\"> <strong> </strong></span> <button type=\"button\" class=\"sbw-link svelte-1d47278\"> </button></div>"), qo = /* @__PURE__ */ Y("<p class=\"sbw-docs-note svelte-1d47278\"> </p>"), Jo = /* @__PURE__ */ Y("<p class=\"sbw-docs-note svelte-1d47278\"> </p> <!>", 1), Yo = /* @__PURE__ */ Mr("<svg class=\"sbw-spin svelte-1d47278\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\"><path d=\"M21 12a9 9 0 1 1-6.219-8.56\"></path></svg>"), Xo = /* @__PURE__ */ Mr("<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M5 12.5l4.5 4.5L19 7.5\"></path></svg>"), Zo = /* @__PURE__ */ Mr("<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12\"></path></svg>"), Qo = /* @__PURE__ */ Y("<div class=\"sbw-doc-icon svelte-1d47278\" aria-hidden=\"true\"><!></div>"), $o = /* @__PURE__ */ Y("<span class=\"sbw-required svelte-1d47278\">*</span>"), es = /* @__PURE__ */ Y("<div> </div>"), ts = /* @__PURE__ */ Y("<span class=\"sbw-doc-cta svelte-1d47278\"> </span>"), ns = /* @__PURE__ */ Y("<input type=\"file\" accept=\"image/*,application/pdf\" class=\"sbw-visually-hidden svelte-1d47278\"/>"), rs = /* @__PURE__ */ Y("<div class=\"sbw-doc-main svelte-1d47278\"><!> <div class=\"sbw-doc-text svelte-1d47278\"><div class=\"sbw-doc-name svelte-1d47278\"> <!></div> <!></div></div> <!> <!>", 1), is = /* @__PURE__ */ Y("<div class=\"sbw-docs-error svelte-1d47278\" role=\"alert\"> </div>"), as = /* @__PURE__ */ Y("<p class=\"sbw-docs-error svelte-1d47278\" role=\"alert\"> </p>"), os = /* @__PURE__ */ Y("<!> <!> <!> <!>", 1), ss = /* @__PURE__ */ Y("<p class=\"sbw-docs-error svelte-1d47278\" role=\"alert\"> </p> <button type=\"button\" class=\"sbw-auth-btn svelte-1d47278\"> </button>", 1), cs = /* @__PURE__ */ Y("<div class=\"sbw-auth-actions svelte-1d47278\"><button type=\"button\" class=\"sbw-auth-btn sbw-auth-primary svelte-1d47278\"> </button></div> <!>", 1), ls = /* @__PURE__ */ Y("<div><div class=\"sbw-docs-heading svelte-1d47278\"> </div> <!> <!> <!> <!></div>"), us = {
5230
5234
  hash: "svelte-1d47278",
5231
- code: ".sbw-docs.svelte-1d47278 {display:flex;flex-direction:column;gap:12px;padding:20px;color:var(--brand-ink, #252525);}.sbw-docs-heading.svelte-1d47278 {font-size:11px;font-weight:600;letter-spacing:2px;text-transform:uppercase;color:#252525;}.sbw-docs-note.svelte-1d47278 {margin:0;font-size:13px;color:#666;line-height:1.6;}.sbw-docs-error.svelte-1d47278 {margin:0;font-size:14px;color:#cc4949;}.sbw-sailor.svelte-1d47278 {display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:12px 16px;border:1px solid #e4e7ec;border-radius:var(--sbw-radius, 10px);font-size:13px;}.sbw-sailor-email.svelte-1d47278 {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sbw-link.svelte-1d47278 {flex-shrink:0;padding:0;border:none;background:none;font:inherit;color:var(--brand-navy, #16365b);text-decoration:underline;cursor:pointer;}.sbw-auth-actions.svelte-1d47278 {display:flex;flex-wrap:wrap;gap:10px;}.sbw-auth-btn.svelte-1d47278 {height:48px;padding:0 24px;border-radius:var(--sbw-radius, 10px);border:1px solid rgba(37, 37, 37, 0.15);background:transparent;color:var(--brand-navy, #16365b);font-size:12px;font-weight:600;letter-spacing:2px;text-transform:uppercase;cursor:pointer;}.sbw-auth-btn.sbw-auth-primary.svelte-1d47278 {border:none;background:var(--brand-gold, #c9a86b);}.sbw-auth-btn.svelte-1d47278:hover {background:var(--brand-navy, #16365b);color:#fff;}.sbw-variant-dark.svelte-1d47278 .sbw-sailor:where(.svelte-1d47278),\n .sbw-variant-dark.svelte-1d47278 .sbw-auth-btn:where(.svelte-1d47278) {border-radius:0;}.sbw-variant-dark.svelte-1d47278 .sbw-auth-btn:where(.svelte-1d47278) {color:var(--brand-ink, #252525);}.sbw-variant-dark.svelte-1d47278 .sbw-auth-btn.sbw-auth-primary:where(.svelte-1d47278) {background:var(--brand-ink, #252525);color:#fff;}.sbw-variant-dark.svelte-1d47278 .sbw-auth-btn:where(.svelte-1d47278):hover {background:var(--brand-gold, #c9a86b);color:var(--brand-ink, #252525);}.sbw-doc-row.svelte-1d47278 {display:flex;align-items:stretch;border:1px solid #e4e7ec;border-radius:var(--sbw-radius, 10px);overflow:hidden;background:#fff;}.sbw-doc-row.sbw-doc-can.svelte-1d47278 {cursor:pointer;}\n /* The file input is visually hidden, so show keyboard focus on the row. */.sbw-doc-row.svelte-1d47278:focus-within {outline:2px solid var(--brand-navy, #16365b);outline-offset:2px;}.sbw-doc-row.sbw-doc-done.svelte-1d47278 {border-color:var(--brand-navy, #16365b);background:var(--brand-navy, #16365b);color:#fff;}.sbw-doc-row.sbw-doc-busy.svelte-1d47278 {cursor:not-allowed;}.sbw-doc-main.svelte-1d47278 {display:flex;align-items:center;gap:16px;flex:1;min-width:0;padding:16px;}.sbw-doc-icon.svelte-1d47278 {width:32px;height:32px;display:flex;align-items:center;justify-content:center;flex-shrink:0;}.sbw-doc-busy.svelte-1d47278 .sbw-doc-icon:where(.svelte-1d47278) {color:var(--brand-navy, #16365b);}.sbw-spin.svelte-1d47278 {\n animation: svelte-1d47278-sbw-spin 0.8s linear infinite;}\n @keyframes svelte-1d47278-sbw-spin {\n to {\n transform: rotate(360deg);\n }\n }.sbw-doc-text.svelte-1d47278 {min-width:0;flex:1;}.sbw-doc-name.svelte-1d47278 {font-size:16px;font-weight:600;}.sbw-doc-sub.svelte-1d47278 {font-size:13px;opacity:0.8;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sbw-required.svelte-1d47278 {color:#cc4949;}.sbw-doc-cta.svelte-1d47278 {display:inline-flex;align-items:center;justify-content:center;padding:0 20px;border-left:1px solid #e4e7ec;font-size:11px;font-weight:600;letter-spacing:1.5px;text-transform:uppercase;color:var(--brand-navy, #16365b);}.sbw-doc-row.sbw-doc-can.svelte-1d47278:hover .sbw-doc-cta:where(.svelte-1d47278) {background:var(--brand-navy, #16365b);color:#fff;}\n /* 'dark' variant (Fox/Pevero): flush corners and a solid-ink CTA/done\n fill instead of navy. */.sbw-variant-dark.svelte-1d47278 .sbw-doc-row:where(.svelte-1d47278) {border-radius:0;}.sbw-variant-dark.svelte-1d47278 .sbw-doc-row.sbw-doc-done:where(.svelte-1d47278) {border-color:var(--brand-ink, #252525);background:var(--brand-ink, #252525);}.sbw-variant-dark.svelte-1d47278 .sbw-doc-row.sbw-doc-can:where(.svelte-1d47278) .sbw-doc-cta:where(.svelte-1d47278) {background:var(--brand-ink, #252525);color:#fff;}.sbw-variant-dark.svelte-1d47278 .sbw-doc-row.sbw-doc-can:where(.svelte-1d47278):hover .sbw-doc-cta:where(.svelte-1d47278) {background:var(--brand-gold, #c9a86b);color:var(--brand-ink, #252525);}.sbw-visually-hidden.svelte-1d47278 {position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);}"
5235
+ code: ".sbw-docs.svelte-1d47278 {display:flex;flex-direction:column;gap:12px;padding:20px;color:var(--brand-ink, #252525);}.sbw-docs-heading.svelte-1d47278 {font-size:11px;font-weight:600;letter-spacing:2px;text-transform:uppercase;color:#252525;}.sbw-docs-note.svelte-1d47278 {margin:0;font-size:13px;color:#666;line-height:1.6;}.sbw-docs-error.svelte-1d47278 {margin:0;font-size:14px;color:#cc4949;}.sbw-sailor.svelte-1d47278 {display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:12px 16px;border:1px solid #e4e7ec;border-radius:var(--sbw-radius, 10px);font-size:13px;}.sbw-sailor-email.svelte-1d47278 {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sbw-link.svelte-1d47278 {flex-shrink:0;padding:0;border:none;background:none;font:inherit;color:var(--brand-navy, #16365b);text-decoration:underline;cursor:pointer;}.sbw-auth-actions.svelte-1d47278 {display:flex;flex-wrap:wrap;gap:10px;}.sbw-auth-btn.svelte-1d47278 {height:48px;padding:0 24px;border-radius:var(--sbw-radius, 10px);border:1px solid rgba(37, 37, 37, 0.15);background:transparent;color:var(--brand-navy, #16365b);font-size:12px;font-weight:600;letter-spacing:2px;text-transform:uppercase;cursor:pointer;}.sbw-auth-btn.sbw-auth-primary.svelte-1d47278 {border:none;background:var(--brand-gold, #c9a86b);}.sbw-auth-btn.svelte-1d47278:hover {background:var(--brand-navy, #16365b);color:#fff;}.sbw-variant-dark.svelte-1d47278 .sbw-sailor:where(.svelte-1d47278),\r\n .sbw-variant-dark.svelte-1d47278 .sbw-auth-btn:where(.svelte-1d47278) {border-radius:0;}.sbw-variant-dark.svelte-1d47278 .sbw-auth-btn:where(.svelte-1d47278) {color:var(--brand-ink, #252525);}.sbw-variant-dark.svelte-1d47278 .sbw-auth-btn.sbw-auth-primary:where(.svelte-1d47278) {background:var(--brand-ink, #252525);color:#fff;}.sbw-variant-dark.svelte-1d47278 .sbw-auth-btn:where(.svelte-1d47278):hover {background:var(--brand-gold, #c9a86b);color:var(--brand-ink, #252525);}.sbw-doc-row.svelte-1d47278 {display:flex;align-items:stretch;border:1px solid #e4e7ec;border-radius:var(--sbw-radius, 10px);overflow:hidden;background:#fff;}.sbw-doc-row.sbw-doc-can.svelte-1d47278 {cursor:pointer;}\r\n /* The file input is visually hidden, so show keyboard focus on the row. */.sbw-doc-row.svelte-1d47278:focus-within {outline:2px solid var(--brand-navy, #16365b);outline-offset:2px;}.sbw-doc-row.sbw-doc-done.svelte-1d47278 {border-color:var(--brand-navy, #16365b);background:var(--brand-navy, #16365b);color:#fff;}.sbw-doc-row.sbw-doc-busy.svelte-1d47278 {cursor:not-allowed;}.sbw-doc-main.svelte-1d47278 {display:flex;align-items:center;gap:16px;flex:1;min-width:0;padding:16px;}.sbw-doc-icon.svelte-1d47278 {width:32px;height:32px;display:flex;align-items:center;justify-content:center;flex-shrink:0;}.sbw-doc-busy.svelte-1d47278 .sbw-doc-icon:where(.svelte-1d47278) {color:var(--brand-navy, #16365b);}.sbw-spin.svelte-1d47278 {\r\n animation: svelte-1d47278-sbw-spin 0.8s linear infinite;}\r\n @keyframes svelte-1d47278-sbw-spin {\r\n to {\r\n transform: rotate(360deg);\r\n }\r\n }.sbw-doc-text.svelte-1d47278 {min-width:0;flex:1;}.sbw-doc-name.svelte-1d47278 {font-size:16px;font-weight:600;}.sbw-doc-sub.svelte-1d47278 {font-size:13px;opacity:0.8;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sbw-doc-sub.sbw-doc-why.svelte-1d47278 {color:#cc4949;opacity:1;white-space:normal;}.sbw-required.svelte-1d47278 {color:#cc4949;}.sbw-doc-cta.svelte-1d47278 {display:inline-flex;align-items:center;justify-content:center;padding:0 20px;border-left:1px solid #e4e7ec;font-size:11px;font-weight:600;letter-spacing:1.5px;text-transform:uppercase;color:var(--brand-navy, #16365b);}.sbw-doc-row.sbw-doc-can.svelte-1d47278:hover .sbw-doc-cta:where(.svelte-1d47278) {background:var(--brand-navy, #16365b);color:#fff;}\r\n /* 'dark' variant (Fox/Pevero): flush corners and a solid-ink CTA/done\r\n fill instead of navy. */.sbw-variant-dark.svelte-1d47278 .sbw-doc-row:where(.svelte-1d47278) {border-radius:0;}.sbw-variant-dark.svelte-1d47278 .sbw-doc-row.sbw-doc-done:where(.svelte-1d47278) {border-color:var(--brand-ink, #252525);background:var(--brand-ink, #252525);}.sbw-variant-dark.svelte-1d47278 .sbw-doc-row.sbw-doc-can:where(.svelte-1d47278) .sbw-doc-cta:where(.svelte-1d47278) {background:var(--brand-ink, #252525);color:#fff;}.sbw-variant-dark.svelte-1d47278 .sbw-doc-row.sbw-doc-can:where(.svelte-1d47278):hover .sbw-doc-cta:where(.svelte-1d47278) {background:var(--brand-gold, #c9a86b);color:var(--brand-ink, #252525);}.sbw-visually-hidden.svelte-1d47278 {position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);}"
5232
5236
  };
5233
5237
  function ds(e, t) {
5234
5238
  Xe(t, !0), ri(e, us);
5235
- let n = $(t, "apiOrigin", 7), r = $(t, "slug", 7), i = $(t, "sailorApiOrigin", 7), a = $(t, "sidonOrigin", 7), o = $(t, "arrival", 7), s = $(t, "departure", 7), c = $(t, "labels", 7), l = $(t, "variant", 7), u = $(t, "complete", 15, !1), d = $(t, "sailor", 15, null), f = /* @__PURE__ */ B(!1), p = /* @__PURE__ */ B(!1), m = /* @__PURE__ */ B(null), h = /* @__PURE__ */ B(!0), g = /* @__PURE__ */ B(!1), _ = /* @__PURE__ */ B(on({})), v = /* @__PURE__ */ B(null), y = 0, b = !1, x = /* @__PURE__ */ I(() => (q(m)?.requirements.length ?? 0) > 0), S = /* @__PURE__ */ I(() => q(m)?.requirements.some((e) => e.mandatory && !e.met) ?? !1);
5239
+ let n = $(t, "apiOrigin", 7), r = $(t, "slug", 7), i = $(t, "sailorApiOrigin", 7), a = $(t, "sidonOrigin", 7), o = $(t, "arrival", 7), s = $(t, "departure", 7), c = $(t, "lang", 7), l = $(t, "labels", 7), u = $(t, "variant", 7), d = $(t, "complete", 15, !1), f = $(t, "sailor", 15, null), p = /* @__PURE__ */ B(!1), m = /* @__PURE__ */ B(!1), h = /* @__PURE__ */ B(null), g = /* @__PURE__ */ B(!0), _ = /* @__PURE__ */ B(!1), v = /* @__PURE__ */ B(on({})), y = /* @__PURE__ */ B(null), b = 0, x = !1, S = /* @__PURE__ */ I(() => (q(h)?.requirements.length ?? 0) > 0), ee = /* @__PURE__ */ I(() => q(h)?.requirements.some((e) => e.mandatory && !e.met) ?? !1);
5236
5240
  Tn(() => {
5237
- u(!!q(m) && !q(h) && !q(g) && Ga(q(m)));
5241
+ d(!!q(h) && !q(g) && !q(_) && Ga(q(h)));
5238
5242
  });
5239
- function ee() {
5243
+ function C() {
5240
5244
  let e = To(a());
5241
- return !e && d() && d(null), e?.token ?? null;
5245
+ return !e && f() && f(null), e?.token ?? null;
5242
5246
  }
5243
- async function C() {
5244
- let e = ++y, t = {
5247
+ async function w() {
5248
+ let e = ++b, t = {
5245
5249
  arrival: o(),
5246
5250
  departure: s()
5247
5251
  };
5248
- V(h, !0);
5252
+ V(g, !0);
5249
5253
  try {
5250
- let i = await Po(n(), r(), t, ee());
5251
- if (b || e !== y) return;
5252
- V(m, i), V(g, !1);
5254
+ let i = await Po(n(), r(), t, C());
5255
+ if (x || e !== b) return;
5256
+ V(h, i), V(_, !1);
5253
5257
  } catch {
5254
- if (b || e !== y) return;
5255
- V(g, !0);
5258
+ if (x || e !== b) return;
5259
+ V(_, !0);
5256
5260
  }
5257
- V(h, !1);
5261
+ V(g, !1);
5258
5262
  }
5259
5263
  {
5260
5264
  let e = To(a());
5261
- d(e && {
5265
+ f(e && {
5262
5266
  email: e.email,
5263
5267
  name: e.name
5264
5268
  });
5265
5269
  }
5266
5270
  Tn(() => {
5267
- o(), s(), J(() => void C());
5271
+ o(), s(), J(() => void w());
5268
5272
  }), Gr(() => () => {
5269
- b = !0;
5273
+ x = !0;
5270
5274
  });
5271
- async function w() {
5272
- V(p, !1), V(f, !0);
5275
+ async function T() {
5276
+ V(m, !1), V(p, !0);
5273
5277
  try {
5274
5278
  let e = await Do(a());
5275
- if (b || !e) return;
5276
- d({
5279
+ if (x || !e) return;
5280
+ f({
5277
5281
  email: e.email,
5278
5282
  name: e.name
5279
- }), await C();
5283
+ }), await w();
5280
5284
  } catch {
5281
- V(p, !0);
5285
+ V(m, !0);
5282
5286
  } finally {
5283
- V(f, !1);
5287
+ V(p, !1);
5284
5288
  }
5285
5289
  }
5286
- async function T() {
5287
- Eo(a()), d(null), await C();
5290
+ async function E() {
5291
+ Eo(a()), f(null), await w();
5288
5292
  }
5289
- function E(e, t) {
5290
- return e.type === "application/pdf" || !e.type && /\.pdf$/i.test(e.name) || t instanceof Error && /too large/i.test(t.message) ? c().uploadTooLarge : c().uploadBadType;
5293
+ function te(e) {
5294
+ if (e.met || !e.latest) return "";
5295
+ if (!e.latest.expiryDate) return l().docsStep.unreadable;
5296
+ let t = /* @__PURE__ */ new Date(`${e.latest.expiryDate}T00:00:00`);
5297
+ return l().docsStep.expiredOn(t.toLocaleDateString(c(), {
5298
+ day: "numeric",
5299
+ month: "short",
5300
+ year: "numeric"
5301
+ }));
5302
+ }
5303
+ function D(e, t) {
5304
+ return e.type === "application/pdf" || !e.type && /\.pdf$/i.test(e.name) || t instanceof Error && /too large/i.test(t.message) ? l().uploadTooLarge : l().uploadBadType;
5291
5305
  }
5292
- async function te(e, t) {
5306
+ async function O(e, t) {
5293
5307
  let n = t.currentTarget, r = n.files?.[0];
5294
5308
  if (n.value = "", r) {
5295
- V(v, null), V(_, {
5296
- ...q(_),
5309
+ V(y, null), V(v, {
5310
+ ...q(v),
5297
5311
  [e.id]: r.name
5298
5312
  }, !0);
5299
5313
  try {
5300
- let t = await Go(r).catch((e) => (V(v, E(r, e), !0), null));
5314
+ let t = await Go(r).catch((e) => (V(y, D(r, e), !0), null));
5301
5315
  if (!t) return;
5302
- let n = ee();
5316
+ let n = C();
5303
5317
  if (!n) throw Error("Signed out");
5304
5318
  await Bo(i(), n, {
5305
5319
  ...t,
5306
- type: e.type
5307
- }), await C();
5320
+ type: e.type,
5321
+ documentId: e.latest?.id
5322
+ }), await w();
5308
5323
  } catch (e) {
5309
- V(v, !(e instanceof Oo) || e.status < 400 ? c().uploadFailed : e.status === 401 ? c().docsStep.sessionRejected : e.status === 413 ? c().uploadTooLarge : e.status === 429 ? c().uploadLimit : e.message, !0);
5324
+ V(y, !(e instanceof Oo) || e.status < 400 ? l().uploadFailed : e.status === 401 ? l().docsStep.sessionRejected : e.status === 413 ? l().uploadTooLarge : e.status === 429 ? l().uploadLimit : e.message, !0);
5310
5325
  } finally {
5311
- let { [e.id]: t, ...n } = q(_);
5312
- V(_, n, !0);
5326
+ let { [e.id]: t, ...n } = q(v);
5327
+ V(v, n, !0);
5313
5328
  }
5314
5329
  }
5315
5330
  }
5316
- var D = {
5331
+ var ne = {
5317
5332
  get apiOrigin() {
5318
5333
  return n();
5319
5334
  },
@@ -5350,83 +5365,89 @@ function ds(e, t) {
5350
5365
  set departure(e) {
5351
5366
  s(e), z();
5352
5367
  },
5353
- get labels() {
5368
+ get lang() {
5354
5369
  return c();
5355
5370
  },
5356
- set labels(e) {
5371
+ set lang(e) {
5357
5372
  c(e), z();
5358
5373
  },
5359
- get variant() {
5374
+ get labels() {
5360
5375
  return l();
5361
5376
  },
5362
- set variant(e) {
5377
+ set labels(e) {
5363
5378
  l(e), z();
5364
5379
  },
5365
- get complete() {
5380
+ get variant() {
5366
5381
  return u();
5367
5382
  },
5368
- set complete(e = !1) {
5383
+ set variant(e) {
5369
5384
  u(e), z();
5370
5385
  },
5371
- get sailor() {
5386
+ get complete() {
5372
5387
  return d();
5373
5388
  },
5374
- set sailor(e = null) {
5389
+ set complete(e = !1) {
5375
5390
  d(e), z();
5391
+ },
5392
+ get sailor() {
5393
+ return f();
5394
+ },
5395
+ set sailor(e = null) {
5396
+ f(e), z();
5376
5397
  }
5377
- }, O = ls();
5378
- let ne;
5379
- var k = H(O), re = H(k, !0);
5380
- P(k);
5381
- var ie = U(k, 2), ae = (e) => {
5398
+ }, k = ls();
5399
+ let re;
5400
+ var ie = H(k), ae = H(ie, !0);
5401
+ P(ie);
5402
+ var oe = U(ie, 2), A = (e) => {
5382
5403
  var t = Ko(), n = H(t), r = H(n), i = U(r), a = H(i, !0);
5383
5404
  P(i), P(n);
5384
5405
  var o = U(n, 2), s = H(o, !0);
5385
5406
  P(o), P(t), W(() => {
5386
- Z(r, `${c().docsStep.signedInAs ?? ""} `), Z(a, d().email), Z(s, c().docsStep.notYou);
5387
- }), Cr("click", o, T), X(e, t);
5407
+ Z(r, `${l().docsStep.signedInAs ?? ""} `), Z(a, f().email), Z(s, l().docsStep.notYou);
5408
+ }), Cr("click", o, E), X(e, t);
5388
5409
  };
5389
- Q(ie, (e) => {
5390
- d() && e(ae);
5410
+ Q(oe, (e) => {
5411
+ f() && e(A);
5391
5412
  });
5392
- var oe = U(ie, 2), A = (e) => {
5413
+ var se = U(oe, 2), ce = (e) => {
5393
5414
  var t = Nr(), n = hn(t), r = (e) => {
5394
5415
  var t = qo(), n = H(t, !0);
5395
- P(t), W(() => Z(n, c().docsStep.loading)), X(e, t);
5416
+ P(t), W(() => Z(n, l().docsStep.loading)), X(e, t);
5396
5417
  };
5397
5418
  Q(n, (e) => {
5398
- q(g) || e(r);
5419
+ q(_) || e(r);
5399
5420
  }), X(e, t);
5400
- }, se = (e) => {
5421
+ }, le = (e) => {
5401
5422
  var t = Jo(), n = hn(t), r = H(n, !0);
5402
5423
  P(n);
5403
5424
  var i = U(n, 2), a = (e) => {
5404
5425
  var t = qo(), n = H(t, !0);
5405
- P(t), W(() => Z(n, c().docsStep.optionalSignIn)), X(e, t);
5426
+ P(t), W(() => Z(n, l().docsStep.optionalSignIn)), X(e, t);
5406
5427
  };
5407
5428
  Q(i, (e) => {
5408
- d() || e(a);
5409
- }), W(() => Z(r, c().docsStep.noDocsNeeded)), X(e, t);
5410
- }, ce = (e) => {
5429
+ f() || e(a);
5430
+ }), W(() => Z(r, l().docsStep.noDocsNeeded)), X(e, t);
5431
+ }, ue = (e) => {
5411
5432
  var t = os(), n = hn(t), r = (e) => {
5412
5433
  var t = qo(), n = H(t, !0);
5413
- P(t), W(() => Z(n, c().docsStep.intro)), X(e, t);
5434
+ P(t), W(() => Z(n, l().docsStep.intro)), X(e, t);
5414
5435
  };
5415
5436
  Q(n, (e) => {
5416
- d() || e(r);
5437
+ f() || e(r);
5417
5438
  });
5418
5439
  var i = U(n, 2);
5419
- Xr(i, 17, () => q(m).requirements, (e) => e.id, (e, t) => {
5420
- let n = /* @__PURE__ */ I(() => q(_)[q(t).id]), r = /* @__PURE__ */ I(() => !!d() && q(m).uploadsAvailable && !q(t).met && !q(n));
5421
- var i = Nr();
5422
- ni(hn(i), () => q(r) ? "label" : "div", !1, (e, i) => {
5423
- let a;
5424
- W(() => a = ui(e, 0, "sbw-doc-row svelte-1d47278", null, a, {
5440
+ Xr(i, 17, () => q(h).requirements, (e) => e.id, (e, t) => {
5441
+ let n = /* @__PURE__ */ I(() => q(v)[q(t).id]), r = /* @__PURE__ */ I(() => !!f() && q(h).uploadsAvailable && !q(t).met && !q(n)), i = /* @__PURE__ */ I(() => f() && !q(n) ? te(q(t)) : "");
5442
+ var a = Nr();
5443
+ ni(hn(a), () => q(r) ? "label" : "div", !1, (e, a) => {
5444
+ let o;
5445
+ W(() => o = ui(e, 0, "sbw-doc-row svelte-1d47278", null, o, {
5425
5446
  "sbw-doc-can": q(r),
5426
5447
  "sbw-doc-busy": !!q(n),
5427
- "sbw-doc-done": !!d() && q(t).met && !q(n)
5448
+ "sbw-doc-done": !!f() && q(t).met && !q(n)
5428
5449
  }));
5429
- var o = rs(), s = hn(o), l = H(s), u = (e) => {
5450
+ var s = rs(), c = hn(s), u = H(c), d = (e) => {
5430
5451
  var r = Qo(), i = H(r), a = (e) => {
5431
5452
  X(e, Yo());
5432
5453
  }, o = (e) => {
@@ -5438,85 +5459,89 @@ function ds(e, t) {
5438
5459
  q(n) ? e(a) : q(t).met ? e(o, 1) : e(s, -1);
5439
5460
  }), P(r), X(e, r);
5440
5461
  };
5441
- Q(l, (e) => {
5442
- d() && e(u);
5462
+ Q(u, (e) => {
5463
+ f() && e(d);
5443
5464
  });
5444
- var f = U(l, 2), p = H(f), m = H(p, !0), h = U(m), g = (e) => {
5465
+ var p = U(u, 2), m = H(p), h = H(m, !0), g = U(h), _ = (e) => {
5445
5466
  X(e, $o());
5446
5467
  };
5447
- Q(h, (e) => {
5448
- q(t).mandatory && e(g);
5449
- }), P(p);
5450
- var _ = U(p, 2), v = (e) => {
5451
- var i = es(), a = H(i, !0);
5452
- P(i), W(() => Z(a, q(n) ? `${c().uploading} ${q(n)}` : q(t).met ? c().docsStep.inAccount : q(r) ? c().tapToUpload : "")), X(e, i);
5468
+ Q(g, (e) => {
5469
+ q(t).mandatory && e(_);
5470
+ }), P(m);
5471
+ var v = U(m, 2), y = (e) => {
5472
+ var a = es();
5473
+ let o;
5474
+ var s = H(a, !0);
5475
+ P(a), W(() => {
5476
+ o = ui(a, 1, "sbw-doc-sub svelte-1d47278", null, o, { "sbw-doc-why": !!q(i) }), Z(s, q(n) ? `${l().uploading} ${q(n)}` : q(t).met ? l().docsStep.inAccount : q(i) || (q(r) ? l().tapToUpload : ""));
5477
+ }), X(e, a);
5453
5478
  };
5454
- Q(_, (e) => {
5455
- d() && e(v);
5456
- }), P(f), P(s);
5457
- var y = U(s, 2), b = (e) => {
5479
+ Q(v, (e) => {
5480
+ f() && e(y);
5481
+ }), P(p), P(c);
5482
+ var b = U(c, 2), x = (e) => {
5458
5483
  var t = ts(), r = H(t, !0);
5459
- P(t), W(() => Z(r, q(n) ? c().uploading : c().upload)), X(e, t);
5484
+ P(t), W(() => Z(r, q(n) ? l().uploading : l().upload)), X(e, t);
5460
5485
  };
5461
- Q(y, (e) => {
5462
- (q(r) || q(n)) && e(b);
5486
+ Q(b, (e) => {
5487
+ (q(r) || q(n)) && e(x);
5463
5488
  });
5464
- var x = U(y, 2), S = (e) => {
5489
+ var S = U(b, 2), ee = (e) => {
5465
5490
  var n = ns();
5466
- Cr("change", n, (e) => te(q(t), e)), X(e, n);
5491
+ Cr("change", n, (e) => O(q(t), e)), X(e, n);
5467
5492
  };
5468
- Q(x, (e) => {
5469
- q(r) && e(S);
5470
- }), W(() => Z(m, q(t).name)), X(i, o);
5471
- }), X(e, i);
5493
+ Q(S, (e) => {
5494
+ q(r) && e(ee);
5495
+ }), W(() => Z(h, q(t).name)), X(a, s);
5496
+ }), X(e, a);
5472
5497
  });
5473
5498
  var a = U(i, 2), o = (e) => {
5474
5499
  var t = is(), n = H(t, !0);
5475
- P(t), W(() => Z(n, q(v))), X(e, t);
5500
+ P(t), W(() => Z(n, q(y))), X(e, t);
5476
5501
  };
5477
5502
  Q(a, (e) => {
5478
- q(v) && e(o);
5503
+ q(y) && e(o);
5479
5504
  });
5480
- var s = U(a, 2), l = (e) => {
5505
+ var s = U(a, 2), c = (e) => {
5481
5506
  var t = as(), n = H(t, !0);
5482
- P(t), W(() => Z(n, c().docsStep.uploadsUnavailable)), X(e, t);
5507
+ P(t), W(() => Z(n, l().docsStep.uploadsUnavailable)), X(e, t);
5483
5508
  };
5484
5509
  Q(s, (e) => {
5485
- d() && !q(m).uploadsAvailable && q(S) && e(l);
5510
+ f() && !q(h).uploadsAvailable && q(ee) && e(c);
5486
5511
  }), X(e, t);
5487
5512
  };
5488
- Q(oe, (e) => {
5489
- q(m) ? q(x) ? e(ce, -1) : e(se, 1) : e(A);
5513
+ Q(se, (e) => {
5514
+ q(h) ? q(S) ? e(ue, -1) : e(le, 1) : e(ce);
5490
5515
  });
5491
- var le = U(oe, 2), ue = (e) => {
5516
+ var de = U(se, 2), fe = (e) => {
5492
5517
  var t = ss(), n = hn(t), r = H(n, !0);
5493
5518
  P(n);
5494
5519
  var i = U(n, 2), a = H(i, !0);
5495
5520
  P(i), W(() => {
5496
- Z(r, c().docsStep.statusFailed), Z(a, c().retry);
5497
- }), Cr("click", i, () => C()), X(e, t);
5521
+ Z(r, l().docsStep.statusFailed), Z(a, l().retry);
5522
+ }), Cr("click", i, () => w()), X(e, t);
5498
5523
  };
5499
- Q(le, (e) => {
5500
- q(g) && e(ue);
5524
+ Q(de, (e) => {
5525
+ q(_) && e(fe);
5501
5526
  });
5502
- var de = U(le, 2), fe = (e) => {
5527
+ var pe = U(de, 2), me = (e) => {
5503
5528
  var t = cs(), n = hn(t), r = H(n), i = H(r, !0);
5504
5529
  P(r), P(n);
5505
5530
  var a = U(n, 2), o = (e) => {
5506
5531
  var t = as(), n = H(t, !0);
5507
- P(t), W(() => Z(n, c().docsStep.signInUnavailable)), X(e, t);
5532
+ P(t), W(() => Z(n, l().docsStep.signInUnavailable)), X(e, t);
5508
5533
  };
5509
5534
  Q(a, (e) => {
5510
- q(p) && e(o);
5535
+ q(m) && e(o);
5511
5536
  }), W(() => {
5512
- r.disabled = q(f), Z(i, c().docsStep.signIn);
5513
- }), Cr("click", r, w), X(e, t);
5537
+ r.disabled = q(p), Z(i, l().docsStep.signIn);
5538
+ }), Cr("click", r, T), X(e, t);
5514
5539
  };
5515
- return Q(de, (e) => {
5516
- q(m) && !d() && e(fe);
5517
- }), P(O), W(() => {
5518
- ne = ui(O, 1, "sbw-docs svelte-1d47278", null, ne, { "sbw-variant-dark": l() === "dark" }), Z(re, c().documentsHeading);
5519
- }), X(e, O), Ze(D);
5540
+ return Q(pe, (e) => {
5541
+ q(h) && !f() && e(me);
5542
+ }), P(k), W(() => {
5543
+ re = ui(k, 1, "sbw-docs svelte-1d47278", null, re, { "sbw-variant-dark": u() === "dark" }), Z(ae, l().documentsHeading);
5544
+ }), X(e, k), Ze(ne);
5520
5545
  }
5521
5546
  wr(["click", "change"]), Pi(ds, {
5522
5547
  apiOrigin: {},
@@ -5525,6 +5550,7 @@ wr(["click", "change"]), Pi(ds, {
5525
5550
  sidonOrigin: {},
5526
5551
  arrival: {},
5527
5552
  departure: {},
5553
+ lang: {},
5528
5554
  labels: {},
5529
5555
  variant: {},
5530
5556
  complete: {},
@@ -5760,6 +5786,8 @@ var hs = {
5760
5786
  signedInAs: "Accesso come",
5761
5787
  notYou: "Non sei tu?",
5762
5788
  inAccount: "Nel tuo account Sidon",
5789
+ expiredOn: (e) => `Scaduto il ${e}: carica un documento valido per il soggiorno`,
5790
+ unreadable: "Non riusciamo a leggere la data di scadenza: carica una copia più nitida",
5763
5791
  loading: "Verifica dei documenti…",
5764
5792
  statusFailed: "Impossibile verificare i tuoi documenti. Riprova.",
5765
5793
  uploadsUnavailable: "Il caricamento dei documenti non è disponibile al momento, quindi non è possibile proseguire. Riprova più tardi.",
@@ -5898,6 +5926,8 @@ var hs = {
5898
5926
  signedInAs: "Signed in as",
5899
5927
  notYou: "Not you?",
5900
5928
  inAccount: "In your Sidon account",
5929
+ expiredOn: (e) => `Expired ${e}: upload one valid for your stay`,
5930
+ unreadable: "We couldn't read an expiry date: upload a clearer copy",
5901
5931
  loading: "Checking your documents…",
5902
5932
  statusFailed: "Could not check your documents. Please try again.",
5903
5933
  uploadsUnavailable: "Document uploads are unavailable right now, so this booking can't continue. Please try again later.",
@@ -6036,6 +6066,8 @@ var hs = {
6036
6066
  signedInAs: "Connecté en tant que",
6037
6067
  notYou: "Ce n'est pas vous ?",
6038
6068
  inAccount: "Dans votre compte Sidon",
6069
+ expiredOn: (e) => `Expiré le ${e} : envoyez un document valide pour le séjour`,
6070
+ unreadable: "Nous n'arrivons pas à lire la date d'expiration : envoyez une copie plus nette",
6039
6071
  loading: "Vérification de vos documents…",
6040
6072
  statusFailed: "Impossible de vérifier vos documents. Réessayez.",
6041
6073
  uploadsUnavailable: "L'envoi de documents est indisponible pour le moment : impossible de continuer. Réessayez plus tard.",
@@ -6174,6 +6206,8 @@ var hs = {
6174
6206
  signedInAs: "Sesión iniciada como",
6175
6207
  notYou: "¿No eres tú?",
6176
6208
  inAccount: "En tu cuenta Sidon",
6209
+ expiredOn: (e) => `Caducado el ${e}: sube uno válido para tu estancia`,
6210
+ unreadable: "No podemos leer la fecha de caducidad: sube una copia más nítida",
6177
6211
  loading: "Comprobando tus documentos…",
6178
6212
  statusFailed: "No se han podido comprobar tus documentos. Inténtalo de nuevo.",
6179
6213
  uploadsUnavailable: "La subida de documentos no está disponible ahora mismo, así que no se puede continuar. Inténtalo más tarde.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgebuild/sidon-booking-widget",
3
- "version": "3.0.1",
3
+ "version": "4.0.0",
4
4
  "description": "Berth booking and berth map custom elements for marinas on OTA, plus an Astro forwarder route and server client.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",