@syncfy/authentication-widget 2.1.2 → 2.2.1

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.
@@ -7,9 +7,9 @@ import { object, boolean, string, number, lazy, array, mixed, ValidationError }
7
7
  import { JWE, JWS, JWK } from "node-jose";
8
8
  import Rollbar from "rollbar";
9
9
  import Money from "v-money3";
10
- import { defineComponent, openBlock, createElementBlock, createElementVNode, createCommentVNode, onMounted, normalizeClass, createBlock, toDisplayString, inject, ref, reactive, unref, withCtx, createVNode, Fragment, renderList, createTextVNode, computed, watch, withDirectives, vShow, withModifiers, onBeforeUnmount, createSlots, nextTick, renderSlot, toRaw, normalizeStyle, isRef, provide, h, onUpdated, mergeProps, createApp } from "vue";
10
+ import { defineComponent, openBlock, createElementBlock, createElementVNode, createCommentVNode, onMounted, normalizeClass, createBlock, toDisplayString, inject, ref, reactive, unref, withCtx, createVNode, Fragment, renderList, createTextVNode, computed, watch, withDirectives, vShow, nextTick, withModifiers, onBeforeUnmount, createSlots, renderSlot, toRaw, normalizeStyle, isRef, provide, h, onUpdated, mergeProps, createApp } from "vue";
11
11
  import { useI18n, createI18n } from "vue-i18n";
12
- import { ElForm, ElFormItem, ElCheckboxGroup, ElCheckbox, ElStatistic, ElSelect, ElOption, ElInput, ElAlert, ElMenu, ElMenuItem, ElSwitch, ElDatePicker, ElButton, ElLink, vLoading, ElNotification, ElConfigProvider } from "element-plus";
12
+ import { ElForm, ElFormItem, ElCheckboxGroup, ElCheckbox, ElStatistic, ElInput, ElSelect, ElOption, ElAlert, ElMenu, ElMenuItem, ElSwitch, ElDatePicker, ElButton, ElLink, vLoading, ElNotification, ElConfigProvider } from "element-plus";
13
13
  import en from "element-plus/dist/locale/en.mjs";
14
14
  import es from "element-plus/dist/locale/es.mjs";
15
15
  import "element-plus/es/components/checkbox-group/style/css";
@@ -2464,6 +2464,7 @@ const configValidator = object().noUnknown().shape({
2464
2464
  displayBusinessSites: boolean(),
2465
2465
  displayCredentialInModal: boolean(),
2466
2466
  displayErrorsInToast: boolean(),
2467
+ displayFullSiteList: boolean(),
2467
2468
  displayLogoImages: boolean(),
2468
2469
  displayLongDescription: boolean(),
2469
2470
  displayPersonalSites: boolean(),
@@ -2584,9 +2585,9 @@ const paramsValidator = object().shape({
2584
2585
  }).strict().noUnknown();
2585
2586
  let __VERSION__ = {
2586
2587
  "git": {
2587
- "hash": "gd5878a2",
2588
+ "hash": "g689b636",
2588
2589
  "distance": 0,
2589
- "tag": "v2.1.2"
2590
+ "tag": "v2.2.1"
2590
2591
  }
2591
2592
  };
2592
2593
  function getVersion() {
@@ -3678,21 +3679,21 @@ function getSantanderWebSocketScript() {
3678
3679
  };
3679
3680
  });
3680
3681
  }
3681
- const _hoisted_1$c = {
3682
+ const _hoisted_1$d = {
3682
3683
  key: 0,
3683
3684
  width: "30",
3684
3685
  height: "28",
3685
3686
  fill: "none",
3686
3687
  xmlns: "http://www.w3.org/2000/svg"
3687
3688
  };
3688
- const _hoisted_2$a = {
3689
+ const _hoisted_2$b = {
3689
3690
  key: 1,
3690
3691
  xmlns: "http://www.w3.org/2000/svg",
3691
3692
  width: "23",
3692
3693
  height: "23",
3693
3694
  fill: "none"
3694
3695
  };
3695
- const _hoisted_3$7 = {
3696
+ const _hoisted_3$8 = {
3696
3697
  key: 2,
3697
3698
  xmlns: "http://www.w3.org/2000/svg",
3698
3699
  viewBox: "0 0 50 50"
@@ -3770,7 +3771,7 @@ const _hoisted_11 = {
3770
3771
  "stroke-width": "1.5",
3771
3772
  "xmlns:v": "https://vecta.io/nano"
3772
3773
  };
3773
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
3774
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
3774
3775
  __name: "CustomIcon",
3775
3776
  props: {
3776
3777
  icon: {}
@@ -3778,7 +3779,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3778
3779
  setup(__props) {
3779
3780
  const props = __props;
3780
3781
  return (_ctx, _cache) => {
3781
- return props.icon === "back" ? (openBlock(), createElementBlock("svg", _hoisted_1$c, _cache[0] || (_cache[0] = [
3782
+ return props.icon === "back" ? (openBlock(), createElementBlock("svg", _hoisted_1$d, _cache[0] || (_cache[0] = [
3782
3783
  createElementVNode("path", {
3783
3784
  d: "M2 14.219h26.5M2 13.781 13.781 2M2 14.219 13.781 26",
3784
3785
  stroke: "#000",
@@ -3786,7 +3787,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3786
3787
  "stroke-linecap": "round",
3787
3788
  "stroke-linejoin": "round"
3788
3789
  }, null, -1)
3789
- ]))) : props.icon === "close" ? (openBlock(), createElementBlock("svg", _hoisted_2$a, _cache[1] || (_cache[1] = [
3790
+ ]))) : props.icon === "close" ? (openBlock(), createElementBlock("svg", _hoisted_2$b, _cache[1] || (_cache[1] = [
3790
3791
  createElementVNode("path", {
3791
3792
  d: "m2 2 18.738 18.738M2.12 21.107 20.857 2.37",
3792
3793
  stroke: "#000",
@@ -3794,7 +3795,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3794
3795
  "stroke-linecap": "round",
3795
3796
  "stroke-linejoin": "round"
3796
3797
  }, null, -1)
3797
- ]))) : props.icon === "error" ? (openBlock(), createElementBlock("svg", _hoisted_3$7, _cache[2] || (_cache[2] = [
3798
+ ]))) : props.icon === "error" ? (openBlock(), createElementBlock("svg", _hoisted_3$8, _cache[2] || (_cache[2] = [
3798
3799
  createElementVNode("circle", {
3799
3800
  cx: "25",
3800
3801
  cy: "25",
@@ -3865,8 +3866,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3865
3866
  };
3866
3867
  }
3867
3868
  });
3868
- const _hoisted_1$b = ["src"];
3869
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
3869
+ const _hoisted_1$c = ["src"];
3870
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3870
3871
  __name: "AppLoader",
3871
3872
  props: {
3872
3873
  avatar: { default: void 0 },
@@ -3913,8 +3914,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3913
3914
  width: "1",
3914
3915
  height: "1",
3915
3916
  onLoad: _cache[0] || (_cache[0] = () => emit("imagesLoaded"))
3916
- }, null, 40, _hoisted_1$b)) : createCommentVNode("", true),
3917
- _ctx.icon ? (openBlock(), createBlock(_sfc_main$i, {
3917
+ }, null, 40, _hoisted_1$c)) : createCommentVNode("", true),
3918
+ _ctx.icon ? (openBlock(), createBlock(_sfc_main$j, {
3918
3919
  key: 1,
3919
3920
  icon: _ctx.icon
3920
3921
  }, null, 8, ["icon"])) : createCommentVNode("", true)
@@ -3939,7 +3940,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3939
3940
  }
3940
3941
  });
3941
3942
  const loader = "pb-w-sync_loader";
3942
- const style0$g = {
3943
+ const style0$h = {
3943
3944
  loader,
3944
3945
  "loader-container-animation": "pb-w-sync_loader-container-animation",
3945
3946
  "loader-clip-animation": "pb-w-sync_loader-clip-animation",
@@ -3964,12 +3965,12 @@ const _export_sfc = (sfc, props) => {
3964
3965
  }
3965
3966
  return target;
3966
3967
  };
3967
- const cssModules$g = {
3968
- "$style": style0$g
3968
+ const cssModules$h = {
3969
+ "$style": style0$h
3969
3970
  };
3970
- const AppLoader = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__cssModules", cssModules$g]]);
3971
- const _hoisted_1$a = ["disabled"];
3972
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
3971
+ const AppLoader = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__cssModules", cssModules$h]]);
3972
+ const _hoisted_1$b = ["disabled"];
3973
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3973
3974
  __name: "AccountsSelection",
3974
3975
  props: {
3975
3976
  avatar: { default: void 0 },
@@ -4163,7 +4164,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
4163
4164
  "data-testid": "accounts-button",
4164
4165
  disabled: _ctx.buttonDisabledStyle && isInvalid.value,
4165
4166
  type: "submit"
4166
- }, toDisplayString(unref(t)("accounts_selection.done")), 9, _hoisted_1$a)
4167
+ }, toDisplayString(unref(t)("accounts_selection.done")), 9, _hoisted_1$b)
4167
4168
  ]),
4168
4169
  _: 1
4169
4170
  }, 8, ["class", "autocomplete", "disabled", "model", "rules"])),
@@ -4182,7 +4183,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
4182
4183
  };
4183
4184
  }
4184
4185
  });
4185
- const style0$f = {
4186
+ const style0$g = {
4186
4187
  "accounts-balance": "pb-w-sync_accounts-balance",
4187
4188
  "accounts-checkbox": "pb-w-sync_accounts-checkbox",
4188
4189
  "accounts-checkbox-content": "pb-w-sync_accounts-checkbox-content",
@@ -4193,11 +4194,11 @@ const style0$f = {
4193
4194
  "accounts-selection": "pb-w-sync_accounts-selection",
4194
4195
  "accounts-api-error": "pb-w-sync_accounts-api-error"
4195
4196
  };
4196
- const cssModules$f = {
4197
- "$style": style0$f
4197
+ const cssModules$g = {
4198
+ "$style": style0$g
4198
4199
  };
4199
- const AccountsSelection = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__cssModules", cssModules$f]]);
4200
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
4200
+ const AccountsSelection = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__cssModules", cssModules$g]]);
4201
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
4201
4202
  __name: "FinalResponse",
4202
4203
  props: {
4203
4204
  avatar: {},
@@ -4243,127 +4244,21 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
4243
4244
  };
4244
4245
  }
4245
4246
  });
4246
- const style0$e = {
4247
+ const style0$f = {
4247
4248
  "final-response-container": "pb-w-sync_final-response-container"
4248
4249
  };
4249
- const cssModules$e = {
4250
- "$style": style0$e
4251
- };
4252
- const FinalResponse = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__cssModules", cssModules$e]]);
4253
- const _hoisted_1$9 = ["src"];
4254
- const _hoisted_2$9 = ["src"];
4255
- const _hoisted_3$6 = ["onClick"];
4256
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
4257
- __name: "InstitutionFilters",
4258
- props: {
4259
- countryId: {},
4260
- filteredCountries: {},
4261
- filteredOrganizationTypes: {},
4262
- showCountries: { type: Boolean },
4263
- organizationTypeId: {},
4264
- selectClass: {}
4265
- },
4266
- emits: ["update:countryId", "update:organizationTypeId"],
4267
- setup(__props, { emit: __emit }) {
4268
- const props = __props;
4269
- const emit = __emit;
4270
- const { t } = useI18n();
4271
- const selectedCountryFlag = computed(
4272
- () => countryFlag(
4273
- props.filteredCountries.find(
4274
- (country) => country.id_country === props.countryId
4275
- )
4276
- )
4277
- );
4278
- function countryChanged(id_country) {
4279
- measureEvent("open_country", {
4280
- id_country
4281
- });
4282
- emit("update:countryId", id_country);
4283
- }
4284
- function countryFlag(country) {
4285
- return `https://hatscripts.github.io/circle-flags/flags/${country.code.toLocaleLowerCase()}.svg`;
4286
- }
4287
- function selectOrganizationType(id) {
4288
- measureEvent("open_site_organization_type", {
4289
- id_site_organization_type: id
4290
- });
4291
- emit("update:organizationTypeId", id);
4292
- }
4293
- return (_ctx, _cache) => {
4294
- return openBlock(), createElementBlock(Fragment, null, [
4295
- createElementVNode("p", {
4296
- class: normalizeClass(_ctx.$style["institution-filters-intro"])
4297
- }, toDisplayString(unref(t)("common.intro")), 3),
4298
- _ctx.showCountries ? (openBlock(), createBlock(unref(ElSelect), {
4299
- key: 0,
4300
- class: normalizeClass(_ctx.$style["widget-country"]),
4301
- "model-value": props.countryId,
4302
- "popper-class": props.selectClass,
4303
- onChange: countryChanged
4304
- }, {
4305
- prefix: withCtx(() => [
4306
- createElementVNode("img", {
4307
- src: selectedCountryFlag.value,
4308
- width: "44",
4309
- height: "44",
4310
- alt: ""
4311
- }, null, 8, _hoisted_1$9)
4312
- ]),
4313
- default: withCtx(() => [
4314
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filteredCountries, (country) => {
4315
- return openBlock(), createBlock(unref(ElOption), {
4316
- key: country.id_country,
4317
- class: normalizeClass(_ctx.$style["widget-country-option"]),
4318
- value: country.id_country,
4319
- label: country.name
4320
- }, {
4321
- default: withCtx(() => [
4322
- createElementVNode("img", {
4323
- src: countryFlag(country),
4324
- width: "44",
4325
- height: "44",
4326
- alt: ""
4327
- }, null, 8, _hoisted_2$9),
4328
- createElementVNode("span", null, toDisplayString(country.name), 1)
4329
- ]),
4330
- _: 2
4331
- }, 1032, ["class", "value", "label"]);
4332
- }), 128))
4333
- ]),
4334
- _: 1
4335
- }, 8, ["class", "model-value", "popper-class"])) : createCommentVNode("", true),
4336
- createElementVNode("div", {
4337
- class: normalizeClass(_ctx.$style["organization-types-list"])
4338
- }, [
4339
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filteredOrganizationTypes, (organizationType) => {
4340
- return openBlock(), createElementBlock("button", {
4341
- key: organizationType.id_site_organization_type,
4342
- onClick: () => selectOrganizationType(organizationType.id_site_organization_type)
4343
- }, toDisplayString(unref(t)(`common.${organizationType.label}`)), 9, _hoisted_3$6);
4344
- }), 128))
4345
- ], 2)
4346
- ], 64);
4347
- };
4348
- }
4349
- });
4350
- const style0$d = {
4351
- "institution-filters-intro": "pb-w-sync_institution-filters-intro",
4352
- "organization-types-list": "pb-w-sync_organization-types-list",
4353
- "widget-country": "pb-w-sync_widget-country",
4354
- "widget-country-option": "pb-w-sync_widget-country-option"
4355
- };
4356
- const cssModules$d = {
4357
- "$style": style0$d
4250
+ const cssModules$f = {
4251
+ "$style": style0$f
4358
4252
  };
4359
- const InstitutionFilters = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__cssModules", cssModules$d]]);
4360
- const _hoisted_1$8 = ["onClick"];
4361
- const _hoisted_2$8 = ["alt", "src"];
4362
- const _hoisted_3$5 = { key: 1 };
4363
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
4253
+ const FinalResponse = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__cssModules", cssModules$f]]);
4254
+ const _hoisted_1$a = ["onClick"];
4255
+ const _hoisted_2$a = ["alt", "src"];
4256
+ const _hoisted_3$7 = { key: 1 };
4257
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
4364
4258
  __name: "OrganizationSitesList",
4365
4259
  props: {
4366
4260
  assetsPath: { default: "https://s.paybook.com" },
4261
+ embedded: { type: Boolean, default: false },
4367
4262
  items: { default: () => [] },
4368
4263
  showLogo: { type: Boolean, default: true },
4369
4264
  showPlaidSitesButton: { type: Boolean, default: false }
@@ -4386,7 +4281,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4386
4281
  });
4387
4282
  });
4388
4283
  onMounted(() => {
4389
- if (props.items.length > 0 && props.showLogo) {
4284
+ if (!props.embedded && props.items.length > 0 && props.showLogo) {
4390
4285
  imagesLoaded = 0;
4391
4286
  rootEmit("images-loading");
4392
4287
  }
@@ -4394,7 +4289,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4394
4289
  watch(
4395
4290
  () => props.items,
4396
4291
  (val) => {
4397
- if (val.length > 0 && props.showLogo) {
4292
+ if (!props.embedded && val.length > 0 && props.showLogo) {
4398
4293
  imagesLoaded = 0;
4399
4294
  rootEmit("images-loading");
4400
4295
  }
@@ -4402,7 +4297,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4402
4297
  );
4403
4298
  function imageLoaded() {
4404
4299
  imagesLoaded++;
4405
- if (imagesLoaded === props.items.length) {
4300
+ if (!props.embedded && imagesLoaded === props.items.length) {
4406
4301
  rootEmit("images-loaded");
4407
4302
  }
4408
4303
  }
@@ -4419,17 +4314,18 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4419
4314
  onClick: _cache[0] || (_cache[0] = () => unref(rootEmit)("__internal__.plaid-sites-clicked"))
4420
4315
  }, toDisplayString(unref(t)("common.find_your_institution")), 1)
4421
4316
  ], 2)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
4422
- createVNode(unref(ElInput), {
4317
+ !_ctx.embedded ? (openBlock(), createBlock(unref(ElInput), {
4318
+ key: 0,
4423
4319
  modelValue: searchQuery.value,
4424
4320
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => searchQuery.value = $event),
4425
4321
  "data-testid": "search-organization",
4426
4322
  placeholder: unref(t)("common.search")
4427
4323
  }, {
4428
4324
  prefix: withCtx(() => [
4429
- createVNode(_sfc_main$i, { icon: "search" })
4325
+ createVNode(_sfc_main$j, { icon: "search" })
4430
4326
  ]),
4431
4327
  _: 1
4432
- }, 8, ["modelValue", "placeholder"]),
4328
+ }, 8, ["modelValue", "placeholder"])) : createCommentVNode("", true),
4433
4329
  createElementVNode("div", {
4434
4330
  class: normalizeClass(_ctx.$style["organization-sites"])
4435
4331
  }, [
@@ -4448,8 +4344,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4448
4344
  height: "66",
4449
4345
  width: "220",
4450
4346
  onLoad: imageLoaded
4451
- }, null, 40, _hoisted_2$8)) : (openBlock(), createElementBlock("span", _hoisted_3$5, toDisplayString(item.name), 1))
4452
- ], 10, _hoisted_1$8)), [
4347
+ }, null, 40, _hoisted_2$a)) : (openBlock(), createElementBlock("span", _hoisted_3$7, toDisplayString(item.name), 1))
4348
+ ], 10, _hoisted_1$a)), [
4453
4349
  [vShow, item.show]
4454
4350
  ]);
4455
4351
  }), 128))
@@ -4458,15 +4354,333 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4458
4354
  };
4459
4355
  }
4460
4356
  });
4461
- const style0$c = {
4357
+ const style0$e = {
4462
4358
  "widget-plaid-container": "pb-w-sync_widget-plaid-container",
4463
4359
  "organization-sites": "pb-w-sync_organization-sites",
4464
4360
  "organization-button": "pb-w-sync_organization-button"
4465
4361
  };
4362
+ const cssModules$e = {
4363
+ "$style": style0$e
4364
+ };
4365
+ const OrganizationSitesList = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__cssModules", cssModules$e]]);
4366
+ function countryFlagUrl(country2) {
4367
+ return `https://hatscripts.github.io/circle-flags/flags/${country2.code.toLocaleLowerCase()}.svg`;
4368
+ }
4369
+ function orderCountries(countries, requestedCountry) {
4370
+ const first = requestedCountry ? countries.find(
4371
+ (country2) => country2.code === requestedCountry || country2.id_country === requestedCountry
4372
+ ) : void 0;
4373
+ return first ? [first, ...countries.filter((country2) => country2 !== first)] : countries;
4374
+ }
4375
+ function buildSiteCatalog(countries, organizationTypesOf, organizationSitesOf, categoryLabel) {
4376
+ return countries.map((country2) => ({
4377
+ country: country2,
4378
+ categories: organizationTypesOf(country2.id_country).map((organizationType) => ({
4379
+ organizationType,
4380
+ organizationSites: organizationSitesOf(
4381
+ country2.id_country,
4382
+ organizationType.id_site_organization_type
4383
+ )
4384
+ })).filter((category) => category.organizationSites.length).sort(
4385
+ (a, b) => categoryLabel(a.organizationType).localeCompare(
4386
+ categoryLabel(b.organizationType)
4387
+ )
4388
+ )
4389
+ })).filter((entry) => entry.categories.length);
4390
+ }
4391
+ function searchSiteCatalog(catalog, search2) {
4392
+ const query = search2.toLocaleLowerCase();
4393
+ if (!query) {
4394
+ return catalog;
4395
+ }
4396
+ return catalog.map((entry) => ({
4397
+ ...entry,
4398
+ categories: entry.categories.map((category) => ({
4399
+ ...category,
4400
+ organizationSites: category.organizationSites.filter(
4401
+ (item) => item.name.toLocaleLowerCase().includes(query)
4402
+ )
4403
+ })).filter((category) => category.organizationSites.length)
4404
+ })).filter((entry) => entry.categories.length);
4405
+ }
4406
+ const _hoisted_1$9 = ["aria-expanded", "disabled", "onClick"];
4407
+ const _hoisted_2$9 = ["src"];
4408
+ const _hoisted_3$6 = ["aria-expanded", "disabled", "onClick"];
4409
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4410
+ __name: "FullSiteList",
4411
+ props: {
4412
+ assetsPath: {},
4413
+ catalog: {},
4414
+ search: { default: "" },
4415
+ showLogo: { type: Boolean, default: true }
4416
+ },
4417
+ emits: ["select", "update:search"],
4418
+ setup(__props, { emit: __emit }) {
4419
+ const props = __props;
4420
+ const emit = __emit;
4421
+ const { t } = useI18n();
4422
+ const visibleCatalog = computed(
4423
+ () => searchSiteCatalog(props.catalog, props.search)
4424
+ );
4425
+ const collapsed = reactive(/* @__PURE__ */ new Set());
4426
+ const searching = computed(() => !!props.search);
4427
+ function categoryKey(entry, category) {
4428
+ return `${entry.country.id_country}:${category.organizationType.id_site_organization_type}`;
4429
+ }
4430
+ function isOpen(key) {
4431
+ return searching.value || !collapsed.has(key);
4432
+ }
4433
+ function scrollParent(element) {
4434
+ let node = element.parentElement;
4435
+ while (node && !["auto", "scroll"].includes(getComputedStyle(node).overflowY)) {
4436
+ node = node.parentElement;
4437
+ }
4438
+ return node;
4439
+ }
4440
+ async function toggle2(key, event2) {
4441
+ if (!collapsed.has(key)) {
4442
+ const heading = event2.currentTarget.parentElement;
4443
+ const section = heading.parentElement;
4444
+ const scroller = scrollParent(section);
4445
+ const offset = heading.getBoundingClientRect().top - section.getBoundingClientRect().top;
4446
+ collapsed.add(key);
4447
+ if (scroller && offset > 0) {
4448
+ const scrollTop = scroller.scrollTop;
4449
+ await nextTick();
4450
+ scroller.scrollTop = scrollTop - offset;
4451
+ }
4452
+ return;
4453
+ }
4454
+ collapsed.delete(key);
4455
+ }
4456
+ return (_ctx, _cache) => {
4457
+ return openBlock(), createElementBlock("div", null, [
4458
+ createElementVNode("div", {
4459
+ class: normalizeClass(_ctx.$style["search"])
4460
+ }, [
4461
+ createVNode(unref(ElInput), {
4462
+ "data-testid": "search-organization",
4463
+ "model-value": props.search,
4464
+ placeholder: unref(t)("common.search"),
4465
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = (value) => emit("update:search", value))
4466
+ }, {
4467
+ prefix: withCtx(() => [
4468
+ createVNode(_sfc_main$j, { icon: "search" })
4469
+ ]),
4470
+ _: 1
4471
+ }, 8, ["model-value", "placeholder"])
4472
+ ], 2),
4473
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleCatalog.value, (entry) => {
4474
+ return openBlock(), createElementBlock("section", {
4475
+ key: entry.country.id_country,
4476
+ "data-testid": "full-site-list-country"
4477
+ }, [
4478
+ createElementVNode("h2", {
4479
+ class: normalizeClass(_ctx.$style["country"])
4480
+ }, [
4481
+ createElementVNode("button", {
4482
+ type: "button",
4483
+ class: normalizeClass(_ctx.$style["toggle"]),
4484
+ "aria-expanded": isOpen(entry.country.id_country),
4485
+ disabled: searching.value,
4486
+ "data-testid": "full-site-list-toggle",
4487
+ onClick: (event2) => toggle2(entry.country.id_country, event2)
4488
+ }, [
4489
+ createElementVNode("img", {
4490
+ class: normalizeClass(_ctx.$style["flag"]),
4491
+ src: unref(countryFlagUrl)(entry.country),
4492
+ width: "20",
4493
+ height: "20",
4494
+ alt: ""
4495
+ }, null, 10, _hoisted_2$9),
4496
+ createElementVNode("span", null, toDisplayString(entry.country.name), 1),
4497
+ !searching.value ? (openBlock(), createElementBlock("svg", {
4498
+ key: 0,
4499
+ class: normalizeClass(_ctx.$style["caret"]),
4500
+ viewBox: "0 0 10 10",
4501
+ "aria-hidden": "true"
4502
+ }, _cache[2] || (_cache[2] = [
4503
+ createElementVNode("path", { d: "M1 3h8L5 8z" }, null, -1)
4504
+ ]), 2)) : createCommentVNode("", true)
4505
+ ], 10, _hoisted_1$9)
4506
+ ], 2),
4507
+ (openBlock(true), createElementBlock(Fragment, null, renderList(entry.categories, (category) => {
4508
+ return withDirectives((openBlock(), createElementBlock("section", {
4509
+ key: category.organizationType.id_site_organization_type,
4510
+ "data-testid": "full-site-list-category"
4511
+ }, [
4512
+ createElementVNode("h3", {
4513
+ class: normalizeClass(_ctx.$style["category-title"])
4514
+ }, [
4515
+ createElementVNode("button", {
4516
+ type: "button",
4517
+ class: normalizeClass(_ctx.$style["toggle"]),
4518
+ "aria-expanded": isOpen(categoryKey(entry, category)),
4519
+ disabled: searching.value,
4520
+ "data-testid": "full-site-list-toggle",
4521
+ onClick: (event2) => toggle2(categoryKey(entry, category), event2)
4522
+ }, [
4523
+ createElementVNode("span", null, toDisplayString(unref(t)(`common.${category.organizationType.label}`)), 1),
4524
+ !searching.value ? (openBlock(), createElementBlock("svg", {
4525
+ key: 0,
4526
+ class: normalizeClass(_ctx.$style["caret"]),
4527
+ viewBox: "0 0 10 10",
4528
+ "aria-hidden": "true"
4529
+ }, _cache[3] || (_cache[3] = [
4530
+ createElementVNode("path", { d: "M1 3h8L5 8z" }, null, -1)
4531
+ ]), 2)) : createCommentVNode("", true)
4532
+ ], 10, _hoisted_3$6)
4533
+ ], 2),
4534
+ withDirectives(createElementVNode("div", {
4535
+ class: normalizeClass(_ctx.$style["category-sites"])
4536
+ }, [
4537
+ createVNode(OrganizationSitesList, {
4538
+ "assets-path": props.assetsPath,
4539
+ embedded: "",
4540
+ items: category.organizationSites,
4541
+ "show-logo": props.showLogo,
4542
+ onSelect: _cache[1] || (_cache[1] = (item) => emit("select", item))
4543
+ }, null, 8, ["assets-path", "items", "show-logo"])
4544
+ ], 2), [
4545
+ [vShow, isOpen(categoryKey(entry, category))]
4546
+ ])
4547
+ ])), [
4548
+ [vShow, isOpen(entry.country.id_country)]
4549
+ ]);
4550
+ }), 128))
4551
+ ]);
4552
+ }), 128)),
4553
+ !visibleCatalog.value.length ? (openBlock(), createElementBlock("p", {
4554
+ key: 0,
4555
+ class: normalizeClass(_ctx.$style["no-results"])
4556
+ }, toDisplayString(unref(t)("common.no_filtered_data")), 3)) : createCommentVNode("", true)
4557
+ ]);
4558
+ };
4559
+ }
4560
+ });
4561
+ const search = "pb-w-sync_search";
4562
+ const country = "pb-w-sync_country";
4563
+ const toggle = "pb-w-sync_toggle";
4564
+ const caret = "pb-w-sync_caret";
4565
+ const flag = "pb-w-sync_flag";
4566
+ const style0$d = {
4567
+ search,
4568
+ country,
4569
+ "category-title": "pb-w-sync_category-title",
4570
+ toggle,
4571
+ caret,
4572
+ flag,
4573
+ "category-sites": "pb-w-sync_category-sites",
4574
+ "no-results": "pb-w-sync_no-results"
4575
+ };
4576
+ const cssModules$d = {
4577
+ "$style": style0$d
4578
+ };
4579
+ const FullSiteList = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__cssModules", cssModules$d]]);
4580
+ const _hoisted_1$8 = ["src"];
4581
+ const _hoisted_2$8 = ["src"];
4582
+ const _hoisted_3$5 = ["onClick"];
4583
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4584
+ __name: "InstitutionFilters",
4585
+ props: {
4586
+ countryId: {},
4587
+ filteredCountries: {},
4588
+ filteredOrganizationTypes: {},
4589
+ showCountries: { type: Boolean },
4590
+ organizationTypeId: {},
4591
+ selectClass: {}
4592
+ },
4593
+ emits: ["update:countryId", "update:organizationTypeId"],
4594
+ setup(__props, { emit: __emit }) {
4595
+ const props = __props;
4596
+ const emit = __emit;
4597
+ const { t } = useI18n();
4598
+ const selectedCountryFlag = computed(
4599
+ () => countryFlagUrl(
4600
+ props.filteredCountries.find(
4601
+ (country2) => country2.id_country === props.countryId
4602
+ )
4603
+ )
4604
+ );
4605
+ function countryChanged(id_country) {
4606
+ measureEvent("open_country", {
4607
+ id_country
4608
+ });
4609
+ emit("update:countryId", id_country);
4610
+ }
4611
+ function selectOrganizationType(id) {
4612
+ measureEvent("open_site_organization_type", {
4613
+ id_site_organization_type: id
4614
+ });
4615
+ emit("update:organizationTypeId", id);
4616
+ }
4617
+ return (_ctx, _cache) => {
4618
+ return openBlock(), createElementBlock(Fragment, null, [
4619
+ createElementVNode("p", {
4620
+ class: normalizeClass(_ctx.$style["institution-filters-intro"])
4621
+ }, toDisplayString(unref(t)("common.intro")), 3),
4622
+ _ctx.showCountries ? (openBlock(), createBlock(unref(ElSelect), {
4623
+ key: 0,
4624
+ class: normalizeClass(_ctx.$style["widget-country"]),
4625
+ "model-value": props.countryId,
4626
+ "popper-class": props.selectClass,
4627
+ onChange: countryChanged
4628
+ }, {
4629
+ prefix: withCtx(() => [
4630
+ createElementVNode("img", {
4631
+ src: selectedCountryFlag.value,
4632
+ width: "44",
4633
+ height: "44",
4634
+ alt: ""
4635
+ }, null, 8, _hoisted_1$8)
4636
+ ]),
4637
+ default: withCtx(() => [
4638
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filteredCountries, (country2) => {
4639
+ return openBlock(), createBlock(unref(ElOption), {
4640
+ key: country2.id_country,
4641
+ class: normalizeClass(_ctx.$style["widget-country-option"]),
4642
+ value: country2.id_country,
4643
+ label: country2.name
4644
+ }, {
4645
+ default: withCtx(() => [
4646
+ createElementVNode("img", {
4647
+ src: unref(countryFlagUrl)(country2),
4648
+ width: "44",
4649
+ height: "44",
4650
+ alt: ""
4651
+ }, null, 8, _hoisted_2$8),
4652
+ createElementVNode("span", null, toDisplayString(country2.name), 1)
4653
+ ]),
4654
+ _: 2
4655
+ }, 1032, ["class", "value", "label"]);
4656
+ }), 128))
4657
+ ]),
4658
+ _: 1
4659
+ }, 8, ["class", "model-value", "popper-class"])) : createCommentVNode("", true),
4660
+ createElementVNode("div", {
4661
+ class: normalizeClass(_ctx.$style["organization-types-list"])
4662
+ }, [
4663
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filteredOrganizationTypes, (organizationType) => {
4664
+ return openBlock(), createElementBlock("button", {
4665
+ key: organizationType.id_site_organization_type,
4666
+ onClick: () => selectOrganizationType(organizationType.id_site_organization_type)
4667
+ }, toDisplayString(unref(t)(`common.${organizationType.label}`)), 9, _hoisted_3$5);
4668
+ }), 128))
4669
+ ], 2)
4670
+ ], 64);
4671
+ };
4672
+ }
4673
+ });
4674
+ const style0$c = {
4675
+ "institution-filters-intro": "pb-w-sync_institution-filters-intro",
4676
+ "organization-types-list": "pb-w-sync_organization-types-list",
4677
+ "widget-country": "pb-w-sync_widget-country",
4678
+ "widget-country-option": "pb-w-sync_widget-country-option"
4679
+ };
4466
4680
  const cssModules$c = {
4467
4681
  "$style": style0$c
4468
4682
  };
4469
- const OrganizationSitesList = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__cssModules", cssModules$c]]);
4683
+ const InstitutionFilters = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__cssModules", cssModules$c]]);
4470
4684
  const _hoisted_1$7 = { key: 0 };
4471
4685
  const _hoisted_2$7 = ["src"];
4472
4686
  const _hoisted_3$4 = ["src"];
@@ -4531,15 +4745,15 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
4531
4745
  createElementVNode("h1", null, toDisplayString(props.client.name ? unref(t)("privacy.title_client", { client: props.client.name }) : unref(t)("privacy.title")), 1),
4532
4746
  createElementVNode("ul", null, [
4533
4747
  createElementVNode("li", null, [
4534
- createVNode(_sfc_main$i, { icon: "files" }),
4748
+ createVNode(_sfc_main$j, { icon: "files" }),
4535
4749
  createTextVNode(" " + toDisplayString(unref(t)("privacy.list.first")), 1)
4536
4750
  ]),
4537
4751
  createElementVNode("li", null, [
4538
- createVNode(_sfc_main$i, { icon: "lock" }),
4752
+ createVNode(_sfc_main$j, { icon: "lock" }),
4539
4753
  createTextVNode(" " + toDisplayString(unref(t)("privacy.list.second")), 1)
4540
4754
  ]),
4541
4755
  createElementVNode("li", null, [
4542
- createVNode(_sfc_main$i, { icon: "users" }),
4756
+ createVNode(_sfc_main$j, { icon: "users" }),
4543
4757
  createTextVNode(" " + toDisplayString(unref(t)("privacy.list.third")), 1)
4544
4758
  ])
4545
4759
  ]),
@@ -4588,7 +4802,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4588
4802
  const emit = __emit;
4589
4803
  const { t } = useI18n();
4590
4804
  const segments = computed(() => parseConsentText(props.consent));
4591
- function toggle(event2) {
4805
+ function toggle2(event2) {
4592
4806
  emit("update:modelValue", event2.target.checked);
4593
4807
  }
4594
4808
  return (_ctx, _cache) => {
@@ -4604,7 +4818,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4604
4818
  checked: props.modelValue,
4605
4819
  "data-testid": "consent-checkbox",
4606
4820
  type: "checkbox",
4607
- onChange: toggle
4821
+ onChange: toggle2
4608
4822
  }, null, 40, _hoisted_1$6),
4609
4823
  createElementVNode("span", {
4610
4824
  class: normalizeClass(_ctx.$style["consent-text"]),
@@ -4777,7 +4991,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4777
4991
  class: normalizeClass(_ctx.$style["widget-back-button"]),
4778
4992
  onClick: _cache[0] || (_cache[0] = ($event) => remove($event))
4779
4993
  }, [
4780
- createVNode(_sfc_main$i, { icon: "x-circle" })
4994
+ createVNode(_sfc_main$j, { icon: "x-circle" })
4781
4995
  ], 10, _hoisted_2$5)
4782
4996
  ], 2)) : (openBlock(), createElementBlock("button", {
4783
4997
  key: 1,
@@ -4911,7 +5125,9 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4911
5125
  });
4912
5126
  const { t } = useI18n();
4913
5127
  onBeforeUnmount(() => {
5128
+ var _a;
4914
5129
  clearTimeout(testModeTimeout);
5130
+ (_a = props.site) == null ? void 0 : _a.removeListener("status-update", onStatusUpdate);
4915
5131
  });
4916
5132
  onMounted(() => {
4917
5133
  if (props.showLogo) {
@@ -4919,14 +5135,21 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4919
5135
  }
4920
5136
  focusFirstInput();
4921
5137
  validateChanged();
4922
- props.site.on("status-update", (newStatus) => {
4923
- if (newStatus === "loading") {
4924
- loading.value = true;
4925
- } else {
4926
- loading.value = false;
4927
- }
4928
- });
5138
+ props.site.on("status-update", onStatusUpdate);
4929
5139
  });
5140
+ watch(
5141
+ () => props.site,
5142
+ (newSite, oldSite) => {
5143
+ oldSite == null ? void 0 : oldSite.removeListener("status-update", onStatusUpdate);
5144
+ if (newSite) {
5145
+ newSite.on("status-update", onStatusUpdate);
5146
+ loading.value = newSite.status === "loading";
5147
+ }
5148
+ }
5149
+ );
5150
+ function onStatusUpdate(newStatus) {
5151
+ loading.value = newStatus === "loading";
5152
+ }
4930
5153
  function disabledDate(time) {
4931
5154
  return time.getTime() > Date.now();
4932
5155
  }
@@ -5211,10 +5434,10 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
5211
5434
  showPassword.value = !showPassword.value;
5212
5435
  })
5213
5436
  }, [
5214
- showPassword.value ? (openBlock(), createBlock(_sfc_main$i, {
5437
+ showPassword.value ? (openBlock(), createBlock(_sfc_main$j, {
5215
5438
  key: 0,
5216
5439
  icon: "eye-slash"
5217
- })) : (openBlock(), createBlock(_sfc_main$i, {
5440
+ })) : (openBlock(), createBlock(_sfc_main$j, {
5218
5441
  key: 1,
5219
5442
  icon: "eye"
5220
5443
  }))
@@ -5821,10 +6044,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
5821
6044
  isRef(showPassword) ? showPassword.value = !unref(showPassword) : showPassword = !unref(showPassword);
5822
6045
  })
5823
6046
  }, [
5824
- !unref(showPassword) ? (openBlock(), createBlock(_sfc_main$i, {
6047
+ !unref(showPassword) ? (openBlock(), createBlock(_sfc_main$j, {
5825
6048
  key: 0,
5826
6049
  icon: "eye"
5827
- })) : (openBlock(), createBlock(_sfc_main$i, {
6050
+ })) : (openBlock(), createBlock(_sfc_main$j, {
5828
6051
  key: 1,
5829
6052
  icon: "eye-slash"
5830
6053
  }))
@@ -8254,6 +8477,7 @@ class SiteBase extends EventEmitter {
8254
8477
  __publicField(this, "socketOpened", false);
8255
8478
  __publicField(this, "socketTimeoutAfterError");
8256
8479
  __publicField(this, "timer", null);
8480
+ __publicField(this, "disposed", false);
8257
8481
  this.httpService = httpService;
8258
8482
  this.userConfig = userConfig;
8259
8483
  this.config = site;
@@ -8312,6 +8536,16 @@ class SiteBase extends EventEmitter {
8312
8536
  toggleTestMode() {
8313
8537
  this.testMode = !this.testMode;
8314
8538
  }
8539
+ // Called when the widget drops this connection, so a stale timer or socket cannot act on a later login.
8540
+ dispose() {
8541
+ this.disposed = true;
8542
+ this.clearTimer();
8543
+ this.removeAllListeners();
8544
+ if (this.socket) {
8545
+ this.socket.onclose = this.socket.onerror = this.socket.onmessage = null;
8546
+ this.socket.close();
8547
+ }
8548
+ }
8315
8549
  configuredMeasureEvent(eventAction, params) {
8316
8550
  if (!this.userConfig.isHeadless) {
8317
8551
  measureEvent(eventAction, params);
@@ -8373,6 +8607,9 @@ class SiteBase extends EventEmitter {
8373
8607
  return _rules;
8374
8608
  }
8375
8609
  setSocket(url) {
8610
+ if (this.disposed) {
8611
+ return;
8612
+ }
8376
8613
  this.socket = new WebSocket(url);
8377
8614
  this.socket.onclose = (event2) => this.reopenSocket(event2);
8378
8615
  this.socket.onerror = () => this.socketError();
@@ -8389,6 +8626,9 @@ class SiteBase extends EventEmitter {
8389
8626
  return Object.keys(cleanOptions).length ? { options: { ...cleanOptions } } : {};
8390
8627
  }
8391
8628
  startTimer() {
8629
+ if (this.disposed) {
8630
+ return;
8631
+ }
8392
8632
  this.timer = setTimeout(() => {
8393
8633
  this.socketTimeout();
8394
8634
  }, this.userConfig.socketTimeoutTime);
@@ -8406,7 +8646,9 @@ class SiteBase extends EventEmitter {
8406
8646
  this.socketTimeoutAfterError = (/* @__PURE__ */ new Date()).getTime() + 12e4;
8407
8647
  this.setSocket(this.response.ws);
8408
8648
  const intervalHandler = setInterval(() => {
8409
- if (!this.isSocketOpen) {
8649
+ if (this.disposed) {
8650
+ clearInterval(intervalHandler);
8651
+ } else if (!this.isSocketOpen) {
8410
8652
  if ((/* @__PURE__ */ new Date()).getTime() < this.socketTimeoutAfterError) {
8411
8653
  this.socket.close();
8412
8654
  this.setSocket(this.response.ws);
@@ -8725,6 +8967,7 @@ class Credential extends EventEmitter {
8725
8967
  __publicField(this, "socketOpened", false);
8726
8968
  __publicField(this, "socketTimeoutAfterError");
8727
8969
  __publicField(this, "timer", null);
8970
+ __publicField(this, "disposed", false);
8728
8971
  this.syncService = syncService;
8729
8972
  this.httpService = httpService;
8730
8973
  this.socketTimeoutTime = socketTimeoutTime;
@@ -8821,6 +9064,16 @@ class Credential extends EventEmitter {
8821
9064
  setOption(name, value) {
8822
9065
  this.options[name] = value;
8823
9066
  }
9067
+ // Called when the widget drops this credential, so a stale timer or socket cannot act on a later flow.
9068
+ dispose() {
9069
+ this.disposed = true;
9070
+ this.clearTimer();
9071
+ this.removeAllListeners();
9072
+ if (this.socket) {
9073
+ this.socket.onclose = this.socket.onerror = this.socket.onmessage = null;
9074
+ this.socket.close();
9075
+ }
9076
+ }
8824
9077
  sync() {
8825
9078
  this.configuredMeasureEvent("sync_credential", {
8826
9079
  id_credential: this.config.id_credential,
@@ -8938,7 +9191,9 @@ class Credential extends EventEmitter {
8938
9191
  this.socketTimeoutAfterError = (/* @__PURE__ */ new Date()).getTime() + 12e4;
8939
9192
  this.setSocket(this.response.ws);
8940
9193
  const intervalHandler = setInterval(() => {
8941
- if (!this.isSocketOpen) {
9194
+ if (this.disposed) {
9195
+ clearInterval(intervalHandler);
9196
+ } else if (!this.isSocketOpen) {
8942
9197
  if ((/* @__PURE__ */ new Date()).getTime() < this.socketTimeoutAfterError) {
8943
9198
  this.socket.close();
8944
9199
  this.setSocket(this.response.ws);
@@ -8955,6 +9210,9 @@ class Credential extends EventEmitter {
8955
9210
  }
8956
9211
  }
8957
9212
  setSocket(url) {
9213
+ if (this.disposed) {
9214
+ return;
9215
+ }
8958
9216
  this.socket = new WebSocket(url);
8959
9217
  this.socket.onclose = (event2) => this.reopenSocket(event2);
8960
9218
  this.socket.onerror = () => this.socketError();
@@ -9067,6 +9325,9 @@ class Credential extends EventEmitter {
9067
9325
  return Object.keys(cleanOptions).length ? { options: { ...cleanOptions } } : {};
9068
9326
  }
9069
9327
  startTimer() {
9328
+ if (this.disposed) {
9329
+ return;
9330
+ }
9070
9331
  this.timer = setTimeout(() => {
9071
9332
  this.socketTimeout();
9072
9333
  }, this.socketTimeoutTime);
@@ -9629,14 +9890,25 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
9629
9890
  const { t } = useI18n();
9630
9891
  const loading = ref(false);
9631
9892
  onMounted(() => {
9632
- props.site.on("status-update", (newStatus) => {
9633
- if (newStatus === "loading") {
9634
- loading.value = true;
9635
- } else {
9636
- loading.value = false;
9637
- }
9638
- });
9893
+ props.site.on("status-update", onStatusUpdate);
9894
+ });
9895
+ onBeforeUnmount(() => {
9896
+ var _a;
9897
+ (_a = props.site) == null ? void 0 : _a.removeListener("status-update", onStatusUpdate);
9639
9898
  });
9899
+ watch(
9900
+ () => props.site,
9901
+ (newSite, oldSite) => {
9902
+ oldSite == null ? void 0 : oldSite.removeListener("status-update", onStatusUpdate);
9903
+ if (newSite) {
9904
+ newSite.on("status-update", onStatusUpdate);
9905
+ loading.value = newSite.status === "loading";
9906
+ }
9907
+ }
9908
+ );
9909
+ function onStatusUpdate(newStatus) {
9910
+ loading.value = newStatus === "loading";
9911
+ }
9640
9912
  return (_ctx, _cache) => {
9641
9913
  return openBlock(), createElementBlock("div", {
9642
9914
  class: normalizeClass(_ctx.$style["back-up-connection"])
@@ -9712,6 +9984,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9712
9984
  locale: {},
9713
9985
  navigation: {},
9714
9986
  refreshTokenFunction: { type: Function },
9987
+ requestedCountry: {},
9715
9988
  strict: {},
9716
9989
  token: {}
9717
9990
  },
@@ -9722,9 +9995,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9722
9995
  const rootEmit = inject(rootEmitter);
9723
9996
  const { t, locale } = useI18n({ useScope: "global" });
9724
9997
  const { mobile } = useMobile();
9725
- const countries = ref([]), countryId = ref(null), credentialFlow = ref(null), consent = ref(null), consentLoading = ref(false), dataError = ref(false), displayBackUpConnection = ref(false), finalLongMessage = ref(null), finalMessage = ref(null), fromBackUpConnection = ref(null), infoLongMessage = ref(""), infoMessage = ref(""), inPrivacyPolicy = ref(props.navigation.displayPrivacyScreen), loading = ref(true), noFilteredData = ref(false), organizationSiteId = ref(null), organizationSites = ref([]), organizationTypeId = ref(null), selectingAccounts = ref(false), siteStatus = ref(null), siteFormError = ref(null), updatingCredential = ref(false), visible = ref(false);
9998
+ const countries = ref([]), countryId = ref(null), credentialFlow = ref(null), consent = ref(null), consentLoading = ref(false), dataError = ref(false), displayBackUpConnection = ref(false), finalLongMessage = ref(null), finalMessage = ref(null), fullSiteListSearch = ref(""), fromBackUpConnection = ref(null), infoLongMessage = ref(""), infoMessage = ref(""), inPrivacyPolicy = ref(props.navigation.displayPrivacyScreen), loading = ref(true), noFilteredData = ref(false), organizationSiteId = ref(null), organizationSites = ref([]), organizationTypeId = ref(null), selectingAccounts = ref(false), siteStatus = ref(null), siteFormError = ref(null), updatingCredential = ref(false), visible = ref(false), widgetContent = ref(null);
9726
9999
  const consentCache = /* @__PURE__ */ new Map();
9727
- let assetsPath = "https://s.paybook.com", credential = null, gitVersion = `${getVersion()}${props.strict ? "-strict" : ""}`, infoNotification = null, notificationUpdater, openCredentialToast = null, organizationTypes = [], site = null, siteRaw = null, sync = null;
10000
+ let assetsPath = "https://s.paybook.com", credential = null, fullSiteListScrollTop = 0, gitVersion = `${getVersion()}${props.strict ? "-strict" : ""}`, infoNotification = null, notificationUpdater, openCredentialToast = null, organizationTypes = [], site = null, siteRaw = null, sync = null;
9728
10001
  const backUpSite = computed(() => {
9729
10002
  var _a;
9730
10003
  return ((_a = credentialFlow.value) == null ? void 0 : _a.displayBackUpConnection) || displayBackUpConnection.value ? site : null;
@@ -9749,8 +10022,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9749
10022
  }
9750
10023
  return props.navigation.enableBackNavigation && siteStatus.value === "start";
9751
10024
  }), filteredCountries = computed(() => {
9752
- return countries.value.filter((country) => {
9753
- return (country.id_country === "51ad44db3b8e77631200047d" || country.id_country === "51ad44793b8e77631200027a") && props.internal.plaidSites || filterOrganizationTypes(country.id_country).length;
10025
+ return countries.value.filter((country2) => {
10026
+ return (country2.id_country === "51ad44db3b8e77631200047d" || country2.id_country === "51ad44793b8e77631200027a") && props.internal.plaidSites || filterOrganizationTypes(country2.id_country).length;
9754
10027
  }).sort((a, b) => {
9755
10028
  return a.name.localeCompare(b.name);
9756
10029
  });
@@ -9764,6 +10037,20 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9764
10037
  organizationTypeId.value,
9765
10038
  organizationSiteId.value
9766
10039
  );
10040
+ }), fullSiteCatalog = computed(() => {
10041
+ if (!props.navigation.displayFullSiteList) {
10042
+ return [];
10043
+ }
10044
+ return buildSiteCatalog(
10045
+ props.navigation.hideSelectCountry ? filteredCountries.value.filter(
10046
+ (country2) => country2.id_country === countryId.value
10047
+ ) : orderCountries(filteredCountries.value, props.requestedCountry),
10048
+ filterOrganizationTypes,
10049
+ filterOrganizationSites,
10050
+ (organizationType) => t(`common.${organizationType.label}`)
10051
+ );
10052
+ }), fullSiteListOnScreen = computed(() => {
10053
+ return visible.value && !inPrivacyPolicy.value && !loading.value && !credentialFlow.value && !siteStatus.value && !organizationSiteId.value && props.navigation.displayFullSiteList;
9767
10054
  }), loaderMessage = computed(() => {
9768
10055
  return { short: infoMessage.value, long: infoLongMessage.value };
9769
10056
  }), sitesMap = computed(() => {
@@ -9803,6 +10090,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9803
10090
  }
9804
10091
  return "";
9805
10092
  } else {
10093
+ if (props.navigation.displayFullSiteList) {
10094
+ return t("common.header.select");
10095
+ }
9806
10096
  if (!organizationTypeId.value) {
9807
10097
  return t("common.header.link");
9808
10098
  }
@@ -9860,6 +10150,29 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9860
10150
  loadData();
9861
10151
  }
9862
10152
  );
10153
+ watch(
10154
+ () => props.navigation.displayFullSiteList,
10155
+ () => {
10156
+ if (!siteStatus.value) {
10157
+ organizationTypeId.value = organizationSiteId.value = null;
10158
+ }
10159
+ }
10160
+ );
10161
+ watch(fullSiteListOnScreen, (onScreen) => {
10162
+ if (!onScreen && widgetContent.value) {
10163
+ fullSiteListScrollTop = widgetContent.value.scrollTop;
10164
+ }
10165
+ nextTick(() => {
10166
+ if (widgetContent.value) {
10167
+ widgetContent.value.scrollTop = onScreen ? fullSiteListScrollTop : 0;
10168
+ }
10169
+ });
10170
+ });
10171
+ watch(fullSiteListSearch, () => {
10172
+ if (widgetContent.value) {
10173
+ widgetContent.value.scrollTop = 0;
10174
+ }
10175
+ });
9863
10176
  watch(infoMessage, (short) => {
9864
10177
  if (infoNotification) {
9865
10178
  notificationUpdater.updateMessages({ short });
@@ -9899,7 +10212,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9899
10212
  onBack: () => {
9900
10213
  rootEmit("back");
9901
10214
  closeInfoNotification();
9902
- site = siteStatus.value = null;
10215
+ dropSite();
9903
10216
  selectSite(siteRaw, false);
9904
10217
  visible.value = true;
9905
10218
  },
@@ -9943,6 +10256,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9943
10256
  rootEmit("dom-updated");
9944
10257
  });
9945
10258
  });
10259
+ onBeforeUnmount(() => {
10260
+ closeInfoNotification();
10261
+ dropSite();
10262
+ credential == null ? void 0 : credential.dispose();
10263
+ });
9946
10264
  onUpdated(() => {
9947
10265
  nextTick(() => {
9948
10266
  rootEmit("dom-updated");
@@ -9976,7 +10294,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9976
10294
  measureEvent("close");
9977
10295
  visible.value = false;
9978
10296
  if (siteStatus.value === "start" || siteStatus.value === "finish") {
9979
- siteStatus.value = site = null;
10297
+ dropSite();
9980
10298
  }
9981
10299
  rootEmit("closed");
9982
10300
  }
@@ -10102,6 +10420,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10102
10420
  });
10103
10421
  }
10104
10422
  });
10423
+ function dropSite() {
10424
+ site == null ? void 0 : site.dispose();
10425
+ siteStatus.value = site = null;
10426
+ }
10105
10427
  function emitApiError(error2, errorTranslationCore) {
10106
10428
  rootEmit("api-error", error2.response ? error2.response.status : 500, {
10107
10429
  longMessage: t(`${errorTranslationCore}real.long_description`),
@@ -10261,6 +10583,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10261
10583
  rootEmit("back");
10262
10584
  }
10263
10585
  organizationSiteId.value = null;
10586
+ if (props.navigation.displayFullSiteList) {
10587
+ organizationTypeId.value = null;
10588
+ return;
10589
+ }
10264
10590
  if (filteredOrganizationSites.value.length === 1) {
10265
10591
  organizationTypeBack(false);
10266
10592
  }
@@ -10276,13 +10602,18 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10276
10602
  }
10277
10603
  function privacyPolicyAccepted() {
10278
10604
  inPrivacyPolicy.value = false;
10279
- if ((filteredCountries.value.length === 1 || props.navigation.hideSelectCountry) && filteredOrganizationTypes.value.length === 1) {
10605
+ if (!props.navigation.displayFullSiteList && (filteredCountries.value.length === 1 || props.navigation.hideSelectCountry) && filteredOrganizationTypes.value.length === 1) {
10280
10606
  organizationTypeId.value = filteredOrganizationTypes.value[0].id_site_organization_type;
10281
10607
  }
10282
10608
  }
10283
10609
  function resetSites() {
10284
10610
  organizationTypeId.value = fromBackUpConnection.value = siteStatus.value = organizationSiteId.value = site = null;
10285
10611
  }
10612
+ function selectFullSiteListOrganization(item) {
10613
+ countryId.value = item.id_country;
10614
+ organizationTypeId.value = item.id_site_organization_type;
10615
+ selectOrganizationSite(item);
10616
+ }
10286
10617
  function selectOrganizationSite(item) {
10287
10618
  rootEmit("organization-selected", item);
10288
10619
  measureEvent("open_site_organization", {
@@ -10355,6 +10686,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10355
10686
  });
10356
10687
  }
10357
10688
  if (!site || !site.loading) {
10689
+ site == null ? void 0 : site.dispose();
10358
10690
  siteRaw = item;
10359
10691
  thisSite = site = sync.siteConnection(item);
10360
10692
  siteStatus.value = "start";
@@ -10447,7 +10779,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10447
10779
  } else if (props.navigation.returnToSiteFormOnUserError !== false && (props.navigation.returnToSiteFormOnUserError === true && [401, 403, 411].includes(data.code) || props.navigation.returnToSiteFormOnUserError !== true && props.navigation.returnToSiteFormOnUserError.includes(
10448
10780
  data.code
10449
10781
  ))) {
10450
- siteStatus.value = site = null;
10782
+ dropSite();
10451
10783
  selectSite(siteRaw, false);
10452
10784
  siteFormError.value = {
10453
10785
  short: shortMessage,
@@ -10667,6 +10999,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10667
10999
  }
10668
11000
  openCredentialToast();
10669
11001
  }
11002
+ credential == null ? void 0 : credential.dispose();
10670
11003
  credential = sync.syncCredential(idCredential, update);
10671
11004
  credential.on("error", () => {
10672
11005
  const { code } = credential.error, messageCore = credential.error.response ? getApiErrorTranslationCore(credential.error) : `socket.message.${code ? code : 500}.`, shortMessage = t(`${messageCore}short_description`), longMessage = t(`${messageCore}long_description`);
@@ -11127,14 +11460,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11127
11460
  if (dataError.value) {
11128
11461
  return;
11129
11462
  }
11130
- let country;
11463
+ let country2;
11131
11464
  if (props.entrypoint.country) {
11132
- country = filteredCountries.value.find((country2) => {
11133
- return country2.code === props.entrypoint.country || country2.id_country === props.entrypoint.country;
11465
+ country2 = filteredCountries.value.find((country22) => {
11466
+ return country22.code === props.entrypoint.country || country22.id_country === props.entrypoint.country;
11134
11467
  });
11135
11468
  }
11136
11469
  if (filteredCountries.value.length) {
11137
- countryId.value = country ? country.id_country : filteredCountries.value[0].id_country;
11470
+ countryId.value = country2 ? country2.id_country : filteredCountries.value[0].id_country;
11138
11471
  measureEvent("open_country", {
11139
11472
  id_country: countryId.value
11140
11473
  });
@@ -11145,7 +11478,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11145
11478
  }
11146
11479
  }
11147
11480
  function setOrganizationTypeEntrypoint() {
11148
- if (props.entrypoint.siteOrganizationType) {
11481
+ if (props.entrypoint.siteOrganizationType && !props.navigation.displayFullSiteList) {
11149
11482
  const siteOrganizationType = filteredOrganizationTypes.value.find(
11150
11483
  (organizationType) => {
11151
11484
  return organizationType.id_site_organization_type === props.entrypoint.siteOrganizationType;
@@ -11264,7 +11597,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11264
11597
  measureEvent("close_site", {
11265
11598
  id_site: site.config.id_site
11266
11599
  });
11267
- siteStatus.value = site = null;
11600
+ dropSite();
11268
11601
  siteFormError.value = null;
11269
11602
  if (filteredSites.value.length === 1) {
11270
11603
  organizationSiteBack(false);
@@ -11295,7 +11628,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11295
11628
  if (emit2) {
11296
11629
  rootEmit("back");
11297
11630
  }
11298
- siteStatus.value = site = null;
11631
+ dropSite();
11299
11632
  selectSite(siteRaw, false);
11300
11633
  }
11301
11634
  function updateCredential2(idCredential, emitLoaded = false) {
@@ -11339,7 +11672,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11339
11672
  return openBlock(), createElementBlock(Fragment, null, [
11340
11673
  createVNode(TheModal, {
11341
11674
  visible: visible.value,
11342
- "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => visible.value = $event),
11675
+ "onUpdate:visible": _cache[6] || (_cache[6] = ($event) => visible.value = $event),
11343
11676
  mobile: unref(mobile)
11344
11677
  }, {
11345
11678
  default: withCtx(() => [
@@ -11366,7 +11699,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11366
11699
  class: normalizeClass(_ctx.$style["widget-back-button"]),
11367
11700
  onClick: headerBack
11368
11701
  }, [
11369
- createVNode(_sfc_main$i, { icon: "back" })
11702
+ createVNode(_sfc_main$j, { icon: "back" })
11370
11703
  ], 10, _hoisted_1)) : (openBlock(), createElementBlock("span", _hoisted_2)),
11371
11704
  createElementVNode("h1", null, toDisplayString(siteStatus.value && props.entrypoint.site ? unref(t)("common.update_title") : title.value), 1),
11372
11705
  createElementVNode("button", {
@@ -11374,10 +11707,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11374
11707
  "aria-label": unref(t)("common.close"),
11375
11708
  onClick: close
11376
11709
  }, [
11377
- createVNode(_sfc_main$i, { icon: "close" })
11710
+ createVNode(_sfc_main$j, { icon: "close" })
11378
11711
  ], 10, _hoisted_3)
11379
11712
  ], 2),
11380
11713
  createElementVNode("div", {
11714
+ ref_key: "widgetContent",
11715
+ ref: widgetContent,
11381
11716
  class: normalizeClass(_ctx.$style["widget-content"])
11382
11717
  }, [
11383
11718
  credentialFlow.value ? (openBlock(), createElementBlock("div", {
@@ -11456,19 +11791,28 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11456
11791
  loading.value ? (openBlock(), createBlock(AppLoader, { key: 0 })) : createCommentVNode("", true),
11457
11792
  !loading.value && !dataError.value && !noFilteredData.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
11458
11793
  !siteStatus.value ? (openBlock(), createElementBlock("div", _hoisted_4, [
11459
- countryId.value && !organizationTypeId.value ? (openBlock(), createBlock(InstitutionFilters, {
11794
+ props.navigation.displayFullSiteList && !organizationSiteId.value ? (openBlock(), createBlock(FullSiteList, {
11460
11795
  key: 0,
11796
+ search: fullSiteListSearch.value,
11797
+ "onUpdate:search": _cache[1] || (_cache[1] = ($event) => fullSiteListSearch.value = $event),
11798
+ "assets-path": unref(assetsPath),
11799
+ catalog: fullSiteCatalog.value,
11800
+ "show-logo": props.navigation.displayLogoImages,
11801
+ onSelect: selectFullSiteListOrganization
11802
+ }, null, 8, ["search", "assets-path", "catalog", "show-logo"])) : createCommentVNode("", true),
11803
+ !props.navigation.displayFullSiteList && countryId.value && !organizationTypeId.value ? (openBlock(), createBlock(InstitutionFilters, {
11804
+ key: 1,
11461
11805
  "country-id": countryId.value,
11462
- "onUpdate:countryId": _cache[1] || (_cache[1] = ($event) => countryId.value = $event),
11806
+ "onUpdate:countryId": _cache[2] || (_cache[2] = ($event) => countryId.value = $event),
11463
11807
  "organization-type-id": organizationTypeId.value,
11464
- "onUpdate:organizationTypeId": _cache[2] || (_cache[2] = ($event) => organizationTypeId.value = $event),
11808
+ "onUpdate:organizationTypeId": _cache[3] || (_cache[3] = ($event) => organizationTypeId.value = $event),
11465
11809
  "filtered-countries": filteredCountries.value,
11466
11810
  "filtered-organization-types": filteredOrganizationTypes.value,
11467
11811
  "select-class": props.navigation.selectClass,
11468
11812
  "show-countries": !props.navigation.hideSelectCountry
11469
11813
  }, null, 8, ["country-id", "organization-type-id", "filtered-countries", "filtered-organization-types", "select-class", "show-countries"])) : createCommentVNode("", true),
11470
11814
  countryId.value && organizationTypeId.value && !organizationSiteId.value ? (openBlock(), createBlock(OrganizationSitesList, {
11471
- key: 1,
11815
+ key: 2,
11472
11816
  "assets-path": unref(assetsPath),
11473
11817
  items: filteredOrganizationSites.value,
11474
11818
  "show-logo": props.navigation.displayLogoImages,
@@ -11476,7 +11820,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11476
11820
  onSelect: selectOrganizationSite
11477
11821
  }, null, 8, ["assets-path", "items", "show-logo", "show-plaid-sites-button"])) : createCommentVNode("", true),
11478
11822
  countryId.value && organizationTypeId.value && organizationSiteId.value ? (openBlock(), createBlock(SitesList, {
11479
- key: 2,
11823
+ key: 3,
11480
11824
  "assets-path": unref(assetsPath),
11481
11825
  items: filteredSites.value,
11482
11826
  organization: filteredOrganizationSites.value.find(
@@ -11507,7 +11851,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11507
11851
  onConsentRejected: consentRejected,
11508
11852
  onError: connectError,
11509
11853
  onSuccess: siteSucess,
11510
- onValid: _cache[3] || (_cache[3] = () => siteSubmitted(true))
11854
+ onValid: _cache[4] || (_cache[4] = () => siteSubmitted(true))
11511
11855
  }, null, 8, ["assets-path", "button-disabled-style", "consent", "consent-loading", "disable-form-autocomplete", "display-back-button", "error-message", "loader-message", "require-consent", "select-class", "show-logo", "show-password-style", "site", "test-mode"])) : siteStatus.value === "start" || siteStatus.value === "loading" ? (openBlock(), createBlock(SiteForm, {
11512
11856
  key: 1,
11513
11857
  "assets-path": unref(assetsPath),
@@ -11567,7 +11911,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11567
11911
  "show-logo": props.navigation.displayLogoImages,
11568
11912
  type: unref(site).finalResponse,
11569
11913
  onAddOther: resetSites,
11570
- onSelectAccounts: _cache[4] || (_cache[4] = () => {
11914
+ onSelectAccounts: _cache[5] || (_cache[5] = () => {
11571
11915
  selectingAccounts.value = true;
11572
11916
  })
11573
11917
  }, null, 8, ["avatar", "display-accounts-selection", "display-add-another-button", "long-message", "message", "show-logo", "type"]))
@@ -11578,7 +11922,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11578
11922
  key: 2,
11579
11923
  class: normalizeClass(_ctx.$style["widget-data-error"])
11580
11924
  }, [
11581
- createVNode(_sfc_main$i, { icon: "x-circle" }),
11925
+ createVNode(_sfc_main$j, { icon: "x-circle" }),
11582
11926
  createElementVNode("h2", null, toDisplayString(unref(t)(`${dataError.value}short_description`)), 1),
11583
11927
  createElementVNode("p", null, toDisplayString(unref(t)(`${dataError.value}long_description`)), 1),
11584
11928
  createElementVNode("button", {
@@ -11590,7 +11934,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11590
11934
  key: 3,
11591
11935
  class: normalizeClass(_ctx.$style["widget-data-error"])
11592
11936
  }, [
11593
- createVNode(_sfc_main$i, { icon: "x-circle" }),
11937
+ createVNode(_sfc_main$j, { icon: "x-circle" }),
11594
11938
  createElementVNode("p", null, toDisplayString(unref(t)("common.no_filtered_data")), 1),
11595
11939
  createElementVNode("button", {
11596
11940
  class: "pb-w-sync_primary-button",
@@ -11647,6 +11991,7 @@ const defaultConfig = {
11647
11991
  displayBusinessSites: true,
11648
11992
  displayCredentialInModal: false,
11649
11993
  displayErrorsInToast: true,
11994
+ displayFullSiteList: false,
11650
11995
  displayLogoImages: true,
11651
11996
  displayLongDescription: false,
11652
11997
  displayPersonalSites: true,
@@ -11694,6 +12039,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11694
12039
  token: {}
11695
12040
  },
11696
12041
  setup(__props, { expose: __expose }) {
12042
+ var _a;
11697
12043
  const props = __props;
11698
12044
  const widgetComponent = ref(null);
11699
12045
  const { t } = useI18n();
@@ -11718,6 +12064,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11718
12064
  ...removeUndefineds(props.config.navigation)
11719
12065
  },
11720
12066
  refreshTokenFunction: props.refreshTokenFunction,
12067
+ requestedCountry: (_a = props.config.entrypoint) == null ? void 0 : _a.country,
11721
12068
  strict: props.strict,
11722
12069
  token: props.token,
11723
12070
  onTokenRefreshed: (newToken) => {
@@ -11736,6 +12083,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11736
12083
  });
11737
12084
  }
11738
12085
  function setConfig(config = {}) {
12086
+ var _a2;
11739
12087
  try {
11740
12088
  configValidator.validateSync(config);
11741
12089
  } catch (error2) {
@@ -11751,6 +12099,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11751
12099
  ...defaultConfig.entrypoint,
11752
12100
  ...removeUndefineds(config.entrypoint)
11753
12101
  };
12102
+ childProperties.requestedCountry = (_a2 = config.entrypoint) == null ? void 0 : _a2.country;
11754
12103
  childProperties.internal = {
11755
12104
  ...defaultConfig.__internal__,
11756
12105
  ...removeUndefineds(config.__internal__)
@@ -11775,6 +12124,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11775
12124
  return widgetComponent.value.setToken(token, strict);
11776
12125
  }
11777
12126
  function upsertConfig(config = {}) {
12127
+ var _a2;
11778
12128
  try {
11779
12129
  configValidator.validateSync(config);
11780
12130
  } catch (error2) {
@@ -11790,6 +12140,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11790
12140
  ...childProperties.entrypoint,
11791
12141
  ...removeUndefineds(config.entrypoint)
11792
12142
  };
12143
+ childProperties.requestedCountry = ((_a2 = config.entrypoint) == null ? void 0 : _a2.country) ?? childProperties.requestedCountry;
11793
12144
  childProperties.internal = {
11794
12145
  ...childProperties.internal,
11795
12146
  ...removeUndefineds(config.__internal__)
@@ -12014,6 +12365,7 @@ const staticMethods = {
12014
12365
  updateCredential
12015
12366
  };
12016
12367
  initFirebase();
12368
+ const mountedApps = /* @__PURE__ */ new WeakMap();
12017
12369
  class SyncfyWidget {
12018
12370
  /**
12019
12371
  *
@@ -12048,6 +12400,7 @@ class SyncfyWidget {
12048
12400
  * @param {Boolean} params.config.navigation.displayBusinessSites
12049
12401
  * @param {Boolean} params.config.navigation.displayCredentialInModal
12050
12402
  * @param {Boolean} params.config.navigation.displayErrorsInToast
12403
+ * @param {Boolean} params.config.navigation.displayFullSiteList Lists every site by country and category instead of asking for filters.
12051
12404
  * @param {Boolean} params.config.navigation.displayLogoImages Indicates if widget should show organizations logo.
12052
12405
  * @param {Boolean} params.config.navigation.displayLongDescription
12053
12406
  * @param {Boolean} params.config.navigation.displayPersonalSites
@@ -12085,6 +12438,7 @@ class SyncfyWidget {
12085
12438
  *
12086
12439
  */
12087
12440
  constructor(params) {
12441
+ var _a;
12088
12442
  const rollbar = new Rollbar({
12089
12443
  accessToken: "2d928ea9aa674c6ea84dbf6f3901a403",
12090
12444
  captureUncaught: false,
@@ -12145,7 +12499,13 @@ class SyncfyWidget {
12145
12499
  });
12146
12500
  }
12147
12501
  app.provide(rootEmitter, emitter);
12148
- const rootComponent = app.mount(_params.element || "#widget");
12502
+ const element = _params.element || "#widget";
12503
+ const container2 = typeof element === "string" ? document.querySelector(element) : element;
12504
+ if (container2) {
12505
+ (_a = mountedApps.get(container2)) == null ? void 0 : _a.unmount();
12506
+ mountedApps.set(container2, app);
12507
+ }
12508
+ const rootComponent = app.mount(element);
12149
12509
  return {
12150
12510
  on,
12151
12511
  close: rootComponent.close,