optimized-react-component-library-xyz123 0.1.94 → 0.1.96
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/index.d.mts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +87 -2
- package/dist/index.mjs +82 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -446,6 +446,27 @@ declare const makeQuestionsSelectors: <TState>(selectSlice: (state: TState) => I
|
|
|
446
446
|
};
|
|
447
447
|
};
|
|
448
448
|
|
|
449
|
+
interface CookieConsentConfig {
|
|
450
|
+
cookieName: string;
|
|
451
|
+
choiceKey: string;
|
|
452
|
+
expiryYears?: number;
|
|
453
|
+
}
|
|
454
|
+
declare const createCookieConsent: (config: CookieConsentConfig) => {
|
|
455
|
+
acceptCookies: () => void;
|
|
456
|
+
rejectCookies: () => void;
|
|
457
|
+
areCookiesAccepted: () => boolean;
|
|
458
|
+
hasChoiceBeenMade: () => boolean;
|
|
459
|
+
clearChoiceFromSession: () => void;
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
declare const toggleScriptByConsent: (consent: boolean, options: {
|
|
463
|
+
id: string;
|
|
464
|
+
src: string;
|
|
465
|
+
attributes?: Record<string, string>;
|
|
466
|
+
}) => void;
|
|
467
|
+
declare const isScriptLoaded: (id: string) => boolean;
|
|
468
|
+
declare const removeScriptById: (id: string) => void;
|
|
469
|
+
|
|
449
470
|
declare const RenderQuestion: ({ question, isTouched, activatedLanguage, showPreview, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
|
|
450
471
|
|
|
451
472
|
declare const RenderQuestionGroup: ({ questionArray, wrapper, legend, isTouched, activatedLanguage, showPreview, AddQuestionDisplayed, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
|
|
@@ -552,4 +573,4 @@ interface CookieBannerProps {
|
|
|
552
573
|
|
|
553
574
|
declare const CookieBanner: React.FC<CookieBannerProps>;
|
|
554
575
|
|
|
555
|
-
export { AddFiles as AddFilesStandard, CookieBanner, CreateApiDataObject, doCategoriesAndQuestionsVisible as DoCategoriesAndQuestionsVisible, EditPreviewLink as EditPreviewLinkStandard, FilesUpload as FilesUploadStandard, Footer as FooterStandard, groupQuestionByStepPreviewPage as GroupQuestionByStepPreviewPage, groupQuestionsByStepCategoryGroup as GroupQuestionsByStepCategoryGroup, Header as HeaderStandard, type IApplicationContent, type IFormState, type ILanguage, type ILanguageSupport, ILanguageSupportinitialState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, InfoOnly as InfoOnlyStandard, isDependsOnOtherQuestionTrue as IsDependsOnOtherQuestionTrue, type LanguageSupportConfig, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, questionHasValidationError as QuestionHasValidationError, QuestioninitialState, InputRadio as RadioMultipleStandard, RenderQuestion, RenderQuestionGroup, ServiceHeadlineAndBody as ServiceHeadlineAndBodyStandard, SkipLink as SkipLinkStandard, StepperButtons as StepperButtonsStandard, Stepper as StepperStandard, InputTextarea as TextAreaStandard, TextFieldStandard, TextHeadlineAndBody as TextHeadlineAndBodyStandard, validationCheckAllVisibleQuestions as ValidationCheckAllVisibleQuestion, ValidationErrorSummaryList, createLanguageSlice, createQuestionsSlice, makeLanguageSelectors, makeQuestionsSelectors };
|
|
576
|
+
export { AddFiles as AddFilesStandard, CookieBanner, type CookieConsentConfig, CreateApiDataObject, doCategoriesAndQuestionsVisible as DoCategoriesAndQuestionsVisible, EditPreviewLink as EditPreviewLinkStandard, FilesUpload as FilesUploadStandard, Footer as FooterStandard, groupQuestionByStepPreviewPage as GroupQuestionByStepPreviewPage, groupQuestionsByStepCategoryGroup as GroupQuestionsByStepCategoryGroup, Header as HeaderStandard, type IApplicationContent, type IFormState, type ILanguage, type ILanguageSupport, ILanguageSupportinitialState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, InfoOnly as InfoOnlyStandard, isDependsOnOtherQuestionTrue as IsDependsOnOtherQuestionTrue, type LanguageSupportConfig, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, questionHasValidationError as QuestionHasValidationError, QuestioninitialState, InputRadio as RadioMultipleStandard, RenderQuestion, RenderQuestionGroup, ServiceHeadlineAndBody as ServiceHeadlineAndBodyStandard, SkipLink as SkipLinkStandard, StepperButtons as StepperButtonsStandard, Stepper as StepperStandard, InputTextarea as TextAreaStandard, TextFieldStandard, TextHeadlineAndBody as TextHeadlineAndBodyStandard, validationCheckAllVisibleQuestions as ValidationCheckAllVisibleQuestion, ValidationErrorSummaryList, createCookieConsent, createLanguageSlice, createQuestionsSlice, isScriptLoaded, makeLanguageSelectors, makeQuestionsSelectors, removeScriptById, toggleScriptByConsent };
|
package/dist/index.d.ts
CHANGED
|
@@ -446,6 +446,27 @@ declare const makeQuestionsSelectors: <TState>(selectSlice: (state: TState) => I
|
|
|
446
446
|
};
|
|
447
447
|
};
|
|
448
448
|
|
|
449
|
+
interface CookieConsentConfig {
|
|
450
|
+
cookieName: string;
|
|
451
|
+
choiceKey: string;
|
|
452
|
+
expiryYears?: number;
|
|
453
|
+
}
|
|
454
|
+
declare const createCookieConsent: (config: CookieConsentConfig) => {
|
|
455
|
+
acceptCookies: () => void;
|
|
456
|
+
rejectCookies: () => void;
|
|
457
|
+
areCookiesAccepted: () => boolean;
|
|
458
|
+
hasChoiceBeenMade: () => boolean;
|
|
459
|
+
clearChoiceFromSession: () => void;
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
declare const toggleScriptByConsent: (consent: boolean, options: {
|
|
463
|
+
id: string;
|
|
464
|
+
src: string;
|
|
465
|
+
attributes?: Record<string, string>;
|
|
466
|
+
}) => void;
|
|
467
|
+
declare const isScriptLoaded: (id: string) => boolean;
|
|
468
|
+
declare const removeScriptById: (id: string) => void;
|
|
469
|
+
|
|
449
470
|
declare const RenderQuestion: ({ question, isTouched, activatedLanguage, showPreview, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
|
|
450
471
|
|
|
451
472
|
declare const RenderQuestionGroup: ({ questionArray, wrapper, legend, isTouched, activatedLanguage, showPreview, AddQuestionDisplayed, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
|
|
@@ -552,4 +573,4 @@ interface CookieBannerProps {
|
|
|
552
573
|
|
|
553
574
|
declare const CookieBanner: React.FC<CookieBannerProps>;
|
|
554
575
|
|
|
555
|
-
export { AddFiles as AddFilesStandard, CookieBanner, CreateApiDataObject, doCategoriesAndQuestionsVisible as DoCategoriesAndQuestionsVisible, EditPreviewLink as EditPreviewLinkStandard, FilesUpload as FilesUploadStandard, Footer as FooterStandard, groupQuestionByStepPreviewPage as GroupQuestionByStepPreviewPage, groupQuestionsByStepCategoryGroup as GroupQuestionsByStepCategoryGroup, Header as HeaderStandard, type IApplicationContent, type IFormState, type ILanguage, type ILanguageSupport, ILanguageSupportinitialState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, InfoOnly as InfoOnlyStandard, isDependsOnOtherQuestionTrue as IsDependsOnOtherQuestionTrue, type LanguageSupportConfig, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, questionHasValidationError as QuestionHasValidationError, QuestioninitialState, InputRadio as RadioMultipleStandard, RenderQuestion, RenderQuestionGroup, ServiceHeadlineAndBody as ServiceHeadlineAndBodyStandard, SkipLink as SkipLinkStandard, StepperButtons as StepperButtonsStandard, Stepper as StepperStandard, InputTextarea as TextAreaStandard, TextFieldStandard, TextHeadlineAndBody as TextHeadlineAndBodyStandard, validationCheckAllVisibleQuestions as ValidationCheckAllVisibleQuestion, ValidationErrorSummaryList, createLanguageSlice, createQuestionsSlice, makeLanguageSelectors, makeQuestionsSelectors };
|
|
576
|
+
export { AddFiles as AddFilesStandard, CookieBanner, type CookieConsentConfig, CreateApiDataObject, doCategoriesAndQuestionsVisible as DoCategoriesAndQuestionsVisible, EditPreviewLink as EditPreviewLinkStandard, FilesUpload as FilesUploadStandard, Footer as FooterStandard, groupQuestionByStepPreviewPage as GroupQuestionByStepPreviewPage, groupQuestionsByStepCategoryGroup as GroupQuestionsByStepCategoryGroup, Header as HeaderStandard, type IApplicationContent, type IFormState, type ILanguage, type ILanguageSupport, ILanguageSupportinitialState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, InfoOnly as InfoOnlyStandard, isDependsOnOtherQuestionTrue as IsDependsOnOtherQuestionTrue, type LanguageSupportConfig, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, questionHasValidationError as QuestionHasValidationError, QuestioninitialState, InputRadio as RadioMultipleStandard, RenderQuestion, RenderQuestionGroup, ServiceHeadlineAndBody as ServiceHeadlineAndBodyStandard, SkipLink as SkipLinkStandard, StepperButtons as StepperButtonsStandard, Stepper as StepperStandard, InputTextarea as TextAreaStandard, TextFieldStandard, TextHeadlineAndBody as TextHeadlineAndBodyStandard, validationCheckAllVisibleQuestions as ValidationCheckAllVisibleQuestion, ValidationErrorSummaryList, createCookieConsent, createLanguageSlice, createQuestionsSlice, isScriptLoaded, makeLanguageSelectors, makeQuestionsSelectors, removeScriptById, toggleScriptByConsent };
|
package/dist/index.js
CHANGED
|
@@ -60,10 +60,14 @@ __export(index_exports, {
|
|
|
60
60
|
TextHeadlineAndBodyStandard: () => TextHeadlineAndBodyStandard_default,
|
|
61
61
|
ValidationCheckAllVisibleQuestion: () => ValidationCheckAllVisibleQuestion_default,
|
|
62
62
|
ValidationErrorSummaryList: () => ValidationErrorSummaryList_default,
|
|
63
|
+
createCookieConsent: () => createCookieConsent,
|
|
63
64
|
createLanguageSlice: () => createLanguageSlice,
|
|
64
65
|
createQuestionsSlice: () => createQuestionsSlice,
|
|
66
|
+
isScriptLoaded: () => isScriptLoaded,
|
|
65
67
|
makeLanguageSelectors: () => makeLanguageSelectors,
|
|
66
|
-
makeQuestionsSelectors: () => makeQuestionsSelectors
|
|
68
|
+
makeQuestionsSelectors: () => makeQuestionsSelectors,
|
|
69
|
+
removeScriptById: () => removeScriptById,
|
|
70
|
+
toggleScriptByConsent: () => toggleScriptByConsent
|
|
67
71
|
});
|
|
68
72
|
module.exports = __toCommonJS(index_exports);
|
|
69
73
|
|
|
@@ -1820,6 +1824,83 @@ var makeQuestionsSelectors = (selectSlice) => {
|
|
|
1820
1824
|
};
|
|
1821
1825
|
};
|
|
1822
1826
|
|
|
1827
|
+
// src/NewHelpMethodsStandard/CookieHandler/cookieHandler.ts
|
|
1828
|
+
var getCookie = (name) => {
|
|
1829
|
+
const match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)"));
|
|
1830
|
+
return match ? match[2] : null;
|
|
1831
|
+
};
|
|
1832
|
+
var setCookie = (name, value, expirationDate) => {
|
|
1833
|
+
let cookieString = `${name}=${value}; path=/; SameSite=Strict`;
|
|
1834
|
+
if (expirationDate) {
|
|
1835
|
+
cookieString += `; expires=${expirationDate.toUTCString()}`;
|
|
1836
|
+
}
|
|
1837
|
+
if (window.location.protocol === "https:") {
|
|
1838
|
+
cookieString += "; Secure";
|
|
1839
|
+
}
|
|
1840
|
+
document.cookie = cookieString;
|
|
1841
|
+
};
|
|
1842
|
+
var removeCookie = (name) => {
|
|
1843
|
+
const pastDate = /* @__PURE__ */ new Date(0);
|
|
1844
|
+
setCookie(name, "", pastDate);
|
|
1845
|
+
};
|
|
1846
|
+
var createCookieConsent = (config) => {
|
|
1847
|
+
const { cookieName, choiceKey, expiryYears = 1 } = config;
|
|
1848
|
+
const acceptCookies = () => {
|
|
1849
|
+
const expires = /* @__PURE__ */ new Date();
|
|
1850
|
+
expires.setFullYear(expires.getFullYear() + expiryYears);
|
|
1851
|
+
setCookie(cookieName, "true", expires);
|
|
1852
|
+
localStorage.setItem(cookieName, "true");
|
|
1853
|
+
};
|
|
1854
|
+
const rejectCookies = () => {
|
|
1855
|
+
removeCookie(cookieName);
|
|
1856
|
+
localStorage.removeItem(cookieName);
|
|
1857
|
+
sessionStorage.setItem(choiceKey, "true");
|
|
1858
|
+
};
|
|
1859
|
+
const areCookiesAccepted = () => getCookie(cookieName) === "true";
|
|
1860
|
+
const hasChoiceBeenMade = () => sessionStorage.getItem(choiceKey) === "true";
|
|
1861
|
+
const clearChoiceFromSession = () => sessionStorage.removeItem(choiceKey);
|
|
1862
|
+
return {
|
|
1863
|
+
acceptCookies,
|
|
1864
|
+
rejectCookies,
|
|
1865
|
+
areCookiesAccepted,
|
|
1866
|
+
hasChoiceBeenMade,
|
|
1867
|
+
clearChoiceFromSession
|
|
1868
|
+
};
|
|
1869
|
+
};
|
|
1870
|
+
|
|
1871
|
+
// src/NewHelpMethodsStandard/ScriptHandler/scriptHandler.ts
|
|
1872
|
+
var toggleScriptByConsent = (consent, options) => {
|
|
1873
|
+
if (typeof document === "undefined") return;
|
|
1874
|
+
const existingScript = document.getElementById(options.id);
|
|
1875
|
+
if (consent) {
|
|
1876
|
+
if (!existingScript) {
|
|
1877
|
+
const script = document.createElement("script");
|
|
1878
|
+
script.id = options.id;
|
|
1879
|
+
script.async = true;
|
|
1880
|
+
script.src = options.src;
|
|
1881
|
+
if (options.attributes) {
|
|
1882
|
+
Object.entries(options.attributes).forEach(
|
|
1883
|
+
([key, value]) => script.setAttribute(key, value)
|
|
1884
|
+
);
|
|
1885
|
+
}
|
|
1886
|
+
document.body.appendChild(script);
|
|
1887
|
+
}
|
|
1888
|
+
} else {
|
|
1889
|
+
if (existingScript) {
|
|
1890
|
+
existingScript.remove();
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1894
|
+
var isScriptLoaded = (id) => {
|
|
1895
|
+
if (typeof document === "undefined") return false;
|
|
1896
|
+
return !!document.getElementById(id);
|
|
1897
|
+
};
|
|
1898
|
+
var removeScriptById = (id) => {
|
|
1899
|
+
if (typeof document === "undefined") return;
|
|
1900
|
+
const el = document.getElementById(id);
|
|
1901
|
+
if (el) el.remove();
|
|
1902
|
+
};
|
|
1903
|
+
|
|
1823
1904
|
// src/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.tsx
|
|
1824
1905
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1825
1906
|
var RenderQuestion = ({
|
|
@@ -3110,8 +3191,12 @@ var CookieBanner_default = CookieBanner;
|
|
|
3110
3191
|
TextHeadlineAndBodyStandard,
|
|
3111
3192
|
ValidationCheckAllVisibleQuestion,
|
|
3112
3193
|
ValidationErrorSummaryList,
|
|
3194
|
+
createCookieConsent,
|
|
3113
3195
|
createLanguageSlice,
|
|
3114
3196
|
createQuestionsSlice,
|
|
3197
|
+
isScriptLoaded,
|
|
3115
3198
|
makeLanguageSelectors,
|
|
3116
|
-
makeQuestionsSelectors
|
|
3199
|
+
makeQuestionsSelectors,
|
|
3200
|
+
removeScriptById,
|
|
3201
|
+
toggleScriptByConsent
|
|
3117
3202
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1754,6 +1754,83 @@ var makeQuestionsSelectors = (selectSlice) => {
|
|
|
1754
1754
|
};
|
|
1755
1755
|
};
|
|
1756
1756
|
|
|
1757
|
+
// src/NewHelpMethodsStandard/CookieHandler/cookieHandler.ts
|
|
1758
|
+
var getCookie = (name) => {
|
|
1759
|
+
const match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)"));
|
|
1760
|
+
return match ? match[2] : null;
|
|
1761
|
+
};
|
|
1762
|
+
var setCookie = (name, value, expirationDate) => {
|
|
1763
|
+
let cookieString = `${name}=${value}; path=/; SameSite=Strict`;
|
|
1764
|
+
if (expirationDate) {
|
|
1765
|
+
cookieString += `; expires=${expirationDate.toUTCString()}`;
|
|
1766
|
+
}
|
|
1767
|
+
if (window.location.protocol === "https:") {
|
|
1768
|
+
cookieString += "; Secure";
|
|
1769
|
+
}
|
|
1770
|
+
document.cookie = cookieString;
|
|
1771
|
+
};
|
|
1772
|
+
var removeCookie = (name) => {
|
|
1773
|
+
const pastDate = /* @__PURE__ */ new Date(0);
|
|
1774
|
+
setCookie(name, "", pastDate);
|
|
1775
|
+
};
|
|
1776
|
+
var createCookieConsent = (config) => {
|
|
1777
|
+
const { cookieName, choiceKey, expiryYears = 1 } = config;
|
|
1778
|
+
const acceptCookies = () => {
|
|
1779
|
+
const expires = /* @__PURE__ */ new Date();
|
|
1780
|
+
expires.setFullYear(expires.getFullYear() + expiryYears);
|
|
1781
|
+
setCookie(cookieName, "true", expires);
|
|
1782
|
+
localStorage.setItem(cookieName, "true");
|
|
1783
|
+
};
|
|
1784
|
+
const rejectCookies = () => {
|
|
1785
|
+
removeCookie(cookieName);
|
|
1786
|
+
localStorage.removeItem(cookieName);
|
|
1787
|
+
sessionStorage.setItem(choiceKey, "true");
|
|
1788
|
+
};
|
|
1789
|
+
const areCookiesAccepted = () => getCookie(cookieName) === "true";
|
|
1790
|
+
const hasChoiceBeenMade = () => sessionStorage.getItem(choiceKey) === "true";
|
|
1791
|
+
const clearChoiceFromSession = () => sessionStorage.removeItem(choiceKey);
|
|
1792
|
+
return {
|
|
1793
|
+
acceptCookies,
|
|
1794
|
+
rejectCookies,
|
|
1795
|
+
areCookiesAccepted,
|
|
1796
|
+
hasChoiceBeenMade,
|
|
1797
|
+
clearChoiceFromSession
|
|
1798
|
+
};
|
|
1799
|
+
};
|
|
1800
|
+
|
|
1801
|
+
// src/NewHelpMethodsStandard/ScriptHandler/scriptHandler.ts
|
|
1802
|
+
var toggleScriptByConsent = (consent, options) => {
|
|
1803
|
+
if (typeof document === "undefined") return;
|
|
1804
|
+
const existingScript = document.getElementById(options.id);
|
|
1805
|
+
if (consent) {
|
|
1806
|
+
if (!existingScript) {
|
|
1807
|
+
const script = document.createElement("script");
|
|
1808
|
+
script.id = options.id;
|
|
1809
|
+
script.async = true;
|
|
1810
|
+
script.src = options.src;
|
|
1811
|
+
if (options.attributes) {
|
|
1812
|
+
Object.entries(options.attributes).forEach(
|
|
1813
|
+
([key, value]) => script.setAttribute(key, value)
|
|
1814
|
+
);
|
|
1815
|
+
}
|
|
1816
|
+
document.body.appendChild(script);
|
|
1817
|
+
}
|
|
1818
|
+
} else {
|
|
1819
|
+
if (existingScript) {
|
|
1820
|
+
existingScript.remove();
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
};
|
|
1824
|
+
var isScriptLoaded = (id) => {
|
|
1825
|
+
if (typeof document === "undefined") return false;
|
|
1826
|
+
return !!document.getElementById(id);
|
|
1827
|
+
};
|
|
1828
|
+
var removeScriptById = (id) => {
|
|
1829
|
+
if (typeof document === "undefined") return;
|
|
1830
|
+
const el = document.getElementById(id);
|
|
1831
|
+
if (el) el.remove();
|
|
1832
|
+
};
|
|
1833
|
+
|
|
1757
1834
|
// src/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.tsx
|
|
1758
1835
|
import { Fragment as Fragment12, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1759
1836
|
var RenderQuestion = ({
|
|
@@ -3043,8 +3120,12 @@ export {
|
|
|
3043
3120
|
TextHeadlineAndBodyStandard_default as TextHeadlineAndBodyStandard,
|
|
3044
3121
|
ValidationCheckAllVisibleQuestion_default as ValidationCheckAllVisibleQuestion,
|
|
3045
3122
|
ValidationErrorSummaryList_default as ValidationErrorSummaryList,
|
|
3123
|
+
createCookieConsent,
|
|
3046
3124
|
createLanguageSlice,
|
|
3047
3125
|
createQuestionsSlice,
|
|
3126
|
+
isScriptLoaded,
|
|
3048
3127
|
makeLanguageSelectors,
|
|
3049
|
-
makeQuestionsSelectors
|
|
3128
|
+
makeQuestionsSelectors,
|
|
3129
|
+
removeScriptById,
|
|
3130
|
+
toggleScriptByConsent
|
|
3050
3131
|
};
|
package/package.json
CHANGED