bookito-widget 1.4.0-beta.3 → 1.4.0-beta.4
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.
- package/dist/bookito-widget.css +1 -1
- package/dist/bookito-widget.iife.js +32 -32
- package/dist/bookito-widget.js +4520 -4311
- package/dist/bookito-widget.loader.js +1 -1
- package/dist/bookito-widget.umd.js +1 -1
- package/dist/bookito-widget.window.js +1 -1
- package/dist/src/app/i18n/index.d.ts +100 -0
- package/dist/src/app/i18n/locales/de.d.ts +10 -0
- package/dist/src/app/i18n/locales/en.d.ts +10 -0
- package/dist/src/app/i18n/locales/fr.d.ts +10 -0
- package/dist/src/app/i18n/locales/it.d.ts +10 -0
- package/dist/src/app/i18n/locales/pl.d.ts +10 -0
- package/dist/src/embed/preview-api-flag.d.ts +6 -0
- package/dist/src/features/preview-api/api/preview-api-health.client.d.ts +8 -0
- package/dist/src/features/preview-api/components/PreviewApiFlag.vue.d.ts +2 -0
- package/dist/src/features/preview-api/composables/usePreviewApiFlag.d.ts +18 -0
- package/dist/src/features/preview-api/model/preview-api.types.d.ts +10 -0
- package/dist/src/shared/api/api-override-storage.d.ts +8 -0
- package/dist/src/shared/api/api-override.d.ts +27 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var e={carlito_federation:{production:`https://federation-prod.carlito-app.com`,prerelease:`https://federation-staging.carlito-app.com`,development:`https://federation-staging.carlito-app.com`},gateway:{production:`https://epificcu94.execute-api.eu-central-1.amazonaws.com/production`,prerelease:`https://4kkst32tm6.execute-api.eu-central-1.amazonaws.com/staging`,development:`https://4kkst32tm6.execute-api.eu-central-1.amazonaws.com/staging`},main_content:{development:`https://strapi-dev.carlito-app.com`,prerelease:`https://strapi-dev.carlito-app.com`,production:`https://strapi-prod.carlito-app.com`}};function
|
|
1
|
+
(function(){var e=`carlito-api-override`;function t(){try{let e=JSON.parse(globalThis.sessionStorage.getItem(`carlito-api-override`)??`null`);return i(e)?{setAt:e.setAt,url:e.url}:null}catch{return null}}function n(t){try{globalThis.sessionStorage.setItem(e,JSON.stringify(t))}catch{}}function r(){try{globalThis.sessionStorage.removeItem(e)}catch{}}function i(e){return typeof e==`object`&&!!e&&`url`in e&&typeof e.url==`string`&&`setAt`in e&&typeof e.setAt==`number`}var a=/^[a-z0-9]+\.eu-central-1\.awsapprunner\.com$/,o;function s(e){let t=u(e?.trim()??``);return!t||t.protocol!==`https:`||t.port?``:a.test(t.hostname)?t.origin:``}function c(){return globalThis.window===void 0?``:(o??=l(Date.now()),o)}function l(e){let i=new URLSearchParams(globalThis.location.search);if(i.has(`api`)){let t=s(i.get(`api`));return t?(n({setAt:e,url:t}),t):(r(),``)}let a=t(),o=s(a?.url);return!a||!o||e-a.setAt>288e5?(r(),``):o}function u(e){try{return e?new URL(e):null}catch{return null}}var d={carlito_federation:{production:`https://federation-prod.carlito-app.com`,prerelease:`https://federation-staging.carlito-app.com`,development:`https://federation-staging.carlito-app.com`},gateway:{production:`https://epificcu94.execute-api.eu-central-1.amazonaws.com/production`,prerelease:`https://4kkst32tm6.execute-api.eu-central-1.amazonaws.com/staging`,development:`https://4kkst32tm6.execute-api.eu-central-1.amazonaws.com/staging`},main_content:{development:`https://strapi-dev.carlito-app.com`,prerelease:`https://strapi-dev.carlito-app.com`,production:`https://strapi-prod.carlito-app.com`}};function f(){return`prerelease`}function p(e,t=f()){if(e===`main_content`){let e=h(void 0);if(e)return e}if(e===`carlito_federation`){let e=m(t);if(e)return e}return d[e][t]}function m(e){return e===`development`||e===`prerelease`?c()||h(void 0):``}function h(e){return e?.trim().replace(/\/+$/,``)??``}var g=2e3;function _(){let e=f(),t=e===`production`,n=t?`legacy`:`legacy-next`,r=t?`latest`:`next`;return{legacyUrl:`https://unpkg.com/bookito-widget@${n}/dist/bookito-widget.umd.js`,strapiUrl:p(`main_content`,e),timeoutMs:g,vueUrl:`https://unpkg.com/bookito-widget@${r}/dist/bookito-widget.iife.js`}}var v=[`useNewWebWidget`],y=/^\d+$/;async function b(e,t,n){if(!y.test(t))return{ok:!1,reason:`invalid_hotel_id`};let r=v.map((e,t)=>`fields[${t}]=${e}`).join(`&`),i=new AbortController,a=setTimeout(()=>i.abort(),n);try{let n=await fetch(`${e}/api/hotels/${t}?${r}`,{signal:i.signal});return n.ok?{ok:!0,hotel:x(await n.json())}:{ok:!1,reason:`http_${n.status}`}}catch{return{ok:!1,reason:i.signal.aborted?`timeout`:`request_failed`}}finally{clearTimeout(a)}}function x(e){return{useNewWebWidget:(e.data?.attributes??e.data??{}).useNewWebWidget===!0}}function S(){let e,t=new Promise(t=>{e=t}),n=t=>{let n=C(t);n&&e&&(e(n),e=void 0)},r=()=>{for(let e of document.querySelectorAll(`bookito-widget`))n(e.getAttribute(`auth-id`)||e.getAttribute(`authId`))};if(r(),e){let e=new MutationObserver(r);e.observe(document.documentElement,{childList:!0,subtree:!0}),t.then(()=>e.disconnect())}return{firstId:t,offer:n}}function C(e){return typeof e==`number`?String(e):typeof e==`string`?e.trim():``}var w=globalThis;async function T(e){if(w.bookitoWidget)return;let t=[],{firstId:n,offer:r}=S(),i,a=e=>{if(!i){t.push(e);return}E(i,e)},o={initialize(e){a([`initialize`,e]),r(e?.authId)},openBookitoModal(e){a([`openBookitoModal`,e]),r(e?.authId)},unmount(e){a([`unmount`,e])}};w.bookitoWidget=o;let s=await n,c=e.legacyUrl,l=await b(e.strapiUrl,s,e.timeoutMs);l.ok||console.warn(`bookito-widget: hotel flag unavailable (${l.reason}), loading the legacy widget`);let u=l.ok&&l.hotel.useNewWebWidget?e.vueUrl:c,d=()=>{let e=w.bookitoWidget;if(!(!e||e===o)){i=e;for(let n of t.splice(0))E(e,n)}};D(u,d,()=>{if(u===c){console.error(`bookito-widget: could not load ${u}`);return}console.warn(`bookito-widget: could not load ${u}, loading the legacy widget`),D(c,d,()=>{console.error(`bookito-widget: could not load ${c}`)})})}function E(e,[t,n]){let r=e[t];if(typeof r!=`function`){console.warn(`bookito-widget: the loaded widget has no ${t}, call skipped`);return}try{r.call(e,n)}catch(e){console.error(`bookito-widget: ${t} failed`,e)}}function D(e,t,n){let r=document.createElement(`script`);r.src=e,r.addEventListener(`load`,t),r.addEventListener(`error`,n),document.head.append(r)}T(_())})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var e={carlito_federation:{production:`https://federation-prod.carlito-app.com`,prerelease:`https://federation-staging.carlito-app.com`,development:`https://federation-staging.carlito-app.com`},gateway:{production:`https://epificcu94.execute-api.eu-central-1.amazonaws.com/production`,prerelease:`https://4kkst32tm6.execute-api.eu-central-1.amazonaws.com/staging`,development:`https://4kkst32tm6.execute-api.eu-central-1.amazonaws.com/staging`},main_content:{development:`https://strapi-dev.carlito-app.com`,prerelease:`https://strapi-dev.carlito-app.com`,production:`https://strapi-prod.carlito-app.com`}};function
|
|
1
|
+
(function(){var e=`carlito-api-override`;function t(){try{let e=JSON.parse(globalThis.sessionStorage.getItem(`carlito-api-override`)??`null`);return i(e)?{setAt:e.setAt,url:e.url}:null}catch{return null}}function n(t){try{globalThis.sessionStorage.setItem(e,JSON.stringify(t))}catch{}}function r(){try{globalThis.sessionStorage.removeItem(e)}catch{}}function i(e){return typeof e==`object`&&!!e&&`url`in e&&typeof e.url==`string`&&`setAt`in e&&typeof e.setAt==`number`}var a=/^[a-z0-9]+\.eu-central-1\.awsapprunner\.com$/,o;function s(e){let t=u(e?.trim()??``);return!t||t.protocol!==`https:`||t.port?``:a.test(t.hostname)?t.origin:``}function c(){return globalThis.window===void 0?``:(o??=l(Date.now()),o)}function l(e){let i=new URLSearchParams(globalThis.location.search);if(i.has(`api`)){let t=s(i.get(`api`));return t?(n({setAt:e,url:t}),t):(r(),``)}let a=t(),o=s(a?.url);return!a||!o||e-a.setAt>288e5?(r(),``):o}function u(e){try{return e?new URL(e):null}catch{return null}}var d={carlito_federation:{production:`https://federation-prod.carlito-app.com`,prerelease:`https://federation-staging.carlito-app.com`,development:`https://federation-staging.carlito-app.com`},gateway:{production:`https://epificcu94.execute-api.eu-central-1.amazonaws.com/production`,prerelease:`https://4kkst32tm6.execute-api.eu-central-1.amazonaws.com/staging`,development:`https://4kkst32tm6.execute-api.eu-central-1.amazonaws.com/staging`},main_content:{development:`https://strapi-dev.carlito-app.com`,prerelease:`https://strapi-dev.carlito-app.com`,production:`https://strapi-prod.carlito-app.com`}};function f(){return`prerelease`}function p(e,t=f()){if(e===`main_content`){let e=h(void 0);if(e)return e}if(e===`carlito_federation`){let e=m(t);if(e)return e}return d[e][t]}function m(e){return e===`development`||e===`prerelease`?c()||h(void 0):``}function h(e){return e?.trim().replace(/\/+$/,``)??``}var g=2e3;function _(){let e=f(),t=e===`production`,n=t?`legacy`:`legacy-next`,r=t?`latest`:`next`;return{legacyUrl:`https://unpkg.com/bookito-widget@${n}/dist/bookito-widget.umd.js`,strapiUrl:p(`main_content`,e),timeoutMs:g,vueUrl:`https://unpkg.com/bookito-widget@${r}/dist/bookito-widget.iife.js`}}var v=[`useNewWebWidget`],y=/^\d+$/;async function b(e,t,n){if(!y.test(t))return{ok:!1,reason:`invalid_hotel_id`};let r=v.map((e,t)=>`fields[${t}]=${e}`).join(`&`),i=new AbortController,a=setTimeout(()=>i.abort(),n);try{let n=await fetch(`${e}/api/hotels/${t}?${r}`,{signal:i.signal});return n.ok?{ok:!0,hotel:x(await n.json())}:{ok:!1,reason:`http_${n.status}`}}catch{return{ok:!1,reason:i.signal.aborted?`timeout`:`request_failed`}}finally{clearTimeout(a)}}function x(e){return{useNewWebWidget:(e.data?.attributes??e.data??{}).useNewWebWidget===!0}}function S(){let e,t=new Promise(t=>{e=t}),n=t=>{let n=C(t);n&&e&&(e(n),e=void 0)},r=()=>{for(let e of document.querySelectorAll(`bookito-widget`))n(e.getAttribute(`auth-id`)||e.getAttribute(`authId`))};if(r(),e){let e=new MutationObserver(r);e.observe(document.documentElement,{childList:!0,subtree:!0}),t.then(()=>e.disconnect())}return{firstId:t,offer:n}}function C(e){return typeof e==`number`?String(e):typeof e==`string`?e.trim():``}var w=globalThis;async function T(e){if(w.bookitoWidget)return;let t=[],{firstId:n,offer:r}=S(),i,a=e=>{if(!i){t.push(e);return}E(i,e)},o={initialize(e){a([`initialize`,e]),r(e?.authId)},openBookitoModal(e){a([`openBookitoModal`,e]),r(e?.authId)},unmount(e){a([`unmount`,e])}};w.bookitoWidget=o;let s=await n,c=e.legacyUrl,l=await b(e.strapiUrl,s,e.timeoutMs);l.ok||console.warn(`bookito-widget: hotel flag unavailable (${l.reason}), loading the legacy widget`);let u=l.ok&&l.hotel.useNewWebWidget?e.vueUrl:c,d=()=>{let e=w.bookitoWidget;if(!(!e||e===o)){i=e;for(let n of t.splice(0))E(e,n)}};D(u,d,()=>{if(u===c){console.error(`bookito-widget: could not load ${u}`);return}console.warn(`bookito-widget: could not load ${u}, loading the legacy widget`),D(c,d,()=>{console.error(`bookito-widget: could not load ${c}`)})})}function E(e,[t,n]){let r=e[t];if(typeof r!=`function`){console.warn(`bookito-widget: the loaded widget has no ${t}, call skipped`);return}try{r.call(e,n)}catch(e){console.error(`bookito-widget: ${t} failed`,e)}}function D(e,t,n){let r=document.createElement(`script`);r.src=e,r.addEventListener(`load`,t),r.addEventListener(`error`,n),document.head.append(r)}T(_())})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var e={carlito_federation:{production:`https://federation-prod.carlito-app.com`,prerelease:`https://federation-staging.carlito-app.com`,development:`https://federation-staging.carlito-app.com`},gateway:{production:`https://epificcu94.execute-api.eu-central-1.amazonaws.com/production`,prerelease:`https://4kkst32tm6.execute-api.eu-central-1.amazonaws.com/staging`,development:`https://4kkst32tm6.execute-api.eu-central-1.amazonaws.com/staging`},main_content:{development:`https://strapi-dev.carlito-app.com`,prerelease:`https://strapi-dev.carlito-app.com`,production:`https://strapi-prod.carlito-app.com`}};function
|
|
1
|
+
(function(){var e=`carlito-api-override`;function t(){try{let e=JSON.parse(globalThis.sessionStorage.getItem(`carlito-api-override`)??`null`);return i(e)?{setAt:e.setAt,url:e.url}:null}catch{return null}}function n(t){try{globalThis.sessionStorage.setItem(e,JSON.stringify(t))}catch{}}function r(){try{globalThis.sessionStorage.removeItem(e)}catch{}}function i(e){return typeof e==`object`&&!!e&&`url`in e&&typeof e.url==`string`&&`setAt`in e&&typeof e.setAt==`number`}var a=/^[a-z0-9]+\.eu-central-1\.awsapprunner\.com$/,o;function s(e){let t=u(e?.trim()??``);return!t||t.protocol!==`https:`||t.port?``:a.test(t.hostname)?t.origin:``}function c(){return globalThis.window===void 0?``:(o??=l(Date.now()),o)}function l(e){let i=new URLSearchParams(globalThis.location.search);if(i.has(`api`)){let t=s(i.get(`api`));return t?(n({setAt:e,url:t}),t):(r(),``)}let a=t(),o=s(a?.url);return!a||!o||e-a.setAt>288e5?(r(),``):o}function u(e){try{return e?new URL(e):null}catch{return null}}var d={carlito_federation:{production:`https://federation-prod.carlito-app.com`,prerelease:`https://federation-staging.carlito-app.com`,development:`https://federation-staging.carlito-app.com`},gateway:{production:`https://epificcu94.execute-api.eu-central-1.amazonaws.com/production`,prerelease:`https://4kkst32tm6.execute-api.eu-central-1.amazonaws.com/staging`,development:`https://4kkst32tm6.execute-api.eu-central-1.amazonaws.com/staging`},main_content:{development:`https://strapi-dev.carlito-app.com`,prerelease:`https://strapi-dev.carlito-app.com`,production:`https://strapi-prod.carlito-app.com`}};function f(){return`prerelease`}function p(e,t=f()){if(e===`main_content`){let e=h(void 0);if(e)return e}if(e===`carlito_federation`){let e=m(t);if(e)return e}return d[e][t]}function m(e){return e===`development`||e===`prerelease`?c()||h(void 0):``}function h(e){return e?.trim().replace(/\/+$/,``)??``}var g=2e3;function _(){let e=f(),t=e===`production`,n=t?`legacy`:`legacy-next`,r=t?`latest`:`next`;return{legacyUrl:`https://unpkg.com/bookito-widget@${n}/dist/bookito-widget.umd.js`,strapiUrl:p(`main_content`,e),timeoutMs:g,vueUrl:`https://unpkg.com/bookito-widget@${r}/dist/bookito-widget.iife.js`}}var v=[`useNewWebWidget`],y=/^\d+$/;async function b(e,t,n){if(!y.test(t))return{ok:!1,reason:`invalid_hotel_id`};let r=v.map((e,t)=>`fields[${t}]=${e}`).join(`&`),i=new AbortController,a=setTimeout(()=>i.abort(),n);try{let n=await fetch(`${e}/api/hotels/${t}?${r}`,{signal:i.signal});return n.ok?{ok:!0,hotel:x(await n.json())}:{ok:!1,reason:`http_${n.status}`}}catch{return{ok:!1,reason:i.signal.aborted?`timeout`:`request_failed`}}finally{clearTimeout(a)}}function x(e){return{useNewWebWidget:(e.data?.attributes??e.data??{}).useNewWebWidget===!0}}function S(){let e,t=new Promise(t=>{e=t}),n=t=>{let n=C(t);n&&e&&(e(n),e=void 0)},r=()=>{for(let e of document.querySelectorAll(`bookito-widget`))n(e.getAttribute(`auth-id`)||e.getAttribute(`authId`))};if(r(),e){let e=new MutationObserver(r);e.observe(document.documentElement,{childList:!0,subtree:!0}),t.then(()=>e.disconnect())}return{firstId:t,offer:n}}function C(e){return typeof e==`number`?String(e):typeof e==`string`?e.trim():``}var w=globalThis;async function T(e){if(w.bookitoWidget)return;let t=[],{firstId:n,offer:r}=S(),i,a=e=>{if(!i){t.push(e);return}E(i,e)},o={initialize(e){a([`initialize`,e]),r(e?.authId)},openBookitoModal(e){a([`openBookitoModal`,e]),r(e?.authId)},unmount(e){a([`unmount`,e])}};w.bookitoWidget=o;let s=await n,c=e.legacyUrl,l=await b(e.strapiUrl,s,e.timeoutMs);l.ok||console.warn(`bookito-widget: hotel flag unavailable (${l.reason}), loading the legacy widget`);let u=l.ok&&l.hotel.useNewWebWidget?e.vueUrl:c,d=()=>{let e=w.bookitoWidget;if(!(!e||e===o)){i=e;for(let n of t.splice(0))E(e,n)}};D(u,d,()=>{if(u===c){console.error(`bookito-widget: could not load ${u}`);return}console.warn(`bookito-widget: could not load ${u}, loading the legacy widget`),D(c,d,()=>{console.error(`bookito-widget: could not load ${c}`)})})}function E(e,[t,n]){let r=e[t];if(typeof r!=`function`){console.warn(`bookito-widget: the loaded widget has no ${t}, call skipped`);return}try{r.call(e,n)}catch(e){console.error(`bookito-widget: ${t} failed`,e)}}function D(e,t,n){let r=document.createElement(`script`);r.src=e,r.addEventListener(`load`,t),r.addEventListener(`error`,n),document.head.append(r)}T(_())})();
|
|
@@ -87,6 +87,16 @@ export declare const widgetLocaleMessages: {
|
|
|
87
87
|
time: string;
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
|
+
previewApi: {
|
|
91
|
+
label: string;
|
|
92
|
+
prLabel: string;
|
|
93
|
+
unreachableLabel: string;
|
|
94
|
+
checking: string;
|
|
95
|
+
usingPr: string;
|
|
96
|
+
unreachable: string;
|
|
97
|
+
branch: string;
|
|
98
|
+
reset: string;
|
|
99
|
+
};
|
|
90
100
|
};
|
|
91
101
|
readonly en: {
|
|
92
102
|
pdf: {
|
|
@@ -175,6 +185,16 @@ export declare const widgetLocaleMessages: {
|
|
|
175
185
|
time: string;
|
|
176
186
|
};
|
|
177
187
|
};
|
|
188
|
+
previewApi: {
|
|
189
|
+
label: string;
|
|
190
|
+
prLabel: string;
|
|
191
|
+
unreachableLabel: string;
|
|
192
|
+
checking: string;
|
|
193
|
+
usingPr: string;
|
|
194
|
+
unreachable: string;
|
|
195
|
+
branch: string;
|
|
196
|
+
reset: string;
|
|
197
|
+
};
|
|
178
198
|
};
|
|
179
199
|
readonly fr: {
|
|
180
200
|
pdf: {
|
|
@@ -263,6 +283,16 @@ export declare const widgetLocaleMessages: {
|
|
|
263
283
|
time: string;
|
|
264
284
|
};
|
|
265
285
|
};
|
|
286
|
+
previewApi: {
|
|
287
|
+
label: string;
|
|
288
|
+
prLabel: string;
|
|
289
|
+
unreachableLabel: string;
|
|
290
|
+
checking: string;
|
|
291
|
+
usingPr: string;
|
|
292
|
+
unreachable: string;
|
|
293
|
+
branch: string;
|
|
294
|
+
reset: string;
|
|
295
|
+
};
|
|
266
296
|
};
|
|
267
297
|
readonly it: {
|
|
268
298
|
pdf: {
|
|
@@ -351,6 +381,16 @@ export declare const widgetLocaleMessages: {
|
|
|
351
381
|
time: string;
|
|
352
382
|
};
|
|
353
383
|
};
|
|
384
|
+
previewApi: {
|
|
385
|
+
label: string;
|
|
386
|
+
prLabel: string;
|
|
387
|
+
unreachableLabel: string;
|
|
388
|
+
checking: string;
|
|
389
|
+
usingPr: string;
|
|
390
|
+
unreachable: string;
|
|
391
|
+
branch: string;
|
|
392
|
+
reset: string;
|
|
393
|
+
};
|
|
354
394
|
};
|
|
355
395
|
readonly pl: {
|
|
356
396
|
pdf: {
|
|
@@ -439,6 +479,16 @@ export declare const widgetLocaleMessages: {
|
|
|
439
479
|
time: string;
|
|
440
480
|
};
|
|
441
481
|
};
|
|
482
|
+
previewApi: {
|
|
483
|
+
label: string;
|
|
484
|
+
prLabel: string;
|
|
485
|
+
unreachableLabel: string;
|
|
486
|
+
checking: string;
|
|
487
|
+
usingPr: string;
|
|
488
|
+
unreachable: string;
|
|
489
|
+
branch: string;
|
|
490
|
+
reset: string;
|
|
491
|
+
};
|
|
442
492
|
};
|
|
443
493
|
};
|
|
444
494
|
type WidgetDialCodeLabelKeyType = 'chooseCountryCode' | 'searchCountryCode';
|
|
@@ -531,6 +581,16 @@ export declare function createWidgetI18n(locale?: string): import('vue-i18n').I1
|
|
|
531
581
|
time: string;
|
|
532
582
|
};
|
|
533
583
|
};
|
|
584
|
+
previewApi: {
|
|
585
|
+
label: string;
|
|
586
|
+
prLabel: string;
|
|
587
|
+
unreachableLabel: string;
|
|
588
|
+
checking: string;
|
|
589
|
+
usingPr: string;
|
|
590
|
+
unreachable: string;
|
|
591
|
+
branch: string;
|
|
592
|
+
reset: string;
|
|
593
|
+
};
|
|
534
594
|
};
|
|
535
595
|
readonly en: {
|
|
536
596
|
pdf: {
|
|
@@ -619,6 +679,16 @@ export declare function createWidgetI18n(locale?: string): import('vue-i18n').I1
|
|
|
619
679
|
time: string;
|
|
620
680
|
};
|
|
621
681
|
};
|
|
682
|
+
previewApi: {
|
|
683
|
+
label: string;
|
|
684
|
+
prLabel: string;
|
|
685
|
+
unreachableLabel: string;
|
|
686
|
+
checking: string;
|
|
687
|
+
usingPr: string;
|
|
688
|
+
unreachable: string;
|
|
689
|
+
branch: string;
|
|
690
|
+
reset: string;
|
|
691
|
+
};
|
|
622
692
|
};
|
|
623
693
|
readonly fr: {
|
|
624
694
|
pdf: {
|
|
@@ -707,6 +777,16 @@ export declare function createWidgetI18n(locale?: string): import('vue-i18n').I1
|
|
|
707
777
|
time: string;
|
|
708
778
|
};
|
|
709
779
|
};
|
|
780
|
+
previewApi: {
|
|
781
|
+
label: string;
|
|
782
|
+
prLabel: string;
|
|
783
|
+
unreachableLabel: string;
|
|
784
|
+
checking: string;
|
|
785
|
+
usingPr: string;
|
|
786
|
+
unreachable: string;
|
|
787
|
+
branch: string;
|
|
788
|
+
reset: string;
|
|
789
|
+
};
|
|
710
790
|
};
|
|
711
791
|
readonly it: {
|
|
712
792
|
pdf: {
|
|
@@ -795,6 +875,16 @@ export declare function createWidgetI18n(locale?: string): import('vue-i18n').I1
|
|
|
795
875
|
time: string;
|
|
796
876
|
};
|
|
797
877
|
};
|
|
878
|
+
previewApi: {
|
|
879
|
+
label: string;
|
|
880
|
+
prLabel: string;
|
|
881
|
+
unreachableLabel: string;
|
|
882
|
+
checking: string;
|
|
883
|
+
usingPr: string;
|
|
884
|
+
unreachable: string;
|
|
885
|
+
branch: string;
|
|
886
|
+
reset: string;
|
|
887
|
+
};
|
|
798
888
|
};
|
|
799
889
|
readonly pl: {
|
|
800
890
|
pdf: {
|
|
@@ -883,6 +973,16 @@ export declare function createWidgetI18n(locale?: string): import('vue-i18n').I1
|
|
|
883
973
|
time: string;
|
|
884
974
|
};
|
|
885
975
|
};
|
|
976
|
+
previewApi: {
|
|
977
|
+
label: string;
|
|
978
|
+
prLabel: string;
|
|
979
|
+
unreachableLabel: string;
|
|
980
|
+
checking: string;
|
|
981
|
+
usingPr: string;
|
|
982
|
+
unreachable: string;
|
|
983
|
+
branch: string;
|
|
984
|
+
reset: string;
|
|
985
|
+
};
|
|
886
986
|
};
|
|
887
987
|
}, {}, {}, string, false>;
|
|
888
988
|
export {};
|
|
@@ -85,4 +85,14 @@ export declare const de: {
|
|
|
85
85
|
time: string;
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
|
+
previewApi: {
|
|
89
|
+
label: string;
|
|
90
|
+
prLabel: string;
|
|
91
|
+
unreachableLabel: string;
|
|
92
|
+
checking: string;
|
|
93
|
+
usingPr: string;
|
|
94
|
+
unreachable: string;
|
|
95
|
+
branch: string;
|
|
96
|
+
reset: string;
|
|
97
|
+
};
|
|
88
98
|
};
|
|
@@ -85,4 +85,14 @@ export declare const en: {
|
|
|
85
85
|
time: string;
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
|
+
previewApi: {
|
|
89
|
+
label: string;
|
|
90
|
+
prLabel: string;
|
|
91
|
+
unreachableLabel: string;
|
|
92
|
+
checking: string;
|
|
93
|
+
usingPr: string;
|
|
94
|
+
unreachable: string;
|
|
95
|
+
branch: string;
|
|
96
|
+
reset: string;
|
|
97
|
+
};
|
|
88
98
|
};
|
|
@@ -85,4 +85,14 @@ export declare const fr: {
|
|
|
85
85
|
time: string;
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
|
+
previewApi: {
|
|
89
|
+
label: string;
|
|
90
|
+
prLabel: string;
|
|
91
|
+
unreachableLabel: string;
|
|
92
|
+
checking: string;
|
|
93
|
+
usingPr: string;
|
|
94
|
+
unreachable: string;
|
|
95
|
+
branch: string;
|
|
96
|
+
reset: string;
|
|
97
|
+
};
|
|
88
98
|
};
|
|
@@ -85,4 +85,14 @@ export declare const it: {
|
|
|
85
85
|
time: string;
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
|
+
previewApi: {
|
|
89
|
+
label: string;
|
|
90
|
+
prLabel: string;
|
|
91
|
+
unreachableLabel: string;
|
|
92
|
+
checking: string;
|
|
93
|
+
usingPr: string;
|
|
94
|
+
unreachable: string;
|
|
95
|
+
branch: string;
|
|
96
|
+
reset: string;
|
|
97
|
+
};
|
|
88
98
|
};
|
|
@@ -85,4 +85,14 @@ export declare const pl: {
|
|
|
85
85
|
time: string;
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
|
+
previewApi: {
|
|
89
|
+
label: string;
|
|
90
|
+
prLabel: string;
|
|
91
|
+
unreachableLabel: string;
|
|
92
|
+
checking: string;
|
|
93
|
+
usingPr: string;
|
|
94
|
+
unreachable: string;
|
|
95
|
+
branch: string;
|
|
96
|
+
reset: string;
|
|
97
|
+
};
|
|
88
98
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const PREVIEW_API_FLAG_HOST_ID = "bookito-preview-api-flag";
|
|
2
|
+
/**
|
|
3
|
+
* Shows the QA `?api=` flag once per page, however many widgets or modals the page mounts.
|
|
4
|
+
* Production builds have API_OVERRIDE_ALLOWED = false, so the flag is not bundled there.
|
|
5
|
+
*/
|
|
6
|
+
export declare function mountPreviewApiFlag(language?: string): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PreviewApiHealthType } from '../model/preview-api.types';
|
|
2
|
+
/**
|
|
3
|
+
* Reads `GET <api>/health` of a carlito-platform PR preview API.
|
|
4
|
+
* Resolves `null` when the API answers but is not a PR preview, and rejects when it does not answer.
|
|
5
|
+
*/
|
|
6
|
+
export declare function fetchPreviewApiHealth(apiUrl: string): Promise<PreviewApiHealthType | null>;
|
|
7
|
+
/** Maps the federation `/health` body; only a prerelease stage with a numeric PR number counts. */
|
|
8
|
+
export declare function mapPreviewApiHealth(body: unknown): PreviewApiHealthType | null;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resetApiOverride } from '../../../../shared/api/api-override';
|
|
2
|
+
import { PreviewApiHealthType, PreviewApiStatusType } from '../model/preview-api.types';
|
|
3
|
+
/**
|
|
4
|
+
* State of the `?api=` override flag. An API that answers but is not a PR preview is dropped at
|
|
5
|
+
* once (back to staging); one that does not answer stays, shown red, so QA can decide.
|
|
6
|
+
*/
|
|
7
|
+
export declare function usePreviewApiFlag(): {
|
|
8
|
+
apiHost: string;
|
|
9
|
+
health: import('vue').Ref<{
|
|
10
|
+
branch: string;
|
|
11
|
+
prNumber: string;
|
|
12
|
+
} | null, PreviewApiHealthType | {
|
|
13
|
+
branch: string;
|
|
14
|
+
prNumber: string;
|
|
15
|
+
} | null>;
|
|
16
|
+
reset: typeof resetApiOverride;
|
|
17
|
+
status: import('vue').Ref<PreviewApiStatusType, PreviewApiStatusType>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type PreviewApiHealthType = {
|
|
2
|
+
branch: string;
|
|
3
|
+
prNumber: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* - `checking`: `/health` has not answered yet
|
|
7
|
+
* - `ready`: the API answered as a carlito-platform PR preview
|
|
8
|
+
* - `unreachable`: no answer (PR closed, stack deleted, network)
|
|
9
|
+
*/
|
|
10
|
+
export type PreviewApiStatusType = 'checking' | 'ready' | 'unreachable';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const API_OVERRIDE_STORAGE_KEY = "carlito-api-override";
|
|
2
|
+
export type StoredApiOverrideType = {
|
|
3
|
+
setAt: number;
|
|
4
|
+
url: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function readStoredApiOverride(): StoredApiOverrideType | null;
|
|
7
|
+
export declare function writeStoredApiOverride(value: StoredApiOverrideType): void;
|
|
8
|
+
export declare function clearStoredApiOverride(): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QA override for the federation API: `?api=<PR preview API>` points this tab at a carlito-platform
|
|
3
|
+
* PR backend. Only staging/prerelease builds and the local dev server honor it. Production builds
|
|
4
|
+
* compare VITE_STAGE as a literal, so the minifier drops this code from them.
|
|
5
|
+
*
|
|
6
|
+
* The value lives in sessionStorage for {@link API_OVERRIDE_TTL_MS}; closing the tab clears it. The
|
|
7
|
+
* limit is for forgotten overrides: a load without `?api=` restores the stored value only within it.
|
|
8
|
+
* A load with `?api=` is a fresh choice and starts a new period.
|
|
9
|
+
* Embedded, both `?api=` and that storage belong to the host page (e.g. the widget playground).
|
|
10
|
+
*/
|
|
11
|
+
export declare const API_OVERRIDE_QUERY_PARAMETER = "api";
|
|
12
|
+
export declare const API_OVERRIDE_TTL_MS: number;
|
|
13
|
+
/**
|
|
14
|
+
* Build-time constant. Guard call sites with it (not only {@link getApiOverride}) so a production
|
|
15
|
+
* build, where it is `false`, drops the override code and the flag chunk entirely.
|
|
16
|
+
*/
|
|
17
|
+
export declare const API_OVERRIDE_ALLOWED: boolean;
|
|
18
|
+
export declare function isApiOverrideAllowed(): boolean;
|
|
19
|
+
/** Returns the origin of an allowed preview API URL, or '' for anything else. */
|
|
20
|
+
export declare function normalizeApiOverride(value: string | null | undefined): string;
|
|
21
|
+
/**
|
|
22
|
+
* The active override for this page load, or '' when none applies. Resolved once per page load:
|
|
23
|
+
* a change needs a reload, which {@link resetApiOverride} does.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getApiOverride(): string;
|
|
26
|
+
/** Clears the override, drops `?api=` from the URL and reloads on the default API. */
|
|
27
|
+
export declare function resetApiOverride(): void;
|