@syncfy/authentication-widget 2.0.0 → 2.1.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.
@@ -7,7 +7,7 @@ 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, onBeforeUnmount, createSlots, nextTick, renderSlot, toRaw, withModifiers, 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, withModifiers, onBeforeUnmount, createSlots, nextTick, renderSlot, toRaw, normalizeStyle, isRef, provide, h, onUpdated, mergeProps, createApp } from "vue";
11
11
  import { useI18n, createI18n } from "vue-i18n";
12
12
  import { ElForm, ElFormItem, ElCheckboxGroup, ElCheckbox, ElStatistic, ElSelect, ElOption, ElInput, ElAlert, ElMenu, ElMenuItem, ElSwitch, ElDatePicker, ElButton, ElLink, vLoading, ElNotification, ElConfigProvider } from "element-plus";
13
13
  import en from "element-plus/dist/locale/en.mjs";
@@ -720,6 +720,40 @@ const resource$1 = {
720
720
  return _normalize(["Digital Wallets"]);
721
721
  }
722
722
  },
723
+ "consent": {
724
+ "aria_label": (ctx) => {
725
+ const { normalize: _normalize } = ctx;
726
+ return _normalize(["I accept the authorization to access my banking information"]);
727
+ },
728
+ "error": (ctx) => {
729
+ const { normalize: _normalize } = ctx;
730
+ return _normalize(["The authorization could not be retrieved. Please try again."]);
731
+ },
732
+ "rejected": {
733
+ "long_description": (ctx) => {
734
+ const { normalize: _normalize } = ctx;
735
+ return _normalize(["Your contract requires the authorization to connect the account, and it was not received. Tick the box again and retry."]);
736
+ },
737
+ "short_description": (ctx) => {
738
+ const { normalize: _normalize } = ctx;
739
+ return _normalize(["Authorization missing"]);
740
+ }
741
+ },
742
+ "required": (ctx) => {
743
+ const { normalize: _normalize } = ctx;
744
+ return _normalize(["You must accept the authorization to continue."]);
745
+ },
746
+ "stale": {
747
+ "long_description": (ctx) => {
748
+ const { normalize: _normalize } = ctx;
749
+ return _normalize(["The authorization changed while you were filling the form. Read it again and accept it to continue; your details are still there."]);
750
+ },
751
+ "short_description": (ctx) => {
752
+ const { normalize: _normalize } = ctx;
753
+ return _normalize(["The authorization was updated"]);
754
+ }
755
+ }
756
+ },
723
757
  "credential": {
724
758
  "api_error": {
725
759
  "message": (ctx) => {
@@ -1880,6 +1914,40 @@ const resource = {
1880
1914
  return _normalize(["Carteras Digitales"]);
1881
1915
  }
1882
1916
  },
1917
+ "consent": {
1918
+ "aria_label": (ctx) => {
1919
+ const { normalize: _normalize } = ctx;
1920
+ return _normalize(["Acepto la autorización para acceder a mi información bancaria"]);
1921
+ },
1922
+ "error": (ctx) => {
1923
+ const { normalize: _normalize } = ctx;
1924
+ return _normalize(["No fue posible obtener la autorización. Vuelve a intentarlo."]);
1925
+ },
1926
+ "rejected": {
1927
+ "long_description": (ctx) => {
1928
+ const { normalize: _normalize } = ctx;
1929
+ return _normalize(["Tu contrato requiere la autorización para conectar la cuenta, y no se recibió. Vuelve a marcar la casilla e inténtalo de nuevo."]);
1930
+ },
1931
+ "short_description": (ctx) => {
1932
+ const { normalize: _normalize } = ctx;
1933
+ return _normalize(["Falta la autorización"]);
1934
+ }
1935
+ },
1936
+ "required": (ctx) => {
1937
+ const { normalize: _normalize } = ctx;
1938
+ return _normalize(["Debes aceptar la autorización para continuar."]);
1939
+ },
1940
+ "stale": {
1941
+ "long_description": (ctx) => {
1942
+ const { normalize: _normalize } = ctx;
1943
+ return _normalize(["La autorización cambió mientras llenabas el formulario. Léela de nuevo y acéptala para continuar; tus datos siguen capturados."]);
1944
+ },
1945
+ "short_description": (ctx) => {
1946
+ const { normalize: _normalize } = ctx;
1947
+ return _normalize(["La autorización se actualizó"]);
1948
+ }
1949
+ }
1950
+ },
1883
1951
  "credential": {
1884
1952
  "api_error": {
1885
1953
  "message": (ctx) => {
@@ -2424,6 +2492,7 @@ const configValidator = object().noUnknown().shape({
2424
2492
  hideSites: array().of(string()),
2425
2493
  oneSiteFlow: boolean(),
2426
2494
  quickAnswer: boolean(),
2495
+ requireConsent: boolean(),
2427
2496
  returnToSiteFormOnUserError: lazy((value) => {
2428
2497
  if (typeof value === "object") {
2429
2498
  return array().of(number().oneOf([401, 403, 411]));
@@ -2515,9 +2584,9 @@ const paramsValidator = object().shape({
2515
2584
  }).strict().noUnknown();
2516
2585
  let __VERSION__ = {
2517
2586
  "git": {
2518
- "hash": "g422a011",
2587
+ "hash": "ga858a6f",
2519
2588
  "distance": 0,
2520
- "tag": "v2.0.0"
2589
+ "tag": "v2.1.0"
2521
2590
  }
2522
2591
  };
2523
2592
  function getVersion() {
@@ -3455,6 +3524,54 @@ async function transmitRequestMessageBridge(o, i) {
3455
3524
  }
3456
3525
  });
3457
3526
  }
3527
+ const MARKER = /\{([a-z_]+)\}/g;
3528
+ function parseConsentText(consent) {
3529
+ const documents = consent.documents || [], segments = [];
3530
+ let lastIndex = 0, match;
3531
+ MARKER.lastIndex = 0;
3532
+ while ((match = MARKER.exec(consent.text)) !== null) {
3533
+ const document2 = documents.find((item) => item.role === match[1]);
3534
+ if (match.index > lastIndex) {
3535
+ segments.push({ text: consent.text.slice(lastIndex, match.index) });
3536
+ }
3537
+ segments.push(
3538
+ document2 ? { document: document2, text: document2.label } : { text: match[0] }
3539
+ );
3540
+ lastIndex = match.index + match[0].length;
3541
+ }
3542
+ if (lastIndex < consent.text.length) {
3543
+ segments.push({ text: consent.text.slice(lastIndex) });
3544
+ }
3545
+ return segments;
3546
+ }
3547
+ function consentHolderType(site, businessOnly = false) {
3548
+ const business = (site == null ? void 0 : site.is_business) === 1, personal = (site == null ? void 0 : site.is_personal) === 1;
3549
+ if (business && !personal) {
3550
+ return "legal_entity";
3551
+ }
3552
+ if (personal && !business) {
3553
+ return "individual";
3554
+ }
3555
+ return businessOnly ? "legal_entity" : "individual";
3556
+ }
3557
+ function consentErrorKind(error2) {
3558
+ var _a, _b, _c;
3559
+ const status = (_a = error2 == null ? void 0 : error2.response) == null ? void 0 : _a.status, message = ((_c = (_b = error2 == null ? void 0 : error2.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "";
3560
+ if (status === 409) {
3561
+ return "stale";
3562
+ }
3563
+ if (status === 400 && /consent/i.test(message)) {
3564
+ return "missing";
3565
+ }
3566
+ return null;
3567
+ }
3568
+ function hasUnresolvedDocuments(consent) {
3569
+ const documents = consent.documents || [];
3570
+ MARKER.lastIndex = 0;
3571
+ return Array.from(consent.text.matchAll(MARKER)).some(
3572
+ (match) => !documents.some((item) => item.role === match[1])
3573
+ );
3574
+ }
3458
3575
  const DOWNLOAD_OPTIONS_ACTIVE = {
3459
3576
  enables: ["download_options"],
3460
3577
  name: "download_options_active",
@@ -3561,14 +3678,14 @@ function getSantanderWebSocketScript() {
3561
3678
  };
3562
3679
  });
3563
3680
  }
3564
- const _hoisted_1$b = {
3681
+ const _hoisted_1$c = {
3565
3682
  key: 0,
3566
3683
  width: "30",
3567
3684
  height: "28",
3568
3685
  fill: "none",
3569
3686
  xmlns: "http://www.w3.org/2000/svg"
3570
3687
  };
3571
- const _hoisted_2$9 = {
3688
+ const _hoisted_2$a = {
3572
3689
  key: 1,
3573
3690
  xmlns: "http://www.w3.org/2000/svg",
3574
3691
  width: "23",
@@ -3653,7 +3770,7 @@ const _hoisted_11 = {
3653
3770
  "stroke-width": "1.5",
3654
3771
  "xmlns:v": "https://vecta.io/nano"
3655
3772
  };
3656
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
3773
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3657
3774
  __name: "CustomIcon",
3658
3775
  props: {
3659
3776
  icon: {}
@@ -3661,7 +3778,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3661
3778
  setup(__props) {
3662
3779
  const props = __props;
3663
3780
  return (_ctx, _cache) => {
3664
- return props.icon === "back" ? (openBlock(), createElementBlock("svg", _hoisted_1$b, _cache[0] || (_cache[0] = [
3781
+ return props.icon === "back" ? (openBlock(), createElementBlock("svg", _hoisted_1$c, _cache[0] || (_cache[0] = [
3665
3782
  createElementVNode("path", {
3666
3783
  d: "M2 14.219h26.5M2 13.781 13.781 2M2 14.219 13.781 26",
3667
3784
  stroke: "#000",
@@ -3669,7 +3786,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3669
3786
  "stroke-linecap": "round",
3670
3787
  "stroke-linejoin": "round"
3671
3788
  }, null, -1)
3672
- ]))) : props.icon === "close" ? (openBlock(), createElementBlock("svg", _hoisted_2$9, _cache[1] || (_cache[1] = [
3789
+ ]))) : props.icon === "close" ? (openBlock(), createElementBlock("svg", _hoisted_2$a, _cache[1] || (_cache[1] = [
3673
3790
  createElementVNode("path", {
3674
3791
  d: "m2 2 18.738 18.738M2.12 21.107 20.857 2.37",
3675
3792
  stroke: "#000",
@@ -3748,8 +3865,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3748
3865
  };
3749
3866
  }
3750
3867
  });
3751
- const _hoisted_1$a = ["src"];
3752
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
3868
+ const _hoisted_1$b = ["src"];
3869
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3753
3870
  __name: "AppLoader",
3754
3871
  props: {
3755
3872
  avatar: { default: void 0 },
@@ -3796,8 +3913,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3796
3913
  width: "1",
3797
3914
  height: "1",
3798
3915
  onLoad: _cache[0] || (_cache[0] = () => emit("imagesLoaded"))
3799
- }, null, 40, _hoisted_1$a)) : createCommentVNode("", true),
3800
- _ctx.icon ? (openBlock(), createBlock(_sfc_main$h, {
3916
+ }, null, 40, _hoisted_1$b)) : createCommentVNode("", true),
3917
+ _ctx.icon ? (openBlock(), createBlock(_sfc_main$i, {
3801
3918
  key: 1,
3802
3919
  icon: _ctx.icon
3803
3920
  }, null, 8, ["icon"])) : createCommentVNode("", true)
@@ -3822,7 +3939,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3822
3939
  }
3823
3940
  });
3824
3941
  const loader = "pb-w-sync_loader";
3825
- const style0$f = {
3942
+ const style0$g = {
3826
3943
  loader,
3827
3944
  "loader-container-animation": "pb-w-sync_loader-container-animation",
3828
3945
  "loader-clip-animation": "pb-w-sync_loader-clip-animation",
@@ -3847,12 +3964,12 @@ const _export_sfc = (sfc, props) => {
3847
3964
  }
3848
3965
  return target;
3849
3966
  };
3850
- const cssModules$f = {
3851
- "$style": style0$f
3967
+ const cssModules$g = {
3968
+ "$style": style0$g
3852
3969
  };
3853
- const AppLoader = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__cssModules", cssModules$f]]);
3854
- const _hoisted_1$9 = ["disabled"];
3855
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
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({
3856
3973
  __name: "AccountsSelection",
3857
3974
  props: {
3858
3975
  avatar: { default: void 0 },
@@ -4046,7 +4163,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
4046
4163
  "data-testid": "accounts-button",
4047
4164
  disabled: _ctx.buttonDisabledStyle && isInvalid.value,
4048
4165
  type: "submit"
4049
- }, toDisplayString(unref(t)("accounts_selection.done")), 9, _hoisted_1$9)
4166
+ }, toDisplayString(unref(t)("accounts_selection.done")), 9, _hoisted_1$a)
4050
4167
  ]),
4051
4168
  _: 1
4052
4169
  }, 8, ["class", "autocomplete", "disabled", "model", "rules"])),
@@ -4065,7 +4182,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
4065
4182
  };
4066
4183
  }
4067
4184
  });
4068
- const style0$e = {
4185
+ const style0$f = {
4069
4186
  "accounts-balance": "pb-w-sync_accounts-balance",
4070
4187
  "accounts-checkbox": "pb-w-sync_accounts-checkbox",
4071
4188
  "accounts-checkbox-content": "pb-w-sync_accounts-checkbox-content",
@@ -4076,11 +4193,11 @@ const style0$e = {
4076
4193
  "accounts-selection": "pb-w-sync_accounts-selection",
4077
4194
  "accounts-api-error": "pb-w-sync_accounts-api-error"
4078
4195
  };
4079
- const cssModules$e = {
4080
- "$style": style0$e
4196
+ const cssModules$f = {
4197
+ "$style": style0$f
4081
4198
  };
4082
- const AccountsSelection = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__cssModules", cssModules$e]]);
4083
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
4199
+ const AccountsSelection = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__cssModules", cssModules$f]]);
4200
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
4084
4201
  __name: "FinalResponse",
4085
4202
  props: {
4086
4203
  avatar: {},
@@ -4126,17 +4243,17 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4126
4243
  };
4127
4244
  }
4128
4245
  });
4129
- const style0$d = {
4246
+ const style0$e = {
4130
4247
  "final-response-container": "pb-w-sync_final-response-container"
4131
4248
  };
4132
- const cssModules$d = {
4133
- "$style": style0$d
4249
+ const cssModules$e = {
4250
+ "$style": style0$e
4134
4251
  };
4135
- const FinalResponse = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__cssModules", cssModules$d]]);
4136
- const _hoisted_1$8 = ["src"];
4137
- const _hoisted_2$8 = ["src"];
4252
+ const FinalResponse = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__cssModules", cssModules$e]]);
4253
+ const _hoisted_1$9 = ["src"];
4254
+ const _hoisted_2$9 = ["src"];
4138
4255
  const _hoisted_3$6 = ["onClick"];
4139
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
4256
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4140
4257
  __name: "InstitutionFilters",
4141
4258
  props: {
4142
4259
  countryId: {},
@@ -4191,7 +4308,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4191
4308
  width: "44",
4192
4309
  height: "44",
4193
4310
  alt: ""
4194
- }, null, 8, _hoisted_1$8)
4311
+ }, null, 8, _hoisted_1$9)
4195
4312
  ]),
4196
4313
  default: withCtx(() => [
4197
4314
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filteredCountries, (country) => {
@@ -4207,7 +4324,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4207
4324
  width: "44",
4208
4325
  height: "44",
4209
4326
  alt: ""
4210
- }, null, 8, _hoisted_2$8),
4327
+ }, null, 8, _hoisted_2$9),
4211
4328
  createElementVNode("span", null, toDisplayString(country.name), 1)
4212
4329
  ]),
4213
4330
  _: 2
@@ -4230,20 +4347,20 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4230
4347
  };
4231
4348
  }
4232
4349
  });
4233
- const style0$c = {
4350
+ const style0$d = {
4234
4351
  "institution-filters-intro": "pb-w-sync_institution-filters-intro",
4235
4352
  "organization-types-list": "pb-w-sync_organization-types-list",
4236
4353
  "widget-country": "pb-w-sync_widget-country",
4237
4354
  "widget-country-option": "pb-w-sync_widget-country-option"
4238
4355
  };
4239
- const cssModules$c = {
4240
- "$style": style0$c
4356
+ const cssModules$d = {
4357
+ "$style": style0$d
4241
4358
  };
4242
- const InstitutionFilters = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__cssModules", cssModules$c]]);
4243
- const _hoisted_1$7 = ["onClick"];
4244
- const _hoisted_2$7 = ["alt", "src"];
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"];
4245
4362
  const _hoisted_3$5 = { key: 1 };
4246
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
4363
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4247
4364
  __name: "OrganizationSitesList",
4248
4365
  props: {
4249
4366
  assetsPath: { default: "https://s.paybook.com" },
@@ -4309,7 +4426,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
4309
4426
  placeholder: unref(t)("common.search")
4310
4427
  }, {
4311
4428
  prefix: withCtx(() => [
4312
- createVNode(_sfc_main$h, { icon: "search" })
4429
+ createVNode(_sfc_main$i, { icon: "search" })
4313
4430
  ]),
4314
4431
  _: 1
4315
4432
  }, 8, ["modelValue", "placeholder"]),
@@ -4331,8 +4448,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
4331
4448
  height: "66",
4332
4449
  width: "220",
4333
4450
  onLoad: imageLoaded
4334
- }, null, 40, _hoisted_2$7)) : (openBlock(), createElementBlock("span", _hoisted_3$5, toDisplayString(item.name), 1))
4335
- ], 10, _hoisted_1$7)), [
4451
+ }, null, 40, _hoisted_2$8)) : (openBlock(), createElementBlock("span", _hoisted_3$5, toDisplayString(item.name), 1))
4452
+ ], 10, _hoisted_1$8)), [
4336
4453
  [vShow, item.show]
4337
4454
  ]);
4338
4455
  }), 128))
@@ -4341,20 +4458,20 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
4341
4458
  };
4342
4459
  }
4343
4460
  });
4344
- const style0$b = {
4461
+ const style0$c = {
4345
4462
  "widget-plaid-container": "pb-w-sync_widget-plaid-container",
4346
4463
  "organization-sites": "pb-w-sync_organization-sites",
4347
4464
  "organization-button": "pb-w-sync_organization-button"
4348
4465
  };
4349
- const cssModules$b = {
4350
- "$style": style0$b
4466
+ const cssModules$c = {
4467
+ "$style": style0$c
4351
4468
  };
4352
- const OrganizationSitesList = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__cssModules", cssModules$b]]);
4353
- const _hoisted_1$6 = { key: 0 };
4354
- const _hoisted_2$6 = ["src"];
4469
+ const OrganizationSitesList = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__cssModules", cssModules$c]]);
4470
+ const _hoisted_1$7 = { key: 0 };
4471
+ const _hoisted_2$7 = ["src"];
4355
4472
  const _hoisted_3$4 = ["src"];
4356
4473
  const _hoisted_4$3 = ["href"];
4357
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
4474
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
4358
4475
  __name: "PrivacyPolicy",
4359
4476
  props: {
4360
4477
  client: {}
@@ -4394,12 +4511,12 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4394
4511
  { [_ctx.$style["with-client-logo"]]: props.client.logo }
4395
4512
  ])
4396
4513
  }, [
4397
- props.client.logo ? (openBlock(), createElementBlock("div", _hoisted_1$6, [
4514
+ props.client.logo ? (openBlock(), createElementBlock("div", _hoisted_1$7, [
4398
4515
  createElementVNode("img", {
4399
4516
  src: props.client.logo,
4400
4517
  alt: "",
4401
4518
  onLoad: imageLoaded
4402
- }, null, 40, _hoisted_2$6)
4519
+ }, null, 40, _hoisted_2$7)
4403
4520
  ])) : createCommentVNode("", true),
4404
4521
  createElementVNode("div", null, [
4405
4522
  createElementVNode("img", {
@@ -4414,15 +4531,15 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4414
4531
  createElementVNode("h1", null, toDisplayString(props.client.name ? unref(t)("privacy.title_client", { client: props.client.name }) : unref(t)("privacy.title")), 1),
4415
4532
  createElementVNode("ul", null, [
4416
4533
  createElementVNode("li", null, [
4417
- createVNode(_sfc_main$h, { icon: "files" }),
4534
+ createVNode(_sfc_main$i, { icon: "files" }),
4418
4535
  createTextVNode(" " + toDisplayString(unref(t)("privacy.list.first")), 1)
4419
4536
  ]),
4420
4537
  createElementVNode("li", null, [
4421
- createVNode(_sfc_main$h, { icon: "lock" }),
4538
+ createVNode(_sfc_main$i, { icon: "lock" }),
4422
4539
  createTextVNode(" " + toDisplayString(unref(t)("privacy.list.second")), 1)
4423
4540
  ]),
4424
4541
  createElementVNode("li", null, [
4425
- createVNode(_sfc_main$h, { icon: "users" }),
4542
+ createVNode(_sfc_main$i, { icon: "users" }),
4426
4543
  createTextVNode(" " + toDisplayString(unref(t)("privacy.list.third")), 1)
4427
4544
  ])
4428
4545
  ]),
@@ -4447,16 +4564,82 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4447
4564
  };
4448
4565
  }
4449
4566
  });
4450
- const style0$a = {
4567
+ const style0$b = {
4451
4568
  "privacy-container": "pb-w-sync_privacy-container",
4452
4569
  "privacy-center": "pb-w-sync_privacy-center",
4453
4570
  "privacy-images": "pb-w-sync_privacy-images",
4454
4571
  "with-client-logo": "pb-w-sync_with-client-logo"
4455
4572
  };
4573
+ const cssModules$b = {
4574
+ "$style": style0$b
4575
+ };
4576
+ const PrivacyPolicy = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__cssModules", cssModules$b]]);
4577
+ const _hoisted_1$6 = ["aria-label", "checked"];
4578
+ const _hoisted_2$6 = ["data-testid", "href"];
4579
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4580
+ __name: "ConsentNotice",
4581
+ props: {
4582
+ consent: {},
4583
+ modelValue: { type: Boolean }
4584
+ },
4585
+ emits: ["update:modelValue"],
4586
+ setup(__props, { emit: __emit }) {
4587
+ const props = __props;
4588
+ const emit = __emit;
4589
+ const { t } = useI18n();
4590
+ const segments = computed(() => parseConsentText(props.consent));
4591
+ function toggle(event2) {
4592
+ emit("update:modelValue", event2.target.checked);
4593
+ }
4594
+ return (_ctx, _cache) => {
4595
+ return openBlock(), createElementBlock("div", {
4596
+ class: normalizeClass(_ctx.$style["consent-container"]),
4597
+ "data-testid": "consent"
4598
+ }, [
4599
+ createElementVNode("label", {
4600
+ class: normalizeClass(_ctx.$style["consent-label"])
4601
+ }, [
4602
+ createElementVNode("input", {
4603
+ "aria-label": unref(t)("consent.aria_label"),
4604
+ checked: props.modelValue,
4605
+ "data-testid": "consent-checkbox",
4606
+ type: "checkbox",
4607
+ onChange: toggle
4608
+ }, null, 40, _hoisted_1$6),
4609
+ createElementVNode("span", {
4610
+ class: normalizeClass(_ctx.$style["consent-text"]),
4611
+ "data-testid": "consent-text"
4612
+ }, [
4613
+ (openBlock(true), createElementBlock(Fragment, null, renderList(segments.value, (segment, index) => {
4614
+ return openBlock(), createElementBlock(Fragment, { key: index }, [
4615
+ segment.document ? (openBlock(), createElementBlock("a", {
4616
+ key: 0,
4617
+ "data-testid": `consent-document-${segment.document.role}`,
4618
+ href: segment.document.url,
4619
+ rel: "noopener noreferrer",
4620
+ target: "_blank",
4621
+ onClick: _cache[0] || (_cache[0] = withModifiers(() => {
4622
+ }, ["stop"]))
4623
+ }, toDisplayString(segment.text), 9, _hoisted_2$6)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
4624
+ createTextVNode(toDisplayString(segment.text), 1)
4625
+ ], 64))
4626
+ ], 64);
4627
+ }), 128))
4628
+ ], 2)
4629
+ ], 2)
4630
+ ], 2);
4631
+ };
4632
+ }
4633
+ });
4634
+ const style0$a = {
4635
+ "consent-container": "pb-w-sync_consent-container",
4636
+ "consent-label": "pb-w-sync_consent-label",
4637
+ "consent-text": "pb-w-sync_consent-text"
4638
+ };
4456
4639
  const cssModules$a = {
4457
4640
  "$style": style0$a
4458
4641
  };
4459
- const PrivacyPolicy = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__cssModules", cssModules$a]]);
4642
+ const ConsentNotice = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__cssModules", cssModules$a]]);
4460
4643
  const _hoisted_1$5 = ["for"];
4461
4644
  const _hoisted_2$5 = ["aria-label"];
4462
4645
  const _hoisted_3$3 = ["accept", "name"];
@@ -4594,7 +4777,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4594
4777
  class: normalizeClass(_ctx.$style["widget-back-button"]),
4595
4778
  onClick: _cache[0] || (_cache[0] = ($event) => remove($event))
4596
4779
  }, [
4597
- createVNode(_sfc_main$h, { icon: "x-circle" })
4780
+ createVNode(_sfc_main$i, { icon: "x-circle" })
4598
4781
  ], 10, _hoisted_2$5)
4599
4782
  ], 2)) : (openBlock(), createElementBlock("button", {
4600
4783
  key: 1,
@@ -4649,13 +4832,14 @@ const _hoisted_1$4 = { key: 1 };
4649
4832
  const _hoisted_2$4 = ["alt", "src"];
4650
4833
  const _hoisted_3$2 = ["aria-label"];
4651
4834
  const _hoisted_4$2 = { class: "el-form-item__error" };
4652
- const _hoisted_5$1 = ["disabled"];
4835
+ const _hoisted_5$1 = ["disabled", "title"];
4653
4836
  const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4654
4837
  __name: "SiteForm",
4655
4838
  props: {
4656
4839
  assetsPath: { default: "https://s.paybook.com" },
4657
4840
  backUpConnection: { type: Boolean, default: false },
4658
4841
  buttonDisabledStyle: { type: Boolean, default: false },
4842
+ consent: { default: null },
4659
4843
  credentialService: { default: null },
4660
4844
  disableFormAutocomplete: { type: Boolean, default: false },
4661
4845
  displayBackButton: { type: Boolean },
@@ -4665,21 +4849,29 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4665
4849
  showHeader: { type: Boolean, default: true },
4666
4850
  showLogo: { type: Boolean, default: true },
4667
4851
  showPasswordStyle: { default: "icon" },
4852
+ consentLoading: { type: Boolean, default: false },
4853
+ requireConsent: { type: Boolean, default: false },
4668
4854
  site: {},
4669
4855
  testMode: { type: Boolean, default: false },
4670
4856
  updateMode: { type: Boolean, default: false }
4671
4857
  },
4672
- emits: ["back", "error", "success", "valid"],
4858
+ emits: ["back", "consent-rejected", "error", "success", "valid"],
4673
4859
  setup(__props, { emit: __emit }) {
4674
4860
  const props = __props;
4675
4861
  const emit = __emit;
4676
4862
  const rootEmit = inject(rootEmitter);
4677
4863
  const activeIndex = ref("0"), formData = ref({
4678
4864
  ...isSiteV1Service(props.site) ? props.site.data : isSiteV3Service(props.site) ? props.site.input[activeIndex.value].data : props.backUpConnection ? props.site.backUpInput.data : props.site.input[activeIndex.value].data
4679
- }), isInvalid = ref(true), loading = ref(false), showPassword = ref(false), submittedWithError = ref(false), testMode = ref(false);
4865
+ }), consentAccepted = ref(false), isInvalid = ref(true), loading = ref(false), showPassword = ref(false), submittedWithError = ref(false), testMode = ref(false);
4680
4866
  let testModeCounter = 0, testModeTimeout = null, validSiteFormFields = {};
4681
4867
  const firstInput = ref(null), siteFormRef = ref(null);
4682
- const credentials = computed(() => {
4868
+ const consentRequired = computed(
4869
+ () => props.requireConsent && !props.updateMode
4870
+ ), consentBlocked = computed(
4871
+ () => consentRequired.value && (!props.consent || !consentAccepted.value)
4872
+ ), submitBlocked = computed(
4873
+ () => consentBlocked.value || (props.buttonDisabledStyle || consentRequired.value) && isInvalid.value
4874
+ ), credentials = computed(() => {
4683
4875
  if (isSiteV1Service(props.site)) {
4684
4876
  return props.site.getFields(props.updateMode);
4685
4877
  } else if (isSiteV3Service(props.site)) {
@@ -4805,6 +4997,10 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4805
4997
  event2.preventDefault();
4806
4998
  let connectPromise;
4807
4999
  if (!formEl) return;
5000
+ if (consentBlocked.value) return;
5001
+ props.site.setConsent(
5002
+ consentRequired.value ? { accepted: consentAccepted.value, text: props.consent.text } : null
5003
+ );
4808
5004
  await formEl.validate((valid) => {
4809
5005
  if (valid && !isInvalid.value) {
4810
5006
  emit("valid");
@@ -4838,6 +5034,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4838
5034
  }
4839
5035
  return response;
4840
5036
  }).catch((error2) => {
5037
+ const consentKind = consentRequired.value ? consentErrorKind(error2) : null;
5038
+ if (consentKind) {
5039
+ consentAccepted.value = false;
5040
+ loading.value = false;
5041
+ emit("consent-rejected", consentKind);
5042
+ return;
5043
+ }
4841
5044
  formData.value = {};
4842
5045
  validateChanged();
4843
5046
  emit("error", error2);
@@ -4956,7 +5159,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4956
5159
  model: formData.value,
4957
5160
  name: `${_ctx.site.config.id_site}`,
4958
5161
  rules: rules.value,
4959
- onSubmit: _cache[5] || (_cache[5] = (event2) => submit(event2, siteFormRef.value)),
5162
+ onSubmit: _cache[6] || (_cache[6] = (event2) => submit(event2, siteFormRef.value)),
4960
5163
  onValidate: validateChanged
4961
5164
  }, {
4962
5165
  default: withCtx(() => [
@@ -5008,10 +5211,10 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
5008
5211
  showPassword.value = !showPassword.value;
5009
5212
  })
5010
5213
  }, [
5011
- showPassword.value ? (openBlock(), createBlock(_sfc_main$h, {
5214
+ showPassword.value ? (openBlock(), createBlock(_sfc_main$i, {
5012
5215
  key: 0,
5013
5216
  icon: "eye-slash"
5014
- })) : (openBlock(), createBlock(_sfc_main$h, {
5217
+ })) : (openBlock(), createBlock(_sfc_main$i, {
5015
5218
  key: 1,
5016
5219
  icon: "eye"
5017
5220
  }))
@@ -5083,6 +5286,20 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
5083
5286
  ], 64)) : createCommentVNode("", true)
5084
5287
  ], 64);
5085
5288
  }), 128)),
5289
+ consentRequired.value && _ctx.consent ? (openBlock(), createBlock(ConsentNotice, {
5290
+ key: 0,
5291
+ modelValue: consentAccepted.value,
5292
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => consentAccepted.value = $event),
5293
+ consent: _ctx.consent
5294
+ }, null, 8, ["modelValue", "consent"])) : consentRequired.value && _ctx.consentLoading ? (openBlock(), createElementBlock("div", {
5295
+ key: 1,
5296
+ class: normalizeClass(_ctx.$style["consent-placeholder"]),
5297
+ "data-testid": "consent-loading"
5298
+ }, _cache[7] || (_cache[7] = [
5299
+ createElementVNode("span", null, null, -1),
5300
+ createElementVNode("span", null, null, -1),
5301
+ createElementVNode("span", null, null, -1)
5302
+ ]), 2)) : createCommentVNode("", true),
5086
5303
  createElementVNode("div", {
5087
5304
  class: normalizeClass(_ctx.$style["site-buttons"])
5088
5305
  }, [
@@ -5091,12 +5308,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
5091
5308
  class: "pb-w-sync_secondary-button",
5092
5309
  "data-testid": "site-back",
5093
5310
  type: "button",
5094
- onClick: _cache[4] || (_cache[4] = () => emit("back"))
5311
+ onClick: _cache[5] || (_cache[5] = () => emit("back"))
5095
5312
  }, toDisplayString(unref(t)("common.back")), 1)) : createCommentVNode("", true),
5096
5313
  createElementVNode("button", {
5097
5314
  class: "pb-w-sync_primary-button",
5098
5315
  "data-testid": "site-button",
5099
- disabled: _ctx.buttonDisabledStyle && isInvalid.value,
5316
+ disabled: submitBlocked.value,
5317
+ title: consentBlocked.value ? unref(t)("consent.required") : void 0,
5100
5318
  type: "submit"
5101
5319
  }, toDisplayString(unref(t)("common.next")), 9, _hoisted_5$1)
5102
5320
  ], 2)
@@ -5108,6 +5326,8 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
5108
5326
  }
5109
5327
  });
5110
5328
  const style0$8 = {
5329
+ "consent-placeholder": "pb-w-sync_consent-placeholder",
5330
+ "consent-pulse": "pb-w-sync_consent-pulse",
5111
5331
  "auth-error": "pb-w-sync_auth-error",
5112
5332
  "icon-eye": "pb-w-sync_icon-eye",
5113
5333
  "show-hide": "pb-w-sync_show-hide",
@@ -5601,10 +5821,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
5601
5821
  isRef(showPassword) ? showPassword.value = !unref(showPassword) : showPassword = !unref(showPassword);
5602
5822
  })
5603
5823
  }, [
5604
- !unref(showPassword) ? (openBlock(), createBlock(_sfc_main$h, {
5824
+ !unref(showPassword) ? (openBlock(), createBlock(_sfc_main$i, {
5605
5825
  key: 0,
5606
5826
  icon: "eye"
5607
- })) : (openBlock(), createBlock(_sfc_main$h, {
5827
+ })) : (openBlock(), createBlock(_sfc_main$i, {
5608
5828
  key: 1,
5609
5829
  icon: "eye-slash"
5610
5830
  }))
@@ -8016,6 +8236,10 @@ class SiteBase extends EventEmitter {
8016
8236
  constructor(site, httpService, userConfig) {
8017
8237
  super();
8018
8238
  __publicField(this, "config");
8239
+ // Set through setConsent by the form right before connecting, when the
8240
+ // integrator asked for consent. Null on every other flow, which is what keeps
8241
+ // the payload byte-for-byte identical to what it has always been.
8242
+ __publicField(this, "_consent", null);
8019
8243
  __publicField(this, "response");
8020
8244
  __publicField(this, "testMode", false);
8021
8245
  __publicField(this, "http");
@@ -8093,6 +8317,24 @@ class SiteBase extends EventEmitter {
8093
8317
  measureEvent(eventAction, params);
8094
8318
  }
8095
8319
  }
8320
+ /** The declaration this connection will carry, or null to carry none. */
8321
+ setConsent(consent) {
8322
+ this._consent = consent;
8323
+ }
8324
+ /**
8325
+ * Attach the declaration to a credential payload. The text goes exactly as the
8326
+ * backend served it, markers intact, and never a hash: the backend recomputes
8327
+ * the sha256 and rejects anything it did not serve.
8328
+ */
8329
+ withConsent(data) {
8330
+ if (!this._consent) {
8331
+ return data;
8332
+ }
8333
+ return {
8334
+ ...data,
8335
+ consent: { accepted: this._consent.accepted, text: this._consent.text }
8336
+ };
8337
+ }
8096
8338
  clearTimer() {
8097
8339
  clearTimeout(this.timer);
8098
8340
  }
@@ -8407,7 +8649,7 @@ const _SiteV4Service = class _SiteV4Service extends SiteBase {
8407
8649
  if (this.testMode) {
8408
8650
  _data.test = 1;
8409
8651
  }
8410
- return _data;
8652
+ return this.withConsent(_data);
8411
8653
  }
8412
8654
  getFields(index, updateMode = false) {
8413
8655
  if (updateMode) {
@@ -8990,7 +9232,7 @@ class SiteV1Service extends SiteBase {
8990
9232
  if (this.testMode) {
8991
9233
  _data.test = 1;
8992
9234
  }
8993
- return _data;
9235
+ return this.withConsent(_data);
8994
9236
  }
8995
9237
  getFields(updateMode = false) {
8996
9238
  if (updateMode) {
@@ -9100,7 +9342,7 @@ class SiteV3Service extends SiteBase {
9100
9342
  if (this.testMode) {
9101
9343
  _data.test = 1;
9102
9344
  }
9103
- return _data;
9345
+ return this.withConsent(_data);
9104
9346
  }
9105
9347
  getFields(index, updateMode = false) {
9106
9348
  if (updateMode) {
@@ -9170,6 +9412,14 @@ class Sync extends EventEmitter {
9170
9412
  params: { ...this.config.defaultParams, ...query }
9171
9413
  });
9172
9414
  }
9415
+ getConsent(holderType = "individual") {
9416
+ if (!this.token) {
9417
+ throw new Error("Token is required. Try calling first getToken()");
9418
+ }
9419
+ return this.http.get("/v1/consent", {
9420
+ params: { ...this.config.defaultParams, holder_type: holderType }
9421
+ });
9422
+ }
9173
9423
  getCountries() {
9174
9424
  if (!this.token) {
9175
9425
  throw new Error("Token is required. Try calling first getToken()");
@@ -9356,6 +9606,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
9356
9606
  props: {
9357
9607
  assetsPath: { default: "https://s.paybook.com" },
9358
9608
  buttonDisabledStyle: { type: Boolean, default: false },
9609
+ consent: { default: null },
9610
+ consentLoading: { type: Boolean, default: false },
9359
9611
  credential: { default: void 0 },
9360
9612
  disableFormAutocomplete: { type: Boolean, default: false },
9361
9613
  displayBackButton: { type: Boolean },
@@ -9366,9 +9618,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
9366
9618
  showPasswordStyle: { default: "icon" },
9367
9619
  site: {},
9368
9620
  testMode: { type: Boolean, default: false },
9621
+ requireConsent: { type: Boolean, default: false },
9369
9622
  updateMode: { type: Boolean, default: false }
9370
9623
  },
9371
- emits: ["back", "error", "success", "valid"],
9624
+ emits: ["back", "consent-rejected", "error", "success", "valid"],
9372
9625
  setup(__props, { emit: __emit }) {
9373
9626
  const props = __props;
9374
9627
  const emit = __emit;
@@ -9407,11 +9660,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
9407
9660
  "assets-path": props.assetsPath,
9408
9661
  "back-up-connection": true,
9409
9662
  "button-disabled-style": props.buttonDisabledStyle,
9663
+ consent: props.consent,
9664
+ "consent-loading": props.consentLoading,
9410
9665
  "credential-service": props.credential,
9411
9666
  "disable-form-autocomplete": props.disableFormAutocomplete,
9412
9667
  "display-back-button": props.displayBackButton,
9413
9668
  "error-message": props.errorMessage,
9414
9669
  "loader-message": props.loaderMessage,
9670
+ "require-consent": props.requireConsent,
9415
9671
  "select-class": props.selectClass,
9416
9672
  "show-header": false,
9417
9673
  "show-logo": props.showLogo,
@@ -9420,13 +9676,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
9420
9676
  "test-mode": props.testMode,
9421
9677
  "update-mode": props.updateMode,
9422
9678
  onBack: _cache[2] || (_cache[2] = () => emit("back")),
9423
- onError: _cache[3] || (_cache[3] = (error2) => emit("error", error2)),
9424
- onSuccess: _cache[4] || (_cache[4] = (credential) => emit("success", credential)),
9425
- onValid: _cache[5] || (_cache[5] = () => {
9679
+ onConsentRejected: _cache[3] || (_cache[3] = (kind) => emit("consent-rejected", kind)),
9680
+ onError: _cache[4] || (_cache[4] = (error2) => emit("error", error2)),
9681
+ onSuccess: _cache[5] || (_cache[5] = (credential) => emit("success", credential)),
9682
+ onValid: _cache[6] || (_cache[6] = () => {
9426
9683
  unref(rootEmit)("back-up-site-submitted");
9427
9684
  emit("valid");
9428
9685
  })
9429
- }, null, 8, ["assets-path", "button-disabled-style", "credential-service", "disable-form-autocomplete", "display-back-button", "error-message", "loader-message", "select-class", "show-logo", "show-password-style", "site", "test-mode", "update-mode"])
9686
+ }, null, 8, ["assets-path", "button-disabled-style", "consent", "consent-loading", "credential-service", "disable-form-autocomplete", "display-back-button", "error-message", "loader-message", "require-consent", "select-class", "show-logo", "show-password-style", "site", "test-mode", "update-mode"])
9430
9687
  ], 2)
9431
9688
  ], 2);
9432
9689
  };
@@ -9465,7 +9722,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9465
9722
  const rootEmit = inject(rootEmitter);
9466
9723
  const { t, locale } = useI18n({ useScope: "global" });
9467
9724
  const { mobile } = useMobile();
9468
- const countries = ref([]), countryId = ref(null), credentialFlow = ref(null), 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);
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);
9726
+ const consentCache = /* @__PURE__ */ new Map();
9469
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;
9470
9728
  const backUpSite = computed(() => {
9471
9729
  var _a;
@@ -9995,6 +10253,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9995
10253
  setInitialState();
9996
10254
  }
9997
10255
  visible.value = true;
10256
+ prefetchConsent();
9998
10257
  rootEmit("opened");
9999
10258
  }
10000
10259
  function organizationSiteBack(emit2 = true) {
@@ -10036,6 +10295,57 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10036
10295
  }
10037
10296
  });
10038
10297
  }
10298
+ function loadConsent(holderType, force = false) {
10299
+ const key = `${holderType}|${props.locale}`;
10300
+ if (!force && consentCache.has(key)) {
10301
+ return Promise.resolve(consentCache.get(key));
10302
+ }
10303
+ return sync.getConsent(holderType).then((response) => {
10304
+ consentCache.set(key, response);
10305
+ if (hasUnresolvedDocuments(response)) {
10306
+ measureEvent("consent_documents_missing", { version: response.version });
10307
+ }
10308
+ return response;
10309
+ });
10310
+ }
10311
+ function prefetchConsent() {
10312
+ if (!props.navigation.requireConsent) return;
10313
+ loadConsent("individual").catch(() => void 0);
10314
+ loadConsent("legal_entity").catch(() => void 0);
10315
+ }
10316
+ function fetchConsent(force = false) {
10317
+ if (!props.navigation.requireConsent) return;
10318
+ siteFormError.value = null;
10319
+ const businessOnly = props.navigation.displayBusinessSites && !props.navigation.displayPersonalSites, holderType = consentHolderType(siteRaw, businessOnly), cached = consentCache.get(`${holderType}|${props.locale}`);
10320
+ if (!cached || force) {
10321
+ consent.value = force ? null : cached || null;
10322
+ consentLoading.value = true;
10323
+ } else {
10324
+ consent.value = cached;
10325
+ }
10326
+ loadConsent(holderType, force).then((response) => {
10327
+ consent.value = response;
10328
+ }).catch(() => {
10329
+ consent.value = null;
10330
+ siteFormError.value = {
10331
+ long: t("consent.error"),
10332
+ short: t("consent.error")
10333
+ };
10334
+ }).finally(() => {
10335
+ consentLoading.value = false;
10336
+ });
10337
+ }
10338
+ function consentRejected(kind) {
10339
+ measureEvent("consent_rejected", { kind });
10340
+ if (kind === "stale") {
10341
+ fetchConsent(true);
10342
+ }
10343
+ const core = kind === "stale" ? "stale" : "rejected";
10344
+ siteFormError.value = {
10345
+ long: t(`consent.${core}.long_description`),
10346
+ short: t(`consent.${core}.short_description`)
10347
+ };
10348
+ }
10039
10349
  function selectSite(item, measure = true) {
10040
10350
  let thisSite;
10041
10351
  if (measure) {
@@ -10050,6 +10360,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10050
10360
  siteStatus.value = "start";
10051
10361
  finalMessage.value = null;
10052
10362
  finalLongMessage.value = null;
10363
+ fetchConsent();
10053
10364
  site.on("login-success", () => {
10054
10365
  if (visible.value && props.navigation.displayStatusInToast) {
10055
10366
  close();
@@ -11055,7 +11366,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11055
11366
  class: normalizeClass(_ctx.$style["widget-back-button"]),
11056
11367
  onClick: headerBack
11057
11368
  }, [
11058
- createVNode(_sfc_main$h, { icon: "back" })
11369
+ createVNode(_sfc_main$i, { icon: "back" })
11059
11370
  ], 10, _hoisted_1)) : (openBlock(), createElementBlock("span", _hoisted_2)),
11060
11371
  createElementVNode("h1", null, toDisplayString(siteStatus.value && props.entrypoint.site ? unref(t)("common.update_title") : title.value), 1),
11061
11372
  createElementVNode("button", {
@@ -11063,7 +11374,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11063
11374
  "aria-label": unref(t)("common.close"),
11064
11375
  onClick: close
11065
11376
  }, [
11066
- createVNode(_sfc_main$h, { icon: "close" })
11377
+ createVNode(_sfc_main$i, { icon: "close" })
11067
11378
  ], 10, _hoisted_3)
11068
11379
  ], 2),
11069
11380
  createElementVNode("div", {
@@ -11077,21 +11388,25 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11077
11388
  key: 0,
11078
11389
  "assets-path": unref(assetsPath),
11079
11390
  "button-disabled-style": props.navigation.formButtonsDisabledStyle,
11391
+ consent: consent.value,
11392
+ "consent-loading": consentLoading.value,
11080
11393
  credential: unref(credential),
11081
11394
  "disable-form-autocomplete": props.navigation.disableFormAutocomplete,
11082
11395
  "display-back-button": false,
11083
11396
  "error-message": null,
11084
11397
  "loader-message": loaderMessage.value,
11398
+ "require-consent": props.navigation.requireConsent,
11085
11399
  "select-class": props.navigation.selectClass,
11086
11400
  "show-logo": props.navigation.displayLogoImages,
11087
11401
  "show-password-style": props.navigation.formShowPasswordStyle,
11088
11402
  site: backUpSite.value,
11089
11403
  "test-mode": _ctx.enableTestMode,
11090
11404
  "update-mode": updatingCredential.value,
11405
+ onConsentRejected: consentRejected,
11091
11406
  onError: connectError,
11092
11407
  onSuccess: siteSucess,
11093
11408
  onValid: _cache[0] || (_cache[0] = () => siteSubmitted(true))
11094
- }, null, 8, ["assets-path", "button-disabled-style", "credential", "disable-form-autocomplete", "loader-message", "select-class", "show-logo", "show-password-style", "site", "test-mode", "update-mode"])) : credentialFlow.value.siteToUpdate ? (openBlock(), createBlock(SiteForm, {
11409
+ }, null, 8, ["assets-path", "button-disabled-style", "consent", "consent-loading", "credential", "disable-form-autocomplete", "loader-message", "require-consent", "select-class", "show-logo", "show-password-style", "site", "test-mode", "update-mode"])) : credentialFlow.value.siteToUpdate ? (openBlock(), createBlock(SiteForm, {
11095
11410
  key: 1,
11096
11411
  "assets-path": unref(assetsPath),
11097
11412
  "button-disabled-style": props.navigation.formButtonsDisabledStyle,
@@ -11176,38 +11491,46 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11176
11491
  key: 0,
11177
11492
  "assets-path": unref(assetsPath),
11178
11493
  "button-disabled-style": props.navigation.formButtonsDisabledStyle,
11494
+ consent: consent.value,
11495
+ "consent-loading": consentLoading.value,
11179
11496
  "disable-form-autocomplete": props.navigation.disableFormAutocomplete,
11180
11497
  "display-back-button": !(props.entrypoint.site && props.navigation.oneSiteFlow) || props.navigation.displayPrivacyScreen,
11181
11498
  "error-message": siteFormError.value,
11182
11499
  "loader-message": loaderMessage.value,
11500
+ "require-consent": props.navigation.requireConsent,
11183
11501
  "select-class": props.navigation.selectClass,
11184
11502
  "show-logo": props.navigation.displayLogoImages,
11185
11503
  "show-password-style": props.navigation.formShowPasswordStyle,
11186
11504
  site: backUpSite.value,
11187
11505
  "test-mode": _ctx.enableTestMode,
11188
11506
  onBack: siteBack,
11507
+ onConsentRejected: consentRejected,
11189
11508
  onError: connectError,
11190
11509
  onSuccess: siteSucess,
11191
11510
  onValid: _cache[3] || (_cache[3] = () => siteSubmitted(true))
11192
- }, null, 8, ["assets-path", "button-disabled-style", "disable-form-autocomplete", "display-back-button", "error-message", "loader-message", "select-class", "show-logo", "show-password-style", "site", "test-mode"])) : siteStatus.value === "start" || siteStatus.value === "loading" ? (openBlock(), createBlock(SiteForm, {
11511
+ }, 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, {
11193
11512
  key: 1,
11194
11513
  "assets-path": unref(assetsPath),
11195
11514
  "back-up-connection": !!fromBackUpConnection.value,
11196
11515
  "button-disabled-style": props.navigation.formButtonsDisabledStyle,
11516
+ consent: consent.value,
11517
+ "consent-loading": consentLoading.value,
11197
11518
  "disable-form-autocomplete": props.navigation.disableFormAutocomplete,
11198
11519
  "display-back-button": props.navigation.enableBackNavigation && fromBackUpConnection.value !== "credential" && (!(props.entrypoint.site && props.navigation.oneSiteFlow) || props.navigation.displayPrivacyScreen),
11199
11520
  "error-message": siteFormError.value,
11200
11521
  "loader-message": loaderMessage.value,
11522
+ "require-consent": props.navigation.requireConsent,
11201
11523
  "select-class": props.navigation.selectClass,
11202
11524
  "show-logo": props.navigation.displayLogoImages,
11203
11525
  "show-password-style": props.navigation.formShowPasswordStyle,
11204
11526
  site: unref(site),
11205
11527
  "test-mode": _ctx.enableTestMode,
11206
11528
  onBack: siteBack,
11529
+ onConsentRejected: consentRejected,
11207
11530
  onError: connectError,
11208
11531
  onSuccess: siteSucess,
11209
11532
  onValid: siteSubmitted
11210
- }, null, 8, ["assets-path", "back-up-connection", "button-disabled-style", "disable-form-autocomplete", "display-back-button", "error-message", "loader-message", "select-class", "show-logo", "show-password-style", "site", "test-mode"])) : siteStatus.value === "twofa" || siteStatus.value === "twofa-loading" ? (openBlock(), createBlock(TwofaForm, {
11533
+ }, null, 8, ["assets-path", "back-up-connection", "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 === "twofa" || siteStatus.value === "twofa-loading" ? (openBlock(), createBlock(TwofaForm, {
11211
11534
  key: 2,
11212
11535
  avatar: `${unref(assetsPath)}${unref(site).config.avatar}`,
11213
11536
  "button-disabled-style": props.navigation.formButtonsDisabledStyle,
@@ -11255,7 +11578,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11255
11578
  key: 2,
11256
11579
  class: normalizeClass(_ctx.$style["widget-data-error"])
11257
11580
  }, [
11258
- createVNode(_sfc_main$h, { icon: "x-circle" }),
11581
+ createVNode(_sfc_main$i, { icon: "x-circle" }),
11259
11582
  createElementVNode("h2", null, toDisplayString(unref(t)(`${dataError.value}short_description`)), 1),
11260
11583
  createElementVNode("p", null, toDisplayString(unref(t)(`${dataError.value}long_description`)), 1),
11261
11584
  createElementVNode("button", {
@@ -11267,7 +11590,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
11267
11590
  key: 3,
11268
11591
  class: normalizeClass(_ctx.$style["widget-data-error"])
11269
11592
  }, [
11270
- createVNode(_sfc_main$h, { icon: "x-circle" }),
11593
+ createVNode(_sfc_main$i, { icon: "x-circle" }),
11271
11594
  createElementVNode("p", null, toDisplayString(unref(t)("common.no_filtered_data")), 1),
11272
11595
  createElementVNode("button", {
11273
11596
  class: "pb-w-sync_primary-button",
@@ -11343,6 +11666,7 @@ const defaultConfig = {
11343
11666
  hideSites: [],
11344
11667
  oneSiteFlow: false,
11345
11668
  quickAnswer: false,
11669
+ requireConsent: false,
11346
11670
  returnToSiteFormOnUserError: false,
11347
11671
  saveCredential: true,
11348
11672
  selectClass: "",
@@ -11743,6 +12067,7 @@ class SyncfyWidget {
11743
12067
  * @param {Array} params.config.navigation.hideSites
11744
12068
  * @param {Boolean} params.config.navigation.oneSiteFlow
11745
12069
  * @param {Boolean} params.config.navigation.quickAnswer
12070
+ * @param {Boolean} params.config.navigation.requireConsent
11746
12071
  * @param {Boolean} params.config.navigation.returnToSiteFormOnUserError
11747
12072
  * @param {Boolean} params.config.navigation.saveCredential
11748
12073
  * @param {String} params.config.navigation.selectClass