@syncfy/authentication-widget 2.0.0 → 2.1.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.
@@ -722,6 +722,40 @@ const resource$1 = {
722
722
  return _normalize(["Digital Wallets"]);
723
723
  }
724
724
  },
725
+ "consent": {
726
+ "aria_label": (ctx) => {
727
+ const { normalize: _normalize } = ctx;
728
+ return _normalize(["I accept the authorization to access my banking information"]);
729
+ },
730
+ "error": (ctx) => {
731
+ const { normalize: _normalize } = ctx;
732
+ return _normalize(["The authorization could not be retrieved. Please try again."]);
733
+ },
734
+ "rejected": {
735
+ "long_description": (ctx) => {
736
+ const { normalize: _normalize } = ctx;
737
+ return _normalize(["Your contract requires the authorization to connect the account, and it was not received. Tick the box again and retry."]);
738
+ },
739
+ "short_description": (ctx) => {
740
+ const { normalize: _normalize } = ctx;
741
+ return _normalize(["Authorization missing"]);
742
+ }
743
+ },
744
+ "required": (ctx) => {
745
+ const { normalize: _normalize } = ctx;
746
+ return _normalize(["You must accept the authorization to continue."]);
747
+ },
748
+ "stale": {
749
+ "long_description": (ctx) => {
750
+ const { normalize: _normalize } = ctx;
751
+ return _normalize(["The authorization changed while you were filling the form. Read it again and accept it to continue; your details are still there."]);
752
+ },
753
+ "short_description": (ctx) => {
754
+ const { normalize: _normalize } = ctx;
755
+ return _normalize(["The authorization was updated"]);
756
+ }
757
+ }
758
+ },
725
759
  "credential": {
726
760
  "api_error": {
727
761
  "message": (ctx) => {
@@ -1882,6 +1916,40 @@ const resource = {
1882
1916
  return _normalize(["Carteras Digitales"]);
1883
1917
  }
1884
1918
  },
1919
+ "consent": {
1920
+ "aria_label": (ctx) => {
1921
+ const { normalize: _normalize } = ctx;
1922
+ return _normalize(["Acepto la autorización para acceder a mi información bancaria"]);
1923
+ },
1924
+ "error": (ctx) => {
1925
+ const { normalize: _normalize } = ctx;
1926
+ return _normalize(["No fue posible obtener la autorización. Vuelve a intentarlo."]);
1927
+ },
1928
+ "rejected": {
1929
+ "long_description": (ctx) => {
1930
+ const { normalize: _normalize } = ctx;
1931
+ 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."]);
1932
+ },
1933
+ "short_description": (ctx) => {
1934
+ const { normalize: _normalize } = ctx;
1935
+ return _normalize(["Falta la autorización"]);
1936
+ }
1937
+ },
1938
+ "required": (ctx) => {
1939
+ const { normalize: _normalize } = ctx;
1940
+ return _normalize(["Debes aceptar la autorización para continuar."]);
1941
+ },
1942
+ "stale": {
1943
+ "long_description": (ctx) => {
1944
+ const { normalize: _normalize } = ctx;
1945
+ return _normalize(["La autorización cambió mientras llenabas el formulario. Léela de nuevo y acéptala para continuar; tus datos siguen capturados."]);
1946
+ },
1947
+ "short_description": (ctx) => {
1948
+ const { normalize: _normalize } = ctx;
1949
+ return _normalize(["La autorización se actualizó"]);
1950
+ }
1951
+ }
1952
+ },
1885
1953
  "credential": {
1886
1954
  "api_error": {
1887
1955
  "message": (ctx) => {
@@ -2426,6 +2494,7 @@ const configValidator = yup.object().noUnknown().shape({
2426
2494
  hideSites: yup.array().of(yup.string()),
2427
2495
  oneSiteFlow: yup.boolean(),
2428
2496
  quickAnswer: yup.boolean(),
2497
+ requireConsent: yup.boolean(),
2429
2498
  returnToSiteFormOnUserError: yup.lazy((value) => {
2430
2499
  if (typeof value === "object") {
2431
2500
  return yup.array().of(yup.number().oneOf([401, 403, 411]));
@@ -2517,9 +2586,9 @@ const paramsValidator = yup.object().shape({
2517
2586
  }).strict().noUnknown();
2518
2587
  let __VERSION__ = {
2519
2588
  "git": {
2520
- "hash": "g422a011",
2589
+ "hash": "gf071d3a",
2521
2590
  "distance": 0,
2522
- "tag": "v2.0.0"
2591
+ "tag": "v2.1.1"
2523
2592
  }
2524
2593
  };
2525
2594
  function getVersion() {
@@ -3457,6 +3526,54 @@ async function transmitRequestMessageBridge(o, i) {
3457
3526
  }
3458
3527
  });
3459
3528
  }
3529
+ const MARKER = /\{([a-z_]+)\}/g;
3530
+ function parseConsentText(consent) {
3531
+ const documents = consent.documents || [], segments = [];
3532
+ let lastIndex = 0, match;
3533
+ MARKER.lastIndex = 0;
3534
+ while ((match = MARKER.exec(consent.text)) !== null) {
3535
+ const document2 = documents.find((item) => item.role === match[1]);
3536
+ if (match.index > lastIndex) {
3537
+ segments.push({ text: consent.text.slice(lastIndex, match.index) });
3538
+ }
3539
+ segments.push(
3540
+ document2 ? { document: document2, text: document2.label } : { text: match[0] }
3541
+ );
3542
+ lastIndex = match.index + match[0].length;
3543
+ }
3544
+ if (lastIndex < consent.text.length) {
3545
+ segments.push({ text: consent.text.slice(lastIndex) });
3546
+ }
3547
+ return segments;
3548
+ }
3549
+ function consentHolderType(site, businessOnly = false) {
3550
+ const business = (site == null ? void 0 : site.is_business) === 1, personal = (site == null ? void 0 : site.is_personal) === 1;
3551
+ if (business && !personal) {
3552
+ return "legal_entity";
3553
+ }
3554
+ if (personal && !business) {
3555
+ return "individual";
3556
+ }
3557
+ return businessOnly ? "legal_entity" : "individual";
3558
+ }
3559
+ function consentErrorKind(error2) {
3560
+ var _a, _b, _c;
3561
+ 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) || "";
3562
+ if (status === 409) {
3563
+ return "stale";
3564
+ }
3565
+ if (status === 400 && /consent/i.test(message)) {
3566
+ return "missing";
3567
+ }
3568
+ return null;
3569
+ }
3570
+ function hasUnresolvedDocuments(consent) {
3571
+ const documents = consent.documents || [];
3572
+ MARKER.lastIndex = 0;
3573
+ return Array.from(consent.text.matchAll(MARKER)).some(
3574
+ (match) => !documents.some((item) => item.role === match[1])
3575
+ );
3576
+ }
3460
3577
  const DOWNLOAD_OPTIONS_ACTIVE = {
3461
3578
  enables: ["download_options"],
3462
3579
  name: "download_options_active",
@@ -3563,14 +3680,14 @@ function getSantanderWebSocketScript() {
3563
3680
  };
3564
3681
  });
3565
3682
  }
3566
- const _hoisted_1$b = {
3683
+ const _hoisted_1$c = {
3567
3684
  key: 0,
3568
3685
  width: "30",
3569
3686
  height: "28",
3570
3687
  fill: "none",
3571
3688
  xmlns: "http://www.w3.org/2000/svg"
3572
3689
  };
3573
- const _hoisted_2$9 = {
3690
+ const _hoisted_2$a = {
3574
3691
  key: 1,
3575
3692
  xmlns: "http://www.w3.org/2000/svg",
3576
3693
  width: "23",
@@ -3655,7 +3772,7 @@ const _hoisted_11 = {
3655
3772
  "stroke-width": "1.5",
3656
3773
  "xmlns:v": "https://vecta.io/nano"
3657
3774
  };
3658
- const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
3775
+ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
3659
3776
  __name: "CustomIcon",
3660
3777
  props: {
3661
3778
  icon: {}
@@ -3663,7 +3780,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
3663
3780
  setup(__props) {
3664
3781
  const props = __props;
3665
3782
  return (_ctx, _cache) => {
3666
- return props.icon === "back" ? (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$b, _cache[0] || (_cache[0] = [
3783
+ return props.icon === "back" ? (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$c, _cache[0] || (_cache[0] = [
3667
3784
  vue.createElementVNode("path", {
3668
3785
  d: "M2 14.219h26.5M2 13.781 13.781 2M2 14.219 13.781 26",
3669
3786
  stroke: "#000",
@@ -3671,7 +3788,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
3671
3788
  "stroke-linecap": "round",
3672
3789
  "stroke-linejoin": "round"
3673
3790
  }, null, -1)
3674
- ]))) : props.icon === "close" ? (vue.openBlock(), vue.createElementBlock("svg", _hoisted_2$9, _cache[1] || (_cache[1] = [
3791
+ ]))) : props.icon === "close" ? (vue.openBlock(), vue.createElementBlock("svg", _hoisted_2$a, _cache[1] || (_cache[1] = [
3675
3792
  vue.createElementVNode("path", {
3676
3793
  d: "m2 2 18.738 18.738M2.12 21.107 20.857 2.37",
3677
3794
  stroke: "#000",
@@ -3750,8 +3867,8 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
3750
3867
  };
3751
3868
  }
3752
3869
  });
3753
- const _hoisted_1$a = ["src"];
3754
- const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
3870
+ const _hoisted_1$b = ["src"];
3871
+ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
3755
3872
  __name: "AppLoader",
3756
3873
  props: {
3757
3874
  avatar: { default: void 0 },
@@ -3798,8 +3915,8 @@ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
3798
3915
  width: "1",
3799
3916
  height: "1",
3800
3917
  onLoad: _cache[0] || (_cache[0] = () => emit("imagesLoaded"))
3801
- }, null, 40, _hoisted_1$a)) : vue.createCommentVNode("", true),
3802
- _ctx.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
3918
+ }, null, 40, _hoisted_1$b)) : vue.createCommentVNode("", true),
3919
+ _ctx.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
3803
3920
  key: 1,
3804
3921
  icon: _ctx.icon
3805
3922
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true)
@@ -3824,7 +3941,7 @@ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
3824
3941
  }
3825
3942
  });
3826
3943
  const loader = "pb-w-sync_loader";
3827
- const style0$f = {
3944
+ const style0$g = {
3828
3945
  loader,
3829
3946
  "loader-container-animation": "pb-w-sync_loader-container-animation",
3830
3947
  "loader-clip-animation": "pb-w-sync_loader-clip-animation",
@@ -3849,12 +3966,12 @@ const _export_sfc = (sfc, props) => {
3849
3966
  }
3850
3967
  return target;
3851
3968
  };
3852
- const cssModules$f = {
3853
- "$style": style0$f
3969
+ const cssModules$g = {
3970
+ "$style": style0$g
3854
3971
  };
3855
- const AppLoader = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__cssModules", cssModules$f]]);
3856
- const _hoisted_1$9 = ["disabled"];
3857
- const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
3972
+ const AppLoader = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__cssModules", cssModules$g]]);
3973
+ const _hoisted_1$a = ["disabled"];
3974
+ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
3858
3975
  __name: "AccountsSelection",
3859
3976
  props: {
3860
3977
  avatar: { default: void 0 },
@@ -4048,7 +4165,7 @@ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
4048
4165
  "data-testid": "accounts-button",
4049
4166
  disabled: _ctx.buttonDisabledStyle && isInvalid.value,
4050
4167
  type: "submit"
4051
- }, vue.toDisplayString(vue.unref(t)("accounts_selection.done")), 9, _hoisted_1$9)
4168
+ }, vue.toDisplayString(vue.unref(t)("accounts_selection.done")), 9, _hoisted_1$a)
4052
4169
  ]),
4053
4170
  _: 1
4054
4171
  }, 8, ["class", "autocomplete", "disabled", "model", "rules"])),
@@ -4067,7 +4184,7 @@ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
4067
4184
  };
4068
4185
  }
4069
4186
  });
4070
- const style0$e = {
4187
+ const style0$f = {
4071
4188
  "accounts-balance": "pb-w-sync_accounts-balance",
4072
4189
  "accounts-checkbox": "pb-w-sync_accounts-checkbox",
4073
4190
  "accounts-checkbox-content": "pb-w-sync_accounts-checkbox-content",
@@ -4078,11 +4195,11 @@ const style0$e = {
4078
4195
  "accounts-selection": "pb-w-sync_accounts-selection",
4079
4196
  "accounts-api-error": "pb-w-sync_accounts-api-error"
4080
4197
  };
4081
- const cssModules$e = {
4082
- "$style": style0$e
4198
+ const cssModules$f = {
4199
+ "$style": style0$f
4083
4200
  };
4084
- const AccountsSelection = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__cssModules", cssModules$e]]);
4085
- const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
4201
+ const AccountsSelection = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__cssModules", cssModules$f]]);
4202
+ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
4086
4203
  __name: "FinalResponse",
4087
4204
  props: {
4088
4205
  avatar: {},
@@ -4128,17 +4245,17 @@ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
4128
4245
  };
4129
4246
  }
4130
4247
  });
4131
- const style0$d = {
4248
+ const style0$e = {
4132
4249
  "final-response-container": "pb-w-sync_final-response-container"
4133
4250
  };
4134
- const cssModules$d = {
4135
- "$style": style0$d
4251
+ const cssModules$e = {
4252
+ "$style": style0$e
4136
4253
  };
4137
- const FinalResponse = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__cssModules", cssModules$d]]);
4138
- const _hoisted_1$8 = ["src"];
4139
- const _hoisted_2$8 = ["src"];
4254
+ const FinalResponse = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__cssModules", cssModules$e]]);
4255
+ const _hoisted_1$9 = ["src"];
4256
+ const _hoisted_2$9 = ["src"];
4140
4257
  const _hoisted_3$6 = ["onClick"];
4141
- const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
4258
+ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
4142
4259
  __name: "InstitutionFilters",
4143
4260
  props: {
4144
4261
  countryId: {},
@@ -4193,7 +4310,7 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
4193
4310
  width: "44",
4194
4311
  height: "44",
4195
4312
  alt: ""
4196
- }, null, 8, _hoisted_1$8)
4313
+ }, null, 8, _hoisted_1$9)
4197
4314
  ]),
4198
4315
  default: vue.withCtx(() => [
4199
4316
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filteredCountries, (country) => {
@@ -4209,7 +4326,7 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
4209
4326
  width: "44",
4210
4327
  height: "44",
4211
4328
  alt: ""
4212
- }, null, 8, _hoisted_2$8),
4329
+ }, null, 8, _hoisted_2$9),
4213
4330
  vue.createElementVNode("span", null, vue.toDisplayString(country.name), 1)
4214
4331
  ]),
4215
4332
  _: 2
@@ -4232,20 +4349,20 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
4232
4349
  };
4233
4350
  }
4234
4351
  });
4235
- const style0$c = {
4352
+ const style0$d = {
4236
4353
  "institution-filters-intro": "pb-w-sync_institution-filters-intro",
4237
4354
  "organization-types-list": "pb-w-sync_organization-types-list",
4238
4355
  "widget-country": "pb-w-sync_widget-country",
4239
4356
  "widget-country-option": "pb-w-sync_widget-country-option"
4240
4357
  };
4241
- const cssModules$c = {
4242
- "$style": style0$c
4358
+ const cssModules$d = {
4359
+ "$style": style0$d
4243
4360
  };
4244
- const InstitutionFilters = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__cssModules", cssModules$c]]);
4245
- const _hoisted_1$7 = ["onClick"];
4246
- const _hoisted_2$7 = ["alt", "src"];
4361
+ const InstitutionFilters = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__cssModules", cssModules$d]]);
4362
+ const _hoisted_1$8 = ["onClick"];
4363
+ const _hoisted_2$8 = ["alt", "src"];
4247
4364
  const _hoisted_3$5 = { key: 1 };
4248
- const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
4365
+ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
4249
4366
  __name: "OrganizationSitesList",
4250
4367
  props: {
4251
4368
  assetsPath: { default: "https://s.paybook.com" },
@@ -4311,7 +4428,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
4311
4428
  placeholder: vue.unref(t)("common.search")
4312
4429
  }, {
4313
4430
  prefix: vue.withCtx(() => [
4314
- vue.createVNode(_sfc_main$h, { icon: "search" })
4431
+ vue.createVNode(_sfc_main$i, { icon: "search" })
4315
4432
  ]),
4316
4433
  _: 1
4317
4434
  }, 8, ["modelValue", "placeholder"]),
@@ -4333,8 +4450,8 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
4333
4450
  height: "66",
4334
4451
  width: "220",
4335
4452
  onLoad: imageLoaded
4336
- }, null, 40, _hoisted_2$7)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$5, vue.toDisplayString(item.name), 1))
4337
- ], 10, _hoisted_1$7)), [
4453
+ }, null, 40, _hoisted_2$8)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$5, vue.toDisplayString(item.name), 1))
4454
+ ], 10, _hoisted_1$8)), [
4338
4455
  [vue.vShow, item.show]
4339
4456
  ]);
4340
4457
  }), 128))
@@ -4343,20 +4460,20 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
4343
4460
  };
4344
4461
  }
4345
4462
  });
4346
- const style0$b = {
4463
+ const style0$c = {
4347
4464
  "widget-plaid-container": "pb-w-sync_widget-plaid-container",
4348
4465
  "organization-sites": "pb-w-sync_organization-sites",
4349
4466
  "organization-button": "pb-w-sync_organization-button"
4350
4467
  };
4351
- const cssModules$b = {
4352
- "$style": style0$b
4468
+ const cssModules$c = {
4469
+ "$style": style0$c
4353
4470
  };
4354
- const OrganizationSitesList = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__cssModules", cssModules$b]]);
4355
- const _hoisted_1$6 = { key: 0 };
4356
- const _hoisted_2$6 = ["src"];
4471
+ const OrganizationSitesList = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__cssModules", cssModules$c]]);
4472
+ const _hoisted_1$7 = { key: 0 };
4473
+ const _hoisted_2$7 = ["src"];
4357
4474
  const _hoisted_3$4 = ["src"];
4358
4475
  const _hoisted_4$3 = ["href"];
4359
- const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
4476
+ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
4360
4477
  __name: "PrivacyPolicy",
4361
4478
  props: {
4362
4479
  client: {}
@@ -4396,12 +4513,12 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
4396
4513
  { [_ctx.$style["with-client-logo"]]: props.client.logo }
4397
4514
  ])
4398
4515
  }, [
4399
- props.client.logo ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
4516
+ props.client.logo ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
4400
4517
  vue.createElementVNode("img", {
4401
4518
  src: props.client.logo,
4402
4519
  alt: "",
4403
4520
  onLoad: imageLoaded
4404
- }, null, 40, _hoisted_2$6)
4521
+ }, null, 40, _hoisted_2$7)
4405
4522
  ])) : vue.createCommentVNode("", true),
4406
4523
  vue.createElementVNode("div", null, [
4407
4524
  vue.createElementVNode("img", {
@@ -4416,15 +4533,15 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
4416
4533
  vue.createElementVNode("h1", null, vue.toDisplayString(props.client.name ? vue.unref(t)("privacy.title_client", { client: props.client.name }) : vue.unref(t)("privacy.title")), 1),
4417
4534
  vue.createElementVNode("ul", null, [
4418
4535
  vue.createElementVNode("li", null, [
4419
- vue.createVNode(_sfc_main$h, { icon: "files" }),
4536
+ vue.createVNode(_sfc_main$i, { icon: "files" }),
4420
4537
  vue.createTextVNode(" " + vue.toDisplayString(vue.unref(t)("privacy.list.first")), 1)
4421
4538
  ]),
4422
4539
  vue.createElementVNode("li", null, [
4423
- vue.createVNode(_sfc_main$h, { icon: "lock" }),
4540
+ vue.createVNode(_sfc_main$i, { icon: "lock" }),
4424
4541
  vue.createTextVNode(" " + vue.toDisplayString(vue.unref(t)("privacy.list.second")), 1)
4425
4542
  ]),
4426
4543
  vue.createElementVNode("li", null, [
4427
- vue.createVNode(_sfc_main$h, { icon: "users" }),
4544
+ vue.createVNode(_sfc_main$i, { icon: "users" }),
4428
4545
  vue.createTextVNode(" " + vue.toDisplayString(vue.unref(t)("privacy.list.third")), 1)
4429
4546
  ])
4430
4547
  ]),
@@ -4449,16 +4566,82 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
4449
4566
  };
4450
4567
  }
4451
4568
  });
4452
- const style0$a = {
4569
+ const style0$b = {
4453
4570
  "privacy-container": "pb-w-sync_privacy-container",
4454
4571
  "privacy-center": "pb-w-sync_privacy-center",
4455
4572
  "privacy-images": "pb-w-sync_privacy-images",
4456
4573
  "with-client-logo": "pb-w-sync_with-client-logo"
4457
4574
  };
4575
+ const cssModules$b = {
4576
+ "$style": style0$b
4577
+ };
4578
+ const PrivacyPolicy = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__cssModules", cssModules$b]]);
4579
+ const _hoisted_1$6 = ["aria-label", "checked"];
4580
+ const _hoisted_2$6 = ["data-testid", "href"];
4581
+ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
4582
+ __name: "ConsentNotice",
4583
+ props: {
4584
+ consent: {},
4585
+ modelValue: { type: Boolean }
4586
+ },
4587
+ emits: ["update:modelValue"],
4588
+ setup(__props, { emit: __emit }) {
4589
+ const props = __props;
4590
+ const emit = __emit;
4591
+ const { t } = vueI18n.useI18n();
4592
+ const segments = vue.computed(() => parseConsentText(props.consent));
4593
+ function toggle(event2) {
4594
+ emit("update:modelValue", event2.target.checked);
4595
+ }
4596
+ return (_ctx, _cache) => {
4597
+ return vue.openBlock(), vue.createElementBlock("div", {
4598
+ class: vue.normalizeClass(_ctx.$style["consent-container"]),
4599
+ "data-testid": "consent"
4600
+ }, [
4601
+ vue.createElementVNode("label", {
4602
+ class: vue.normalizeClass(_ctx.$style["consent-label"])
4603
+ }, [
4604
+ vue.createElementVNode("input", {
4605
+ "aria-label": vue.unref(t)("consent.aria_label"),
4606
+ checked: props.modelValue,
4607
+ "data-testid": "consent-checkbox",
4608
+ type: "checkbox",
4609
+ onChange: toggle
4610
+ }, null, 40, _hoisted_1$6),
4611
+ vue.createElementVNode("span", {
4612
+ class: vue.normalizeClass(_ctx.$style["consent-text"]),
4613
+ "data-testid": "consent-text"
4614
+ }, [
4615
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(segments.value, (segment, index) => {
4616
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: index }, [
4617
+ segment.document ? (vue.openBlock(), vue.createElementBlock("a", {
4618
+ key: 0,
4619
+ "data-testid": `consent-document-${segment.document.role}`,
4620
+ href: segment.document.url,
4621
+ rel: "noopener noreferrer",
4622
+ target: "_blank",
4623
+ onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
4624
+ }, ["stop"]))
4625
+ }, vue.toDisplayString(segment.text), 9, _hoisted_2$6)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
4626
+ vue.createTextVNode(vue.toDisplayString(segment.text), 1)
4627
+ ], 64))
4628
+ ], 64);
4629
+ }), 128))
4630
+ ], 2)
4631
+ ], 2)
4632
+ ], 2);
4633
+ };
4634
+ }
4635
+ });
4636
+ const style0$a = {
4637
+ "consent-container": "pb-w-sync_consent-container",
4638
+ "consent-label": "pb-w-sync_consent-label",
4639
+ "consent-text": "pb-w-sync_consent-text"
4640
+ };
4458
4641
  const cssModules$a = {
4459
4642
  "$style": style0$a
4460
4643
  };
4461
- const PrivacyPolicy = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__cssModules", cssModules$a]]);
4644
+ const ConsentNotice = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__cssModules", cssModules$a]]);
4462
4645
  const _hoisted_1$5 = ["for"];
4463
4646
  const _hoisted_2$5 = ["aria-label"];
4464
4647
  const _hoisted_3$3 = ["accept", "name"];
@@ -4596,7 +4779,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
4596
4779
  class: vue.normalizeClass(_ctx.$style["widget-back-button"]),
4597
4780
  onClick: _cache[0] || (_cache[0] = ($event) => remove($event))
4598
4781
  }, [
4599
- vue.createVNode(_sfc_main$h, { icon: "x-circle" })
4782
+ vue.createVNode(_sfc_main$i, { icon: "x-circle" })
4600
4783
  ], 10, _hoisted_2$5)
4601
4784
  ], 2)) : (vue.openBlock(), vue.createElementBlock("button", {
4602
4785
  key: 1,
@@ -4651,13 +4834,14 @@ const _hoisted_1$4 = { key: 1 };
4651
4834
  const _hoisted_2$4 = ["alt", "src"];
4652
4835
  const _hoisted_3$2 = ["aria-label"];
4653
4836
  const _hoisted_4$2 = { class: "el-form-item__error" };
4654
- const _hoisted_5$1 = ["disabled"];
4837
+ const _hoisted_5$1 = ["disabled", "title"];
4655
4838
  const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
4656
4839
  __name: "SiteForm",
4657
4840
  props: {
4658
4841
  assetsPath: { default: "https://s.paybook.com" },
4659
4842
  backUpConnection: { type: Boolean, default: false },
4660
4843
  buttonDisabledStyle: { type: Boolean, default: false },
4844
+ consent: { default: null },
4661
4845
  credentialService: { default: null },
4662
4846
  disableFormAutocomplete: { type: Boolean, default: false },
4663
4847
  displayBackButton: { type: Boolean },
@@ -4667,21 +4851,29 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
4667
4851
  showHeader: { type: Boolean, default: true },
4668
4852
  showLogo: { type: Boolean, default: true },
4669
4853
  showPasswordStyle: { default: "icon" },
4854
+ consentLoading: { type: Boolean, default: false },
4855
+ requireConsent: { type: Boolean, default: false },
4670
4856
  site: {},
4671
4857
  testMode: { type: Boolean, default: false },
4672
4858
  updateMode: { type: Boolean, default: false }
4673
4859
  },
4674
- emits: ["back", "error", "success", "valid"],
4860
+ emits: ["back", "consent-rejected", "error", "success", "valid"],
4675
4861
  setup(__props, { emit: __emit }) {
4676
4862
  const props = __props;
4677
4863
  const emit = __emit;
4678
4864
  const rootEmit = vue.inject(rootEmitter);
4679
4865
  const activeIndex = vue.ref("0"), formData = vue.ref({
4680
4866
  ...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
4681
- }), isInvalid = vue.ref(true), loading = vue.ref(false), showPassword = vue.ref(false), submittedWithError = vue.ref(false), testMode = vue.ref(false);
4867
+ }), consentAccepted = vue.ref(false), isInvalid = vue.ref(true), loading = vue.ref(false), showPassword = vue.ref(false), submittedWithError = vue.ref(false), testMode = vue.ref(false);
4682
4868
  let testModeCounter = 0, testModeTimeout = null, validSiteFormFields = {};
4683
4869
  const firstInput = vue.ref(null), siteFormRef = vue.ref(null);
4684
- const credentials = vue.computed(() => {
4870
+ const consentRequired = vue.computed(
4871
+ () => props.requireConsent && !props.updateMode
4872
+ ), consentBlocked = vue.computed(
4873
+ () => consentRequired.value && (!props.consent || !consentAccepted.value)
4874
+ ), submitBlocked = vue.computed(
4875
+ () => consentBlocked.value || (props.buttonDisabledStyle || consentRequired.value) && isInvalid.value
4876
+ ), credentials = vue.computed(() => {
4685
4877
  if (isSiteV1Service(props.site)) {
4686
4878
  return props.site.getFields(props.updateMode);
4687
4879
  } else if (isSiteV3Service(props.site)) {
@@ -4807,6 +4999,10 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
4807
4999
  event2.preventDefault();
4808
5000
  let connectPromise;
4809
5001
  if (!formEl) return;
5002
+ if (consentBlocked.value) return;
5003
+ props.site.setConsent(
5004
+ consentRequired.value ? { accepted: consentAccepted.value, text: props.consent.text } : null
5005
+ );
4810
5006
  await formEl.validate((valid) => {
4811
5007
  if (valid && !isInvalid.value) {
4812
5008
  emit("valid");
@@ -4840,6 +5036,13 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
4840
5036
  }
4841
5037
  return response;
4842
5038
  }).catch((error2) => {
5039
+ const consentKind = consentRequired.value ? consentErrorKind(error2) : null;
5040
+ if (consentKind) {
5041
+ consentAccepted.value = false;
5042
+ loading.value = false;
5043
+ emit("consent-rejected", consentKind);
5044
+ return;
5045
+ }
4843
5046
  formData.value = {};
4844
5047
  validateChanged();
4845
5048
  emit("error", error2);
@@ -4958,7 +5161,7 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
4958
5161
  model: formData.value,
4959
5162
  name: `${_ctx.site.config.id_site}`,
4960
5163
  rules: rules.value,
4961
- onSubmit: _cache[5] || (_cache[5] = (event2) => submit(event2, siteFormRef.value)),
5164
+ onSubmit: _cache[6] || (_cache[6] = (event2) => submit(event2, siteFormRef.value)),
4962
5165
  onValidate: validateChanged
4963
5166
  }, {
4964
5167
  default: vue.withCtx(() => [
@@ -5010,10 +5213,10 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
5010
5213
  showPassword.value = !showPassword.value;
5011
5214
  })
5012
5215
  }, [
5013
- showPassword.value ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
5216
+ showPassword.value ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
5014
5217
  key: 0,
5015
5218
  icon: "eye-slash"
5016
- })) : (vue.openBlock(), vue.createBlock(_sfc_main$h, {
5219
+ })) : (vue.openBlock(), vue.createBlock(_sfc_main$i, {
5017
5220
  key: 1,
5018
5221
  icon: "eye"
5019
5222
  }))
@@ -5085,6 +5288,20 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
5085
5288
  ], 64)) : vue.createCommentVNode("", true)
5086
5289
  ], 64);
5087
5290
  }), 128)),
5291
+ consentRequired.value && _ctx.consent ? (vue.openBlock(), vue.createBlock(ConsentNotice, {
5292
+ key: 0,
5293
+ modelValue: consentAccepted.value,
5294
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => consentAccepted.value = $event),
5295
+ consent: _ctx.consent
5296
+ }, null, 8, ["modelValue", "consent"])) : consentRequired.value && _ctx.consentLoading ? (vue.openBlock(), vue.createElementBlock("div", {
5297
+ key: 1,
5298
+ class: vue.normalizeClass(_ctx.$style["consent-placeholder"]),
5299
+ "data-testid": "consent-loading"
5300
+ }, _cache[7] || (_cache[7] = [
5301
+ vue.createElementVNode("span", null, null, -1),
5302
+ vue.createElementVNode("span", null, null, -1),
5303
+ vue.createElementVNode("span", null, null, -1)
5304
+ ]), 2)) : vue.createCommentVNode("", true),
5088
5305
  vue.createElementVNode("div", {
5089
5306
  class: vue.normalizeClass(_ctx.$style["site-buttons"])
5090
5307
  }, [
@@ -5093,12 +5310,13 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
5093
5310
  class: "pb-w-sync_secondary-button",
5094
5311
  "data-testid": "site-back",
5095
5312
  type: "button",
5096
- onClick: _cache[4] || (_cache[4] = () => emit("back"))
5313
+ onClick: _cache[5] || (_cache[5] = () => emit("back"))
5097
5314
  }, vue.toDisplayString(vue.unref(t)("common.back")), 1)) : vue.createCommentVNode("", true),
5098
5315
  vue.createElementVNode("button", {
5099
5316
  class: "pb-w-sync_primary-button",
5100
5317
  "data-testid": "site-button",
5101
- disabled: _ctx.buttonDisabledStyle && isInvalid.value,
5318
+ disabled: submitBlocked.value,
5319
+ title: consentBlocked.value ? vue.unref(t)("consent.required") : void 0,
5102
5320
  type: "submit"
5103
5321
  }, vue.toDisplayString(vue.unref(t)("common.next")), 9, _hoisted_5$1)
5104
5322
  ], 2)
@@ -5110,6 +5328,8 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
5110
5328
  }
5111
5329
  });
5112
5330
  const style0$8 = {
5331
+ "consent-placeholder": "pb-w-sync_consent-placeholder",
5332
+ "consent-pulse": "pb-w-sync_consent-pulse",
5113
5333
  "auth-error": "pb-w-sync_auth-error",
5114
5334
  "icon-eye": "pb-w-sync_icon-eye",
5115
5335
  "show-hide": "pb-w-sync_show-hide",
@@ -5369,8 +5589,8 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
5369
5589
  const props = __props;
5370
5590
  const emit = __emit;
5371
5591
  const rootEmit = vue.inject(rootEmitter), t = vue.inject(translateFunction);
5372
- const arrayData = vue.ref({}), data = vue.ref({ ...props.twofa.data }), imageSize = vue.ref({}), imageWithoutSize = vue.ref([]), loading = vue.ref(false);
5373
- let imagesLoaded = 0, isInvalid = true, showPassword = false, validSiteFormFields = {};
5592
+ const arrayData = vue.ref({}), data = vue.ref({ ...props.twofa.data }), imageSize = vue.ref({}), imageWithoutSize = vue.ref([]), isInvalid = vue.ref(true), loading = vue.ref(false);
5593
+ let imagesLoaded = 0, showPassword = false, validSiteFormFields = {};
5374
5594
  const imagesCount = vue.computed(() => {
5375
5595
  return props.twofa.config.twofa.reduce(
5376
5596
  (count, credential) => credential.imgBase64File ? count + 1 : count,
@@ -5445,7 +5665,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
5445
5665
  imageWithoutSize.value = [];
5446
5666
  loading.value = false;
5447
5667
  imagesLoaded = 0;
5448
- isInvalid = true;
5668
+ isInvalid.value = true;
5449
5669
  showPassword = false;
5450
5670
  validSiteFormFields = {};
5451
5671
  props.twofa.defineRules(t);
@@ -5489,7 +5709,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
5489
5709
  if (name) {
5490
5710
  validSiteFormFields[name] = valid;
5491
5711
  }
5492
- isInvalid = Object.getOwnPropertyNames(rules).reduce(
5712
+ isInvalid.value = Object.getOwnPropertyNames(rules).reduce(
5493
5713
  (isInvalidObject, key) => key === "__ob__" || rules[key].length === 0 ? isInvalidObject : isInvalidObject || !validSiteFormFields[key],
5494
5714
  false
5495
5715
  );
@@ -5603,10 +5823,10 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
5603
5823
  vue.isRef(showPassword) ? showPassword.value = !vue.unref(showPassword) : showPassword = !vue.unref(showPassword);
5604
5824
  })
5605
5825
  }, [
5606
- !vue.unref(showPassword) ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
5826
+ !vue.unref(showPassword) ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
5607
5827
  key: 0,
5608
5828
  icon: "eye"
5609
- })) : (vue.openBlock(), vue.createBlock(_sfc_main$h, {
5829
+ })) : (vue.openBlock(), vue.createBlock(_sfc_main$i, {
5610
5830
  key: 1,
5611
5831
  icon: "eye-slash"
5612
5832
  }))
@@ -5706,7 +5926,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
5706
5926
  props.twofa.displaySubmitButton ? (vue.openBlock(), vue.createElementBlock("button", {
5707
5927
  key: 1,
5708
5928
  class: "pb-w-sync_primary-button",
5709
- disabled: props.buttonDisabledStyle && vue.unref(isInvalid),
5929
+ disabled: props.buttonDisabledStyle && isInvalid.value,
5710
5930
  "data-testid": "twofa-button",
5711
5931
  type: "submit"
5712
5932
  }, vue.toDisplayString(vue.unref(t)("common.next")), 9, _hoisted_8)) : vue.createCommentVNode("", true)
@@ -8018,6 +8238,10 @@ class SiteBase extends events.EventEmitter {
8018
8238
  constructor(site, httpService, userConfig) {
8019
8239
  super();
8020
8240
  __publicField(this, "config");
8241
+ // Set through setConsent by the form right before connecting, when the
8242
+ // integrator asked for consent. Null on every other flow, which is what keeps
8243
+ // the payload byte-for-byte identical to what it has always been.
8244
+ __publicField(this, "_consent", null);
8021
8245
  __publicField(this, "response");
8022
8246
  __publicField(this, "testMode", false);
8023
8247
  __publicField(this, "http");
@@ -8095,6 +8319,24 @@ class SiteBase extends events.EventEmitter {
8095
8319
  measureEvent(eventAction, params);
8096
8320
  }
8097
8321
  }
8322
+ /** The declaration this connection will carry, or null to carry none. */
8323
+ setConsent(consent) {
8324
+ this._consent = consent;
8325
+ }
8326
+ /**
8327
+ * Attach the declaration to a credential payload. The text goes exactly as the
8328
+ * backend served it, markers intact, and never a hash: the backend recomputes
8329
+ * the sha256 and rejects anything it did not serve.
8330
+ */
8331
+ withConsent(data) {
8332
+ if (!this._consent) {
8333
+ return data;
8334
+ }
8335
+ return {
8336
+ ...data,
8337
+ consent: { accepted: this._consent.accepted, text: this._consent.text }
8338
+ };
8339
+ }
8098
8340
  clearTimer() {
8099
8341
  clearTimeout(this.timer);
8100
8342
  }
@@ -8409,7 +8651,7 @@ const _SiteV4Service = class _SiteV4Service extends SiteBase {
8409
8651
  if (this.testMode) {
8410
8652
  _data.test = 1;
8411
8653
  }
8412
- return _data;
8654
+ return this.withConsent(_data);
8413
8655
  }
8414
8656
  getFields(index, updateMode = false) {
8415
8657
  if (updateMode) {
@@ -8992,7 +9234,7 @@ class SiteV1Service extends SiteBase {
8992
9234
  if (this.testMode) {
8993
9235
  _data.test = 1;
8994
9236
  }
8995
- return _data;
9237
+ return this.withConsent(_data);
8996
9238
  }
8997
9239
  getFields(updateMode = false) {
8998
9240
  if (updateMode) {
@@ -9102,7 +9344,7 @@ class SiteV3Service extends SiteBase {
9102
9344
  if (this.testMode) {
9103
9345
  _data.test = 1;
9104
9346
  }
9105
- return _data;
9347
+ return this.withConsent(_data);
9106
9348
  }
9107
9349
  getFields(index, updateMode = false) {
9108
9350
  if (updateMode) {
@@ -9172,6 +9414,14 @@ class Sync extends events.EventEmitter {
9172
9414
  params: { ...this.config.defaultParams, ...query }
9173
9415
  });
9174
9416
  }
9417
+ getConsent(holderType = "individual") {
9418
+ if (!this.token) {
9419
+ throw new Error("Token is required. Try calling first getToken()");
9420
+ }
9421
+ return this.http.get("/v1/consent", {
9422
+ params: { ...this.config.defaultParams, holder_type: holderType }
9423
+ });
9424
+ }
9175
9425
  getCountries() {
9176
9426
  if (!this.token) {
9177
9427
  throw new Error("Token is required. Try calling first getToken()");
@@ -9358,6 +9608,8 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
9358
9608
  props: {
9359
9609
  assetsPath: { default: "https://s.paybook.com" },
9360
9610
  buttonDisabledStyle: { type: Boolean, default: false },
9611
+ consent: { default: null },
9612
+ consentLoading: { type: Boolean, default: false },
9361
9613
  credential: { default: void 0 },
9362
9614
  disableFormAutocomplete: { type: Boolean, default: false },
9363
9615
  displayBackButton: { type: Boolean },
@@ -9368,9 +9620,10 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
9368
9620
  showPasswordStyle: { default: "icon" },
9369
9621
  site: {},
9370
9622
  testMode: { type: Boolean, default: false },
9623
+ requireConsent: { type: Boolean, default: false },
9371
9624
  updateMode: { type: Boolean, default: false }
9372
9625
  },
9373
- emits: ["back", "error", "success", "valid"],
9626
+ emits: ["back", "consent-rejected", "error", "success", "valid"],
9374
9627
  setup(__props, { emit: __emit }) {
9375
9628
  const props = __props;
9376
9629
  const emit = __emit;
@@ -9409,11 +9662,14 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
9409
9662
  "assets-path": props.assetsPath,
9410
9663
  "back-up-connection": true,
9411
9664
  "button-disabled-style": props.buttonDisabledStyle,
9665
+ consent: props.consent,
9666
+ "consent-loading": props.consentLoading,
9412
9667
  "credential-service": props.credential,
9413
9668
  "disable-form-autocomplete": props.disableFormAutocomplete,
9414
9669
  "display-back-button": props.displayBackButton,
9415
9670
  "error-message": props.errorMessage,
9416
9671
  "loader-message": props.loaderMessage,
9672
+ "require-consent": props.requireConsent,
9417
9673
  "select-class": props.selectClass,
9418
9674
  "show-header": false,
9419
9675
  "show-logo": props.showLogo,
@@ -9422,13 +9678,14 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
9422
9678
  "test-mode": props.testMode,
9423
9679
  "update-mode": props.updateMode,
9424
9680
  onBack: _cache[2] || (_cache[2] = () => emit("back")),
9425
- onError: _cache[3] || (_cache[3] = (error2) => emit("error", error2)),
9426
- onSuccess: _cache[4] || (_cache[4] = (credential) => emit("success", credential)),
9427
- onValid: _cache[5] || (_cache[5] = () => {
9681
+ onConsentRejected: _cache[3] || (_cache[3] = (kind) => emit("consent-rejected", kind)),
9682
+ onError: _cache[4] || (_cache[4] = (error2) => emit("error", error2)),
9683
+ onSuccess: _cache[5] || (_cache[5] = (credential) => emit("success", credential)),
9684
+ onValid: _cache[6] || (_cache[6] = () => {
9428
9685
  vue.unref(rootEmit)("back-up-site-submitted");
9429
9686
  emit("valid");
9430
9687
  })
9431
- }, 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"])
9688
+ }, 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"])
9432
9689
  ], 2)
9433
9690
  ], 2);
9434
9691
  };
@@ -9467,7 +9724,8 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
9467
9724
  const rootEmit = vue.inject(rootEmitter);
9468
9725
  const { t, locale } = vueI18n.useI18n({ useScope: "global" });
9469
9726
  const { mobile } = useMobile();
9470
- const countries = vue.ref([]), countryId = vue.ref(null), credentialFlow = vue.ref(null), dataError = vue.ref(false), displayBackUpConnection = vue.ref(false), finalLongMessage = vue.ref(null), finalMessage = vue.ref(null), fromBackUpConnection = vue.ref(null), infoLongMessage = vue.ref(""), infoMessage = vue.ref(""), inPrivacyPolicy = vue.ref(props.navigation.displayPrivacyScreen), loading = vue.ref(true), noFilteredData = vue.ref(false), organizationSiteId = vue.ref(null), organizationSites = vue.ref([]), organizationTypeId = vue.ref(null), selectingAccounts = vue.ref(false), siteStatus = vue.ref(null), siteFormError = vue.ref(null), updatingCredential = vue.ref(false), visible = vue.ref(false);
9727
+ const countries = vue.ref([]), countryId = vue.ref(null), credentialFlow = vue.ref(null), consent = vue.ref(null), consentLoading = vue.ref(false), dataError = vue.ref(false), displayBackUpConnection = vue.ref(false), finalLongMessage = vue.ref(null), finalMessage = vue.ref(null), fromBackUpConnection = vue.ref(null), infoLongMessage = vue.ref(""), infoMessage = vue.ref(""), inPrivacyPolicy = vue.ref(props.navigation.displayPrivacyScreen), loading = vue.ref(true), noFilteredData = vue.ref(false), organizationSiteId = vue.ref(null), organizationSites = vue.ref([]), organizationTypeId = vue.ref(null), selectingAccounts = vue.ref(false), siteStatus = vue.ref(null), siteFormError = vue.ref(null), updatingCredential = vue.ref(false), visible = vue.ref(false);
9728
+ const consentCache = /* @__PURE__ */ new Map();
9471
9729
  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;
9472
9730
  const backUpSite = vue.computed(() => {
9473
9731
  var _a;
@@ -9997,6 +10255,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
9997
10255
  setInitialState();
9998
10256
  }
9999
10257
  visible.value = true;
10258
+ prefetchConsent();
10000
10259
  rootEmit("opened");
10001
10260
  }
10002
10261
  function organizationSiteBack(emit2 = true) {
@@ -10038,6 +10297,57 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
10038
10297
  }
10039
10298
  });
10040
10299
  }
10300
+ function loadConsent(holderType, force = false) {
10301
+ const key = `${holderType}|${props.locale}`;
10302
+ if (!force && consentCache.has(key)) {
10303
+ return Promise.resolve(consentCache.get(key));
10304
+ }
10305
+ return sync.getConsent(holderType).then((response) => {
10306
+ consentCache.set(key, response);
10307
+ if (hasUnresolvedDocuments(response)) {
10308
+ measureEvent("consent_documents_missing", { version: response.version });
10309
+ }
10310
+ return response;
10311
+ });
10312
+ }
10313
+ function prefetchConsent() {
10314
+ if (!props.navigation.requireConsent) return;
10315
+ loadConsent("individual").catch(() => void 0);
10316
+ loadConsent("legal_entity").catch(() => void 0);
10317
+ }
10318
+ function fetchConsent(force = false) {
10319
+ if (!props.navigation.requireConsent) return;
10320
+ siteFormError.value = null;
10321
+ const businessOnly = props.navigation.displayBusinessSites && !props.navigation.displayPersonalSites, holderType = consentHolderType(siteRaw, businessOnly), cached = consentCache.get(`${holderType}|${props.locale}`);
10322
+ if (!cached || force) {
10323
+ consent.value = force ? null : cached || null;
10324
+ consentLoading.value = true;
10325
+ } else {
10326
+ consent.value = cached;
10327
+ }
10328
+ loadConsent(holderType, force).then((response) => {
10329
+ consent.value = response;
10330
+ }).catch(() => {
10331
+ consent.value = null;
10332
+ siteFormError.value = {
10333
+ long: t("consent.error"),
10334
+ short: t("consent.error")
10335
+ };
10336
+ }).finally(() => {
10337
+ consentLoading.value = false;
10338
+ });
10339
+ }
10340
+ function consentRejected(kind) {
10341
+ measureEvent("consent_rejected", { kind });
10342
+ if (kind === "stale") {
10343
+ fetchConsent(true);
10344
+ }
10345
+ const core = kind === "stale" ? "stale" : "rejected";
10346
+ siteFormError.value = {
10347
+ long: t(`consent.${core}.long_description`),
10348
+ short: t(`consent.${core}.short_description`)
10349
+ };
10350
+ }
10041
10351
  function selectSite(item, measure = true) {
10042
10352
  let thisSite;
10043
10353
  if (measure) {
@@ -10052,6 +10362,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
10052
10362
  siteStatus.value = "start";
10053
10363
  finalMessage.value = null;
10054
10364
  finalLongMessage.value = null;
10365
+ fetchConsent();
10055
10366
  site.on("login-success", () => {
10056
10367
  if (visible.value && props.navigation.displayStatusInToast) {
10057
10368
  close();
@@ -11057,7 +11368,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
11057
11368
  class: vue.normalizeClass(_ctx.$style["widget-back-button"]),
11058
11369
  onClick: headerBack
11059
11370
  }, [
11060
- vue.createVNode(_sfc_main$h, { icon: "back" })
11371
+ vue.createVNode(_sfc_main$i, { icon: "back" })
11061
11372
  ], 10, _hoisted_1)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_2)),
11062
11373
  vue.createElementVNode("h1", null, vue.toDisplayString(siteStatus.value && props.entrypoint.site ? vue.unref(t)("common.update_title") : title.value), 1),
11063
11374
  vue.createElementVNode("button", {
@@ -11065,7 +11376,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
11065
11376
  "aria-label": vue.unref(t)("common.close"),
11066
11377
  onClick: close
11067
11378
  }, [
11068
- vue.createVNode(_sfc_main$h, { icon: "close" })
11379
+ vue.createVNode(_sfc_main$i, { icon: "close" })
11069
11380
  ], 10, _hoisted_3)
11070
11381
  ], 2),
11071
11382
  vue.createElementVNode("div", {
@@ -11079,21 +11390,25 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
11079
11390
  key: 0,
11080
11391
  "assets-path": vue.unref(assetsPath),
11081
11392
  "button-disabled-style": props.navigation.formButtonsDisabledStyle,
11393
+ consent: consent.value,
11394
+ "consent-loading": consentLoading.value,
11082
11395
  credential: vue.unref(credential),
11083
11396
  "disable-form-autocomplete": props.navigation.disableFormAutocomplete,
11084
11397
  "display-back-button": false,
11085
11398
  "error-message": null,
11086
11399
  "loader-message": loaderMessage.value,
11400
+ "require-consent": props.navigation.requireConsent,
11087
11401
  "select-class": props.navigation.selectClass,
11088
11402
  "show-logo": props.navigation.displayLogoImages,
11089
11403
  "show-password-style": props.navigation.formShowPasswordStyle,
11090
11404
  site: backUpSite.value,
11091
11405
  "test-mode": _ctx.enableTestMode,
11092
11406
  "update-mode": updatingCredential.value,
11407
+ onConsentRejected: consentRejected,
11093
11408
  onError: connectError,
11094
11409
  onSuccess: siteSucess,
11095
11410
  onValid: _cache[0] || (_cache[0] = () => siteSubmitted(true))
11096
- }, 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 ? (vue.openBlock(), vue.createBlock(SiteForm, {
11411
+ }, 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 ? (vue.openBlock(), vue.createBlock(SiteForm, {
11097
11412
  key: 1,
11098
11413
  "assets-path": vue.unref(assetsPath),
11099
11414
  "button-disabled-style": props.navigation.formButtonsDisabledStyle,
@@ -11178,38 +11493,46 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
11178
11493
  key: 0,
11179
11494
  "assets-path": vue.unref(assetsPath),
11180
11495
  "button-disabled-style": props.navigation.formButtonsDisabledStyle,
11496
+ consent: consent.value,
11497
+ "consent-loading": consentLoading.value,
11181
11498
  "disable-form-autocomplete": props.navigation.disableFormAutocomplete,
11182
11499
  "display-back-button": !(props.entrypoint.site && props.navigation.oneSiteFlow) || props.navigation.displayPrivacyScreen,
11183
11500
  "error-message": siteFormError.value,
11184
11501
  "loader-message": loaderMessage.value,
11502
+ "require-consent": props.navigation.requireConsent,
11185
11503
  "select-class": props.navigation.selectClass,
11186
11504
  "show-logo": props.navigation.displayLogoImages,
11187
11505
  "show-password-style": props.navigation.formShowPasswordStyle,
11188
11506
  site: backUpSite.value,
11189
11507
  "test-mode": _ctx.enableTestMode,
11190
11508
  onBack: siteBack,
11509
+ onConsentRejected: consentRejected,
11191
11510
  onError: connectError,
11192
11511
  onSuccess: siteSucess,
11193
11512
  onValid: _cache[3] || (_cache[3] = () => siteSubmitted(true))
11194
- }, 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" ? (vue.openBlock(), vue.createBlock(SiteForm, {
11513
+ }, 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" ? (vue.openBlock(), vue.createBlock(SiteForm, {
11195
11514
  key: 1,
11196
11515
  "assets-path": vue.unref(assetsPath),
11197
11516
  "back-up-connection": !!fromBackUpConnection.value,
11198
11517
  "button-disabled-style": props.navigation.formButtonsDisabledStyle,
11518
+ consent: consent.value,
11519
+ "consent-loading": consentLoading.value,
11199
11520
  "disable-form-autocomplete": props.navigation.disableFormAutocomplete,
11200
11521
  "display-back-button": props.navigation.enableBackNavigation && fromBackUpConnection.value !== "credential" && (!(props.entrypoint.site && props.navigation.oneSiteFlow) || props.navigation.displayPrivacyScreen),
11201
11522
  "error-message": siteFormError.value,
11202
11523
  "loader-message": loaderMessage.value,
11524
+ "require-consent": props.navigation.requireConsent,
11203
11525
  "select-class": props.navigation.selectClass,
11204
11526
  "show-logo": props.navigation.displayLogoImages,
11205
11527
  "show-password-style": props.navigation.formShowPasswordStyle,
11206
11528
  site: vue.unref(site),
11207
11529
  "test-mode": _ctx.enableTestMode,
11208
11530
  onBack: siteBack,
11531
+ onConsentRejected: consentRejected,
11209
11532
  onError: connectError,
11210
11533
  onSuccess: siteSucess,
11211
11534
  onValid: siteSubmitted
11212
- }, 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" ? (vue.openBlock(), vue.createBlock(TwofaForm, {
11535
+ }, 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" ? (vue.openBlock(), vue.createBlock(TwofaForm, {
11213
11536
  key: 2,
11214
11537
  avatar: `${vue.unref(assetsPath)}${vue.unref(site).config.avatar}`,
11215
11538
  "button-disabled-style": props.navigation.formButtonsDisabledStyle,
@@ -11257,7 +11580,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
11257
11580
  key: 2,
11258
11581
  class: vue.normalizeClass(_ctx.$style["widget-data-error"])
11259
11582
  }, [
11260
- vue.createVNode(_sfc_main$h, { icon: "x-circle" }),
11583
+ vue.createVNode(_sfc_main$i, { icon: "x-circle" }),
11261
11584
  vue.createElementVNode("h2", null, vue.toDisplayString(vue.unref(t)(`${dataError.value}short_description`)), 1),
11262
11585
  vue.createElementVNode("p", null, vue.toDisplayString(vue.unref(t)(`${dataError.value}long_description`)), 1),
11263
11586
  vue.createElementVNode("button", {
@@ -11269,7 +11592,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
11269
11592
  key: 3,
11270
11593
  class: vue.normalizeClass(_ctx.$style["widget-data-error"])
11271
11594
  }, [
11272
- vue.createVNode(_sfc_main$h, { icon: "x-circle" }),
11595
+ vue.createVNode(_sfc_main$i, { icon: "x-circle" }),
11273
11596
  vue.createElementVNode("p", null, vue.toDisplayString(vue.unref(t)("common.no_filtered_data")), 1),
11274
11597
  vue.createElementVNode("button", {
11275
11598
  class: "pb-w-sync_primary-button",
@@ -11345,6 +11668,7 @@ const defaultConfig = {
11345
11668
  hideSites: [],
11346
11669
  oneSiteFlow: false,
11347
11670
  quickAnswer: false,
11671
+ requireConsent: false,
11348
11672
  returnToSiteFormOnUserError: false,
11349
11673
  saveCredential: true,
11350
11674
  selectClass: "",
@@ -11745,6 +12069,7 @@ class SyncfyWidget {
11745
12069
  * @param {Array} params.config.navigation.hideSites
11746
12070
  * @param {Boolean} params.config.navigation.oneSiteFlow
11747
12071
  * @param {Boolean} params.config.navigation.quickAnswer
12072
+ * @param {Boolean} params.config.navigation.requireConsent
11748
12073
  * @param {Boolean} params.config.navigation.returnToSiteFormOnUserError
11749
12074
  * @param {Boolean} params.config.navigation.saveCredential
11750
12075
  * @param {String} params.config.navigation.selectClass