@comicrelief/component-library 7.24.1 → 7.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/main.yml +22 -24
- package/dist/components/Atoms/Button/Button.js +21 -15
- package/dist/components/Atoms/Button/Button.test.js +3 -3
- package/dist/components/Atoms/ButtonWithStates/ButtonWithStates.js +19 -22
- package/dist/components/Atoms/Checkbox/Checkbox.js +42 -26
- package/dist/components/Atoms/Checkbox/Checkbox.test.js +3 -3
- package/dist/components/Atoms/Confetti/Confetti.js +20 -23
- package/dist/components/Atoms/Confetti/_TriggerConfetti.js +4 -11
- package/dist/components/Atoms/ErrorText/ErrorText.js +15 -11
- package/dist/components/Atoms/ErrorText/ErrorText.test.js +3 -3
- package/dist/components/Atoms/Icons/Arrow.js +16 -15
- package/dist/components/Atoms/Icons/AtSign.js +9 -9
- package/dist/components/Atoms/Icons/Chevron.js +16 -15
- package/dist/components/Atoms/Icons/Curve.js +16 -18
- package/dist/components/Atoms/Icons/Download.js +8 -8
- package/dist/components/Atoms/Icons/External.js +8 -8
- package/dist/components/Atoms/Icons/Favourite.js +8 -8
- package/dist/components/Atoms/Icons/Internal.js +8 -8
- package/dist/components/Atoms/Icons/index.js +8 -8
- package/dist/components/Atoms/Input/Input.js +38 -33
- package/dist/components/Atoms/Input/input.test.js +3 -3
- package/dist/components/Atoms/Label/Label.js +28 -23
- package/dist/components/Atoms/Link/Link.js +24 -29
- package/dist/components/Atoms/Link/Link.style.js +51 -40
- package/dist/components/Atoms/Link/Link.test.js +9 -9
- package/dist/components/Atoms/Logo/Logo.js +16 -18
- package/dist/components/Atoms/Logo/Logo.test.js +3 -3
- package/dist/components/Atoms/Pagination/Item/Item.js +7 -7
- package/dist/components/Atoms/Pagination/Item/Item.style.js +35 -28
- package/dist/components/Atoms/Pagination/List/List.js +21 -19
- package/dist/components/Atoms/Pagination/Pagination.js +41 -49
- package/dist/components/Atoms/Pagination/Pagination.test.js +54 -108
- package/dist/components/Atoms/Pagination/Utils/PaginationCalculator.js +15 -15
- package/dist/components/Atoms/Picture/Picture.js +34 -44
- package/dist/components/Atoms/Picture/Picture.test.js +5 -5
- package/dist/components/Atoms/RadioButton/RadioButton.js +35 -23
- package/dist/components/Atoms/RadioButton/RadioButton.test.js +3 -3
- package/dist/components/Atoms/RichText/RichText.js +9 -11
- package/dist/components/Atoms/RichText/RichText.test.js +4 -4
- package/dist/components/Atoms/Select/Select.js +56 -49
- package/dist/components/Atoms/Select/Select.test.js +3 -3
- package/dist/components/Atoms/SocialIcons/Icon/Icon.js +13 -13
- package/dist/components/Atoms/SocialIcons/SocialIcons.js +25 -23
- package/dist/components/Atoms/SocialIcons/SocialIcons.test.js +7 -7
- package/dist/components/Atoms/SocialIcons/Utils/Icons.js +1 -1
- package/dist/components/Atoms/SocialIcons/Utils/Links.js +19 -20
- package/dist/components/Atoms/Text/Text.js +62 -41
- package/dist/components/Atoms/Text/Text.test.js +11 -11
- package/dist/components/Atoms/TextArea/TextArea.js +18 -17
- package/dist/components/Atoms/TextArea/TextArea.test.js +3 -3
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.js +69 -86
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.style.js +23 -15
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.test.js +15 -19
- package/dist/components/Molecules/Accordion/Accordion.js +35 -32
- package/dist/components/Molecules/Accordion/Accordion.test.js +3 -3
- package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.js +81 -52
- package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +5 -5
- package/dist/components/Molecules/Banner/Banner.js +21 -13
- package/dist/components/Molecules/Banner/Banner.test.js +3 -3
- package/dist/components/Molecules/Box/Box.js +33 -27
- package/dist/components/Molecules/Box/Box.test.js +5 -5
- package/dist/components/Molecules/Card/Card.js +22 -22
- package/dist/components/Molecules/Card/Card.test.js +5 -5
- package/dist/components/Molecules/CardDs/CardDs.js +80 -55
- package/dist/components/Molecules/CardDs/CardDs.test.js +3 -3
- package/dist/components/Molecules/Chip/Chip.js +8 -6
- package/dist/components/Molecules/Chip/Chip.style.js +48 -28
- package/dist/components/Molecules/Chip/Chip.test.js +4 -6
- package/dist/components/Molecules/Countdown/Countdown.js +28 -36
- package/dist/components/Molecules/Countdown/Countdown.style.js +3 -3
- package/dist/components/Molecules/Descriptor/Descriptor.js +32 -26
- package/dist/components/Molecules/Descriptor/Descriptor.test.js +5 -5
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.js +6 -4
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.style.js +7 -5
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.test.js +4 -4
- package/dist/components/Molecules/HeroBanner/HeroBanner.js +13 -17
- package/dist/components/Molecules/InfoBanner/InfoBanner.js +22 -18
- package/dist/components/Molecules/InfoBanner/InfoBanner.test.js +10 -10
- package/dist/components/Molecules/Logos/Logos.js +26 -14
- package/dist/components/Molecules/Logos/Logos.md +5 -0
- package/dist/components/Molecules/Lookup/Lookup.js +49 -84
- package/dist/components/Molecules/PartnerLink/PartnerLink.js +10 -11
- package/dist/components/Molecules/PartnerLink/PartnerLink.style.js +15 -9
- package/dist/components/Molecules/PartnerLink/PartnerLink.test.js +3 -3
- package/dist/components/Molecules/Promo/Promo.js +30 -36
- package/dist/components/Molecules/Promo/Promo.style.js +44 -31
- package/dist/components/Molecules/Promo/Promo.test.js +6 -6
- package/dist/components/Molecules/Promo/_ProgressRing.js +13 -19
- package/dist/components/Molecules/Promo/_PromoVideo.js +25 -34
- package/dist/components/Molecules/Promo/_PromoVideoButton.js +7 -7
- package/dist/components/Molecules/Promo/_PromoVideoButton.style.js +68 -41
- package/dist/components/Molecules/SchoolLookup/SchoolLookup.js +29 -52
- package/dist/components/Molecules/SchoolLookup/SchoolLookup.test.js +4 -4
- package/dist/components/Molecules/SearchInput/SearchInput.js +8 -8
- package/dist/components/Molecules/SearchInput/SearchInput.style.js +22 -14
- package/dist/components/Molecules/SearchInput/SearchInput.test.js +4 -4
- package/dist/components/Molecules/SearchResult/SearchResult.js +43 -29
- package/dist/components/Molecules/SearchResult/SearchResult.test.js +9 -9
- package/dist/components/Molecules/ShareButton/ShareButton.js +22 -26
- package/dist/components/Molecules/ShareButton/ShareButton.style.js +5 -5
- package/dist/components/Molecules/ShareButton/ShareButton.test.js +3 -3
- package/dist/components/Molecules/ShareButton/assets/ShareIcons.js +2 -2
- package/dist/components/Molecules/SimpleSchoolLookup/SimpleSchoolLookup.js +28 -55
- package/dist/components/Molecules/SingleMessage/SingleMessage.js +99 -123
- package/dist/components/Molecules/SingleMessage/SingleMessage.style.js +132 -81
- package/dist/components/Molecules/SingleMessage/SingleMessage.test.js +13 -13
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.js +31 -40
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.style.js +85 -49
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.test.js +3 -3
- package/dist/components/Molecules/Typeahead/Typeahead.js +47 -84
- package/dist/components/Molecules/Typeahead/Typeahead.test.js +12 -35
- package/dist/components/Molecules/VideoBanner/VideoBanner.js +20 -25
- package/dist/components/Molecules/VideoBanner/VideoBanner.test.js +4 -4
- package/dist/components/Organisms/CookieBanner/CookieBanner.js +7 -5
- package/dist/components/Organisms/CookieBanner/CookieBanner.style.js +21 -13
- package/dist/components/Organisms/CookieBanner/CookieBanner.test.js +5 -5
- package/dist/components/Organisms/Donate/Donate.js +42 -39
- package/dist/components/Organisms/Donate/Donate.md +85 -0
- package/dist/components/Organisms/Donate/Donate.style.js +85 -53
- package/dist/components/Organisms/Donate/Donate.test.js +10 -10
- package/dist/components/Organisms/Donate/Form/Form.js +64 -80
- package/dist/components/Organisms/Donate/Form/PopUpComponent.js +25 -30
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.js +11 -13
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.style.js +38 -22
- package/dist/components/Organisms/Donate/MoneyBuy/MoneyBuy.js +47 -30
- package/dist/components/Organisms/EmailSignUp/EmailSignUp.style.js +63 -37
- package/dist/components/Organisms/EmailSignUp/EmailSignUp.test.js +12 -12
- package/dist/components/Organisms/EmailSignUp/EmailSignUpForm.js +23 -43
- package/dist/components/Organisms/EmailSignUp/_EmailSignUp.js +25 -21
- package/dist/components/Organisms/EmailSignUp/_EmailSignUpConfig.js +10 -9
- package/dist/components/Organisms/EmailSignUp/_TextInput.js +20 -18
- package/dist/components/Organisms/Footer/Footer.js +10 -10
- package/dist/components/Organisms/Footer/Footer.style.js +27 -21
- package/dist/components/Organisms/Footer/Footer.test.js +3 -3
- package/dist/components/Organisms/Footer/Nav/Nav.js +59 -70
- package/dist/components/Organisms/Footer/Nav/Nav.style.js +77 -43
- package/dist/components/Organisms/Header/Burger/BurgerMenu.js +6 -4
- package/dist/components/Organisms/Header/Burger/BurgerMenu.style.js +37 -21
- package/dist/components/Organisms/Header/Header.js +8 -8
- package/dist/components/Organisms/Header/Header.style.js +27 -19
- package/dist/components/Organisms/Header/Nav/Nav.js +39 -50
- package/dist/components/Organisms/Header/Nav/Nav.style.js +103 -57
- package/dist/components/Organisms/Header/header.test.js +1 -1
- package/dist/components/Organisms/ImpactSlider/ImpactMoneybuys.style.js +32 -29
- package/dist/components/Organisms/ImpactSlider/ImpactSlider.js +19 -22
- package/dist/components/Organisms/ImpactSlider/ImpactSlider.style.js +38 -24
- package/dist/components/Organisms/ImpactSlider/Slider.style.js +8 -14
- package/dist/components/Organisms/ImpactSlider/_ImpactMoneybuys.js +11 -11
- package/dist/components/Organisms/ImpactSlider/_Slider.js +9 -7
- package/dist/components/Organisms/ImpactSlider/_utils.js +11 -11
- package/dist/components/Organisms/MarketingPreferencesDS/MarketingPreferencesDS.style.js +61 -38
- package/dist/components/Organisms/MarketingPreferencesDS/MarketingPreferencesDSForm.js +24 -16
- package/dist/components/Organisms/MarketingPreferencesDS/_AssociatedFields.js +1 -1
- package/dist/components/Organisms/MarketingPreferencesDS/_CheckAnswer.js +20 -16
- package/dist/components/Organisms/MarketingPreferencesDS/_DefaultCopy.js +3 -3
- package/dist/components/Organisms/MarketingPreferencesDS/_MarketingPreferencesDS.js +46 -36
- package/dist/components/Organisms/MarketingPreferencesDS/_MarketingPrefsConfig.js +21 -34
- package/dist/components/Organisms/MarketingPreferencesDS/_TextInput.js +20 -18
- package/dist/components/Organisms/Membership/Form/Form.js +48 -81
- package/dist/components/Organisms/Membership/Membership.js +17 -15
- package/dist/components/Organisms/Membership/Membership.style.js +81 -51
- package/dist/components/Organisms/Membership/Membership.test.js +4 -4
- package/dist/components/Organisms/Membership/MoneyBox/MoneyBox.js +37 -26
- package/dist/hoc/shallowWithTheme.js +1 -1
- package/dist/index.js +67 -67
- package/dist/styleguide/CRLogo.js +2 -2
- package/dist/styleguide/StyleGuideRenderer.js +9 -7
- package/dist/styleguide/ThemeWrapper.js +5 -3
- package/dist/styleguide/data/data.js +3 -3
- package/dist/theme/crTheme/buttonColors.js +6 -5
- package/dist/theme/crTheme/colors.js +4 -3
- package/dist/theme/crTheme/fontSizes.js +4 -3
- package/dist/theme/crTheme/linkStyles.js +6 -5
- package/dist/theme/crTheme/theme.js +1 -1
- package/dist/theme/shared/breakpoint.js +4 -3
- package/dist/theme/shared/fontFamilies.js +5 -4
- package/dist/theme/shared/hideVisually.js +1 -1
- package/dist/theme/shared/size.js +4 -3
- package/dist/theme/shared/spacing.js +2 -2
- package/dist/theme/shared/zIndex.js +3 -3
- package/dist/theme/srTheme/buttonColors.js +6 -5
- package/dist/theme/srTheme/colors.js +4 -3
- package/dist/theme/srTheme/fontSizes.js +4 -3
- package/dist/theme/srTheme/linkStyles.js +6 -5
- package/dist/theme/srTheme/theme.js +1 -1
- package/dist/utils/Membership.js +30 -27
- package/dist/utils/ShareButton/sharePopUpHelper.js +8 -8
- package/dist/utils/ShareButton/shareTracking.js +1 -1
- package/dist/utils/ShareButton/shareUrlHelper.js +3 -3
- package/dist/utils/allowListed.js +3 -5
- package/dist/utils/allowListed.test.js +3 -3
- package/dist/utils/internalLinkHelper.js +8 -10
- package/dist/utils/navHelper.js +2 -2
- package/package.json +12 -9
- package/playwright/components/atoms/checkbox.spec.js +64 -0
- package/playwright/components/atoms/input.spec.js +158 -0
- package/playwright/components/atoms/label.spec.js +29 -0
- package/playwright/components/atoms/link.spec.js +48 -0
- package/playwright/components/atoms/radioButton.spec.js +30 -0
- package/playwright/components/atoms/select.spec.js +36 -0
- package/playwright/components/atoms/textArea.spec.js +39 -0
- package/playwright/components/atoms/textInputWithDropdown.spec.js +23 -0
- package/playwright/components/molecules/accordian.spec.js +20 -0
- package/playwright/components/molecules/schoolLookup.spec.js +26 -0
- package/playwright/components/molecules/searchInput.spec.js +24 -0
- package/playwright/components/molecules/shareButton.spec.js +32 -0
- package/playwright/components/molecules/simpleSchoolLookUp.spec.js +35 -0
- package/playwright/components/molecules/typeahead.spec.js +27 -0
- package/playwright/components/organisms/donate.spec.js +293 -0
- package/playwright/components/organisms/emailSignUpForm.spec.js +109 -0
- package/playwright/components/organisms/footer.spec.js +67 -0
- package/playwright/components/organisms/header.spec.js +82 -0
- package/playwright/components/organisms/impactSlider.spec.js +292 -0
- package/playwright/components/organisms/marketingPreferences.spec.js +220 -0
- package/playwright/components/organisms/membership.spec.js +47 -0
- package/playwright.config.js +49 -0
- package/src/components/Molecules/Logos/Logos.js +18 -6
- package/src/components/Molecules/Logos/Logos.md +5 -0
- package/src/components/Organisms/Donate/Donate.js +11 -3
- package/src/components/Organisms/Donate/Donate.md +85 -0
- package/src/components/Organisms/Donate/Form/Form.js +20 -2
- package/src/components/Organisms/ImpactSlider/_ImpactMoneybuys.js +3 -4
- package/src/components/Organisms/Membership/Membership.test.js +1 -1
- package/cypress/e2e/components/atoms/button.cy.js +0 -102
- package/cypress/e2e/components/atoms/buttonWithStates.cy.js +0 -47
- package/cypress/e2e/components/atoms/checkbox.cy.js +0 -70
- package/cypress/e2e/components/atoms/confetti.cy.js +0 -46
- package/cypress/e2e/components/atoms/errorText.cy.js +0 -45
- package/cypress/e2e/components/atoms/input.cy.js +0 -157
- package/cypress/e2e/components/atoms/label.cy.js +0 -93
- package/cypress/e2e/components/atoms/link.cy.js +0 -190
- package/cypress/e2e/components/atoms/logo.cy.js +0 -132
- package/cypress/e2e/components/atoms/pagination.cy.js +0 -191
- package/cypress/e2e/components/atoms/picture.cy.js +0 -130
- package/cypress/e2e/components/atoms/radioButton.cy.js +0 -76
- package/cypress/e2e/components/atoms/richText.cy.js +0 -70
- package/cypress/e2e/components/atoms/select.cy.js +0 -84
- package/cypress/e2e/components/atoms/socialIcons.cy.js +0 -162
- package/cypress/e2e/components/atoms/text.cy.js +0 -169
- package/cypress/e2e/components/atoms/textArea.cy.js +0 -89
- package/cypress/e2e/components/atoms/textInputWithDrop.cy.js +0 -76
- package/cypress/e2e/components/molecules/accordion.cy.js +0 -67
- package/cypress/e2e/components/molecules/articleTeaser.cy.js +0 -105
- package/cypress/e2e/components/molecules/banner.cy.js +0 -67
- package/cypress/e2e/components/molecules/box.cy.js +0 -104
- package/cypress/e2e/components/molecules/card.cy.js +0 -105
- package/cypress/e2e/components/molecules/cardDs.cy.js +0 -198
- package/cypress/e2e/components/molecules/chip.cy.js +0 -68
- package/cypress/e2e/components/molecules/countdown.cy.js +0 -71
- package/cypress/e2e/components/molecules/descriptor.cy.js +0 -142
- package/cypress/e2e/components/molecules/doubleCopy.cy.js +0 -79
- package/cypress/e2e/components/molecules/heroBanner.cy.js +0 -69
- package/cypress/e2e/components/molecules/infoBanner.cy.js +0 -69
- package/cypress/e2e/components/molecules/partnerLink.cy.js +0 -68
- package/cypress/e2e/components/molecules/promo.cy.js +0 -74
- package/cypress/e2e/components/molecules/schoolLookup.cy.js +0 -83
- package/cypress/e2e/components/molecules/searchInput.cy.js +0 -72
- package/cypress/e2e/components/molecules/searchResult.cy.js +0 -191
- package/cypress/e2e/components/molecules/shareButton.cy.js +0 -76
- package/cypress/e2e/components/molecules/simpleSchoolLookup.cy.js +0 -83
- package/cypress/e2e/components/molecules/singleMessage.cy.js +0 -502
- package/cypress/e2e/components/molecules/singleMessageDs.cy.js +0 -234
- package/cypress/e2e/components/molecules/typeahead.cy.js +0 -97
- package/cypress/e2e/components/molecules/videoBanner.cy.js +0 -132
- package/cypress/e2e/components/organisms/cookieBanner.cy.js +0 -80
- package/cypress/e2e/components/organisms/donate.cy.js +0 -284
- package/cypress/e2e/components/organisms/emailSignUp.cy.js +0 -54
- package/cypress/e2e/components/organisms/footer.cy.js +0 -168
- package/cypress/e2e/components/organisms/header.cy.js +0 -138
- package/cypress/e2e/components/organisms/impactSlider.cy.js +0 -72
- package/cypress/e2e/components/organisms/marketingPreferencesDSForm.cy.js +0 -589
- package/cypress/e2e/components/organisms/membership.cy.js +0 -122
- package/cypress/fixtures/example.json +0 -5
- package/cypress/plugins/index.js +0 -21
- package/cypress/support/commands.js +0 -25
- package/cypress/support/e2e.js +0 -36
- package/cypress.config.js +0 -15
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -8,49 +8,63 @@ exports.SubmitButton = exports.OuterWrapper = exports.InnerWrapper = exports.Cur
|
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
var _Text = _interopRequireDefault(require("../../Atoms/Text/Text"));
|
|
10
10
|
var _Button = _interopRequireDefault(require("../../Atoms/Button/Button"));
|
|
11
|
-
|
|
11
|
+
const OuterWrapper = exports.OuterWrapper = _styledComponents.default.div.withConfig({
|
|
12
12
|
displayName: "ImpactSliderstyle__OuterWrapper",
|
|
13
13
|
componentId: "sc-1fpimol-0"
|
|
14
|
-
})(["position:relative;max-width:100%;background-color:", ";padding:32px 16px;@media ", "{padding:50px;}@media ", "{padding:64px 0;}"],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
})(["position:relative;max-width:100%;background-color:", ";padding:32px 16px;@media ", "{padding:50px;}@media ", "{padding:64px 0;}"], props => props.theme.color("".concat(props.backgroundColour)), _ref => {
|
|
15
|
+
let {
|
|
16
|
+
theme
|
|
17
|
+
} = _ref;
|
|
18
18
|
return theme.breakpoint('small');
|
|
19
|
-
},
|
|
20
|
-
|
|
19
|
+
}, _ref2 => {
|
|
20
|
+
let {
|
|
21
|
+
theme
|
|
22
|
+
} = _ref2;
|
|
21
23
|
return theme.breakpoint('medium');
|
|
22
24
|
});
|
|
23
|
-
|
|
25
|
+
const InnerWrapper = exports.InnerWrapper = _styledComponents.default.div.withConfig({
|
|
24
26
|
displayName: "ImpactSliderstyle__InnerWrapper",
|
|
25
27
|
componentId: "sc-1fpimol-1"
|
|
26
|
-
})(["width:100%;max-width:780px;margin:0 auto;@media ", "{h1{font-size:48px;line-height:48px;}}"],
|
|
27
|
-
|
|
28
|
+
})(["width:100%;max-width:780px;margin:0 auto;@media ", "{h1{font-size:48px;line-height:48px;}}"], _ref3 => {
|
|
29
|
+
let {
|
|
30
|
+
theme
|
|
31
|
+
} = _ref3;
|
|
28
32
|
return theme.breakpoint('medium');
|
|
29
33
|
});
|
|
30
|
-
|
|
34
|
+
const Copy = exports.Copy = _styledComponents.default.div.withConfig({
|
|
31
35
|
displayName: "ImpactSliderstyle__Copy",
|
|
32
36
|
componentId: "sc-1fpimol-2"
|
|
33
|
-
})(["position:relative;@media ", "{p{font-size:20px;line-height:24.38px;}}"],
|
|
34
|
-
|
|
37
|
+
})(["position:relative;@media ", "{p{font-size:20px;line-height:24.38px;}}"], _ref4 => {
|
|
38
|
+
let {
|
|
39
|
+
theme
|
|
40
|
+
} = _ref4;
|
|
35
41
|
return theme.breakpoint('medium');
|
|
36
42
|
});
|
|
37
|
-
|
|
43
|
+
const CurrentAmountCopy = exports.CurrentAmountCopy = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
38
44
|
displayName: "ImpactSliderstyle__CurrentAmountCopy",
|
|
39
45
|
componentId: "sc-1fpimol-3"
|
|
40
|
-
})(["font-weight:bold;margin-top:16px;@media ", "{font-size:20px;line-height:24.38px;margin:24px 0 38px;}"],
|
|
41
|
-
|
|
46
|
+
})(["font-weight:bold;margin-top:16px;@media ", "{font-size:20px;line-height:24.38px;margin:24px 0 38px;}"], _ref5 => {
|
|
47
|
+
let {
|
|
48
|
+
theme
|
|
49
|
+
} = _ref5;
|
|
42
50
|
return theme.breakpoint('medium');
|
|
43
51
|
});
|
|
44
|
-
|
|
52
|
+
const SubmitButton = exports.SubmitButton = (0, _styledComponents.default)(_Button.default).withConfig({
|
|
45
53
|
displayName: "ImpactSliderstyle__SubmitButton",
|
|
46
54
|
componentId: "sc-1fpimol-4"
|
|
47
|
-
})(["margin:32px auto 0;width:100%;font-family:", ";display:block;@media ", "{width:70%;margin:40px auto 0;}@media ", "{width:100%;}"],
|
|
48
|
-
|
|
55
|
+
})(["margin:32px auto 0;width:100%;font-family:", ";display:block;@media ", "{width:70%;margin:40px auto 0;}@media ", "{width:100%;}"], _ref6 => {
|
|
56
|
+
let {
|
|
57
|
+
theme
|
|
58
|
+
} = _ref6;
|
|
49
59
|
return theme.fontFamilies(theme.font.regular);
|
|
50
|
-
},
|
|
51
|
-
|
|
60
|
+
}, _ref7 => {
|
|
61
|
+
let {
|
|
62
|
+
theme
|
|
63
|
+
} = _ref7;
|
|
52
64
|
return theme.breakpoint('small');
|
|
53
|
-
},
|
|
54
|
-
|
|
65
|
+
}, _ref8 => {
|
|
66
|
+
let {
|
|
67
|
+
theme
|
|
68
|
+
} = _ref8;
|
|
55
69
|
return theme.breakpoint('medium');
|
|
56
70
|
});
|
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.StyledRangerSlider = exports.SliderWrapper = exports.SliderLabel = void 0;
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
var _reactRangeSliderInput = _interopRequireDefault(require("react-range-slider-input"));
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const thumbSize = 30;
|
|
11
|
+
const outlineSize = thumbSize / 2.5;
|
|
12
|
+
const sizeMultiplier = 1.4;
|
|
13
|
+
const StyledRangerSlider = exports.StyledRangerSlider = (0, _styledComponents.default)(_reactRangeSliderInput.default).withConfig({
|
|
14
14
|
displayName: "Sliderstyle__StyledRangerSlider",
|
|
15
15
|
componentId: "sc-pyds3x-0"
|
|
16
|
-
})(["background:white;height:16px;border-radius:16px;border:1px solid ", ";.range-slider__range{height:14px;border-radius:10px;background-color:", ";z-index:2;}.range-slider__thumb[data-upper]{&:after{background-color:white;width:", "px;height:", "px;content:\"\";position:absolute;transform:translate(-50%,-50%);top:50%;left:50%;border-radius:50%;border:", "px solid ", ";transition-property:width,height,border-width;transition-duration:0.15s;}&:hover{&:after{width:", "px;height:", "px;border-width:", "px;}}}.range-slider__thumb[data-lower]{width:0;}"],
|
|
17
|
-
|
|
18
|
-
}, function (props) {
|
|
19
|
-
return props.theme.color('red');
|
|
20
|
-
}, thumbSize, thumbSize, outlineSize, function (props) {
|
|
21
|
-
return props.theme.color('red');
|
|
22
|
-
}, thumbSize * sizeMultiplier, thumbSize * sizeMultiplier, outlineSize);
|
|
23
|
-
var SliderWrapper = exports.SliderWrapper = _styledComponents.default.div.withConfig({
|
|
16
|
+
})(["background:white;height:16px;border-radius:16px;border:1px solid ", ";.range-slider__range{height:14px;border-radius:10px;background-color:", ";z-index:2;}.range-slider__thumb[data-upper]{&:after{background-color:white;width:", "px;height:", "px;content:\"\";position:absolute;transform:translate(-50%,-50%);top:50%;left:50%;border-radius:50%;border:", "px solid ", ";transition-property:width,height,border-width;transition-duration:0.15s;}&:hover{&:after{width:", "px;height:", "px;border-width:", "px;}}}.range-slider__thumb[data-lower]{width:0;}"], props => props.theme.color('black'), props => props.theme.color('red'), thumbSize, thumbSize, outlineSize, props => props.theme.color('red'), thumbSize * sizeMultiplier, thumbSize * sizeMultiplier, outlineSize);
|
|
17
|
+
const SliderWrapper = exports.SliderWrapper = _styledComponents.default.div.withConfig({
|
|
24
18
|
displayName: "Sliderstyle__SliderWrapper",
|
|
25
19
|
componentId: "sc-pyds3x-1"
|
|
26
20
|
})(["width:100%;margin-top:25px;"]);
|
|
27
|
-
|
|
21
|
+
const SliderLabel = exports.SliderLabel = _styledComponents.default.label.withConfig({
|
|
28
22
|
displayName: "Sliderstyle__SliderLabel",
|
|
29
23
|
componentId: "sc-pyds3x-2"
|
|
30
24
|
})(["border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;"]);
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _ImpactMoneybuys = require("./ImpactMoneybuys.style");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return /*#__PURE__*/_react.default.createElement(_ImpactMoneybuys.MoneybuyWrapper, null, items.map(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var isInactive = !(!opacityAnimation || currentAmount >= roundedPerPound);
|
|
10
|
+
const Moneybuys = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
items,
|
|
13
|
+
currentAmount,
|
|
14
|
+
opacityAnimation
|
|
15
|
+
} = _ref;
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement(_ImpactMoneybuys.MoneybuyWrapper, null, items.map((item, index) => {
|
|
17
|
+
const thisAmount = Math.floor(currentAmount / item.poundsPerItem);
|
|
18
|
+
const isInactive = !(!opacityAnimation || currentAmount >= item.poundsPerItem);
|
|
19
19
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
20
|
-
key:
|
|
20
|
+
key: item.poundsPerItem
|
|
21
21
|
}, /*#__PURE__*/_react.default.createElement(_ImpactMoneybuys.Moneybuy, {
|
|
22
22
|
isInactive: isInactive,
|
|
23
23
|
"data-testid": "impact-slider--moneybuy-".concat(index + 1)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -8,12 +8,14 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
require("react-range-slider-input/dist/style.css");
|
|
10
10
|
var _Slider = require("./Slider.style");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const Slider = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
min,
|
|
14
|
+
max,
|
|
15
|
+
currentAmount,
|
|
16
|
+
handleChange,
|
|
17
|
+
steps
|
|
18
|
+
} = _ref;
|
|
17
19
|
return /*#__PURE__*/_react.default.createElement(_Slider.SliderWrapper, null, /*#__PURE__*/_react.default.createElement(_Slider.SliderLabel, {
|
|
18
20
|
htmlFor: "ImpactSlider"
|
|
19
21
|
}, "Slider label to be hidden"), /*#__PURE__*/_react.default.createElement(_Slider.StyledRangerSlider, {
|
|
@@ -4,22 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const getUrlParameter = name => {
|
|
8
|
+
const text = name.replace(/\[]/, '\\[').replace(/[\]]/, '\\]');
|
|
9
|
+
const regex = new RegExp("[\\?&]".concat(text, "=([^&#]*)"));
|
|
10
|
+
const results = regex.exec(window.location.search);
|
|
11
|
+
const param = results === null ? 'generic' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
12
12
|
return param;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const handleSubmission = (amount, donateLink, cartID, rowID) => {
|
|
15
|
+
let currentpageUrl = window.location.href;
|
|
16
|
+
const affiliateValue = getUrlParameter(currentpageUrl);
|
|
17
|
+
const reg = /[#?|[\]\\]/g;
|
|
18
18
|
if (currentpageUrl.match(reg) !== null) {
|
|
19
|
-
|
|
19
|
+
const thisMatch = currentpageUrl.match(reg)[0];
|
|
20
20
|
currentpageUrl = currentpageUrl.substring(0, currentpageUrl.indexOf(thisMatch));
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
const forwardingUrl = "".concat(donateLink, "/?cartId=").concat(cartID, "&amount=").concat(amount, "&clientOverride=donate¤cy=GBP&givingType=single&affiliate=").concat(affiliateValue, "&siteurl=").concat(currentpageUrl, "&rowID=").concat(rowID);
|
|
23
23
|
window.location.href = forwardingUrl;
|
|
24
24
|
};
|
|
25
25
|
var _default = exports.default = handleSubmission;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
@@ -10,85 +11,107 @@ var _spacing = _interopRequireDefault(require("../../../theme/shared/spacing"));
|
|
|
10
11
|
var _size = require("../../../theme/shared/size");
|
|
11
12
|
var _CR_Tick_black = _interopRequireDefault(require("./assets/CR_Tick_black.svg"));
|
|
12
13
|
var _TextInput = _interopRequireDefault(require("./_TextInput"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) { if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
-
var OuterWrapper = exports.OuterWrapper = _styledComponents.default.div.withConfig({
|
|
14
|
+
const OuterWrapper = exports.OuterWrapper = _styledComponents.default.div.withConfig({
|
|
16
15
|
displayName: "MarketingPreferencesDSstyle__OuterWrapper",
|
|
17
16
|
componentId: "sc-68n85q-0"
|
|
18
17
|
})(["display:flex;flex-direction:column;", "{flex-direction:row;flex-wrap:wrap;}"], (0, _size.media)('small'));
|
|
19
|
-
|
|
18
|
+
const TopCopyWrapper = exports.TopCopyWrapper = _styledComponents.default.div.withConfig({
|
|
20
19
|
displayName: "MarketingPreferencesDSstyle__TopCopyWrapper",
|
|
21
20
|
componentId: "sc-68n85q-1"
|
|
22
|
-
})(["margin:", " 0;display:flex;width:100%;@media ", "{padding:10px;}"], (0, _spacing.default)('l'),
|
|
23
|
-
|
|
21
|
+
})(["margin:", " 0;display:flex;width:100%;@media ", "{padding:10px;}"], (0, _spacing.default)('l'), _ref => {
|
|
22
|
+
let {
|
|
23
|
+
theme
|
|
24
|
+
} = _ref;
|
|
24
25
|
return theme.breakpoint('small');
|
|
25
26
|
});
|
|
26
|
-
|
|
27
|
+
const BottomCopyWrapper = exports.BottomCopyWrapper = _styledComponents.default.div.withConfig({
|
|
27
28
|
displayName: "MarketingPreferencesDSstyle__BottomCopyWrapper",
|
|
28
29
|
componentId: "sc-68n85q-2"
|
|
29
30
|
})(["margin:", " 0;"], (0, _spacing.default)('md'));
|
|
30
|
-
|
|
31
|
+
const Head = exports.Head = _styledComponents.default.div.withConfig({
|
|
31
32
|
displayName: "MarketingPreferencesDSstyle__Head",
|
|
32
33
|
componentId: "sc-68n85q-3"
|
|
33
34
|
})(["display:flex;justify-content:space-between;flex-direction:column;"]);
|
|
34
|
-
|
|
35
|
+
const FormField = exports.FormField = _styledComponents.default.div.withConfig({
|
|
35
36
|
displayName: "MarketingPreferencesDSstyle__FormField",
|
|
36
37
|
componentId: "sc-68n85q-4"
|
|
37
|
-
})(["", ""],
|
|
38
|
-
|
|
38
|
+
})(["", ""], _ref2 => {
|
|
39
|
+
let {
|
|
40
|
+
theme
|
|
41
|
+
} = _ref2;
|
|
39
42
|
return (0, _styledComponents.css)(["position:relative;margin-bottom:", ";width:100%;display:flex;flex-direction:column;@media ", "{width:50%;padding:10px;}label{position:relative;margin-bottom:", ";width:100%;color:", ";}h3{position:relative;margin-bottom:", ";&:before{position:absolute;top:0;left:0;width:24px;height:24px;content:'';}}"], (0, _spacing.default)('md'), theme.breakpoint('small'), (0, _spacing.default)('md'), theme.color('grey_dark'), (0, _spacing.default)('md'));
|
|
40
43
|
});
|
|
41
|
-
|
|
44
|
+
const CheckContainer = exports.CheckContainer = _styledComponents.default.div.withConfig({
|
|
42
45
|
displayName: "MarketingPreferencesDSstyle__CheckContainer",
|
|
43
46
|
componentId: "sc-68n85q-5"
|
|
44
|
-
})(["", ""],
|
|
45
|
-
|
|
47
|
+
})(["", ""], _ref3 => {
|
|
48
|
+
let {
|
|
49
|
+
theme
|
|
50
|
+
} = _ref3;
|
|
46
51
|
return (0, _styledComponents.css)(["width:100%;display:flex;justify-content:space-between;font-size:", ";font-family:", ";"], theme.fontSize('md'), theme.fontFamilies(theme.font.regular));
|
|
47
52
|
});
|
|
48
|
-
|
|
53
|
+
const CheckLabel = exports.CheckLabel = _styledComponents.default.label.withConfig({
|
|
49
54
|
displayName: "MarketingPreferencesDSstyle__CheckLabel",
|
|
50
55
|
componentId: "sc-68n85q-6"
|
|
51
|
-
})(["", ""],
|
|
52
|
-
|
|
56
|
+
})(["", ""], _ref4 => {
|
|
57
|
+
let {
|
|
58
|
+
theme
|
|
59
|
+
} = _ref4;
|
|
53
60
|
return (0, _styledComponents.css)(["display:flex;align-items:center;font-size:", ";@media ", "{font-size:", ";}"], theme.fontSize('xs'), theme.breakpoint('small'), theme.fontSize('s'));
|
|
54
61
|
});
|
|
55
|
-
|
|
62
|
+
const CheckInput = exports.CheckInput = _styledComponents.default.input.withConfig({
|
|
56
63
|
displayName: "MarketingPreferencesDSstyle__CheckInput",
|
|
57
64
|
componentId: "sc-68n85q-7"
|
|
58
|
-
})(["font-size:", ";display:block;box-sizing:border-box;opacity:0;position:absolute;width:100%;height:100%;left:0;top:0;margin:0;border:1px solid ", ";+ span{margin-right:10px;width:30px;height:30px;background-color:", ";border:1px solid ", ";float:left;border-radius:8px;@media ", "{margin-right:15px;}}:checked + span{background:url(", ") no-repeat center;background-color:", ";background-size:contain;}"],
|
|
59
|
-
|
|
65
|
+
})(["font-size:", ";display:block;box-sizing:border-box;opacity:0;position:absolute;width:100%;height:100%;left:0;top:0;margin:0;border:1px solid ", ";+ span{margin-right:10px;width:30px;height:30px;background-color:", ";border:1px solid ", ";float:left;border-radius:8px;@media ", "{margin-right:15px;}}:checked + span{background:url(", ") no-repeat center;background-color:", ";background-size:contain;}"], _ref5 => {
|
|
66
|
+
let {
|
|
67
|
+
theme
|
|
68
|
+
} = _ref5;
|
|
60
69
|
return theme.fontSize('sm');
|
|
61
|
-
},
|
|
62
|
-
|
|
70
|
+
}, _ref6 => {
|
|
71
|
+
let {
|
|
72
|
+
theme
|
|
73
|
+
} = _ref6;
|
|
63
74
|
return theme.color('grey_for_forms');
|
|
64
|
-
},
|
|
65
|
-
|
|
75
|
+
}, _ref7 => {
|
|
76
|
+
let {
|
|
77
|
+
theme
|
|
78
|
+
} = _ref7;
|
|
66
79
|
return theme.color('grey_light');
|
|
67
|
-
},
|
|
68
|
-
|
|
80
|
+
}, _ref8 => {
|
|
81
|
+
let {
|
|
82
|
+
theme
|
|
83
|
+
} = _ref8;
|
|
69
84
|
return theme.color('black');
|
|
70
|
-
},
|
|
71
|
-
|
|
85
|
+
}, _ref9 => {
|
|
86
|
+
let {
|
|
87
|
+
theme
|
|
88
|
+
} = _ref9;
|
|
72
89
|
return theme.breakpoint('small');
|
|
73
|
-
}, _CR_Tick_black.default,
|
|
74
|
-
|
|
90
|
+
}, _CR_Tick_black.default, _ref10 => {
|
|
91
|
+
let {
|
|
92
|
+
theme
|
|
93
|
+
} = _ref10;
|
|
75
94
|
return theme.color('grey_light');
|
|
76
95
|
});
|
|
77
|
-
|
|
96
|
+
const ShowHideInputWrapper = exports.ShowHideInputWrapper = _styledComponents.default.div.withConfig({
|
|
78
97
|
displayName: "MarketingPreferencesDSstyle__ShowHideInputWrapper",
|
|
79
98
|
componentId: "sc-68n85q-8"
|
|
80
|
-
})(["display:", ";width:100%;label{width:100%;border:none;padding:0;}"],
|
|
81
|
-
|
|
99
|
+
})(["display:", ";width:100%;label{width:100%;border:none;padding:0;}"], _ref11 => {
|
|
100
|
+
let {
|
|
101
|
+
show
|
|
102
|
+
} = _ref11;
|
|
82
103
|
return show ? 'block' : 'none';
|
|
83
104
|
});
|
|
84
|
-
|
|
105
|
+
const ExtraInfo = exports.ExtraInfo = _styledComponents.default.span.withConfig({
|
|
85
106
|
displayName: "MarketingPreferencesDSstyle__ExtraInfo",
|
|
86
107
|
componentId: "sc-68n85q-9"
|
|
87
108
|
})(["display:block;width:100%;font-size:1rem;text-transform:inherit;font-weight:normal;line-height:normal;font-family:'Montserrat',Helvetica,Arial,sans-serif;margin-bottom:0.5rem;+ label{margin-top:20px;&[for=\"mp_email\"],&[for=\"mp_mobile\"],&[for=\"mp_phone\"]{> span:first-child{position:absolute;margin:-1px;padding:0;width:1px;height:1px;border:0;overflow:hidden;clip:rect(1px 1px 1px 1px);word-wrap:normal;}}"]);
|
|
88
|
-
|
|
109
|
+
const MPTextInput = exports.MPTextInput = (0, _styledComponents.default)(_TextInput.default).withConfig({
|
|
89
110
|
displayName: "MarketingPreferencesDSstyle__MPTextInput",
|
|
90
111
|
componentId: "sc-68n85q-10"
|
|
91
|
-
})(["input{border:1px solid ", ";;", "{max-width:none;}}"],
|
|
92
|
-
|
|
112
|
+
})(["input{border:1px solid ", ";;", "{max-width:none;}}"], _ref12 => {
|
|
113
|
+
let {
|
|
114
|
+
theme
|
|
115
|
+
} = _ref12;
|
|
93
116
|
return theme.color('black');
|
|
94
117
|
}, (0, _size.media)('small'));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -16,17 +16,19 @@ var _MarketingPreferencesDS = require("./_MarketingPreferencesDS");
|
|
|
16
16
|
*/
|
|
17
17
|
/* Create default validation and initial values by not passing any override
|
|
18
18
|
parameters into the functions: */
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const mpValidation = (0, _MarketingPreferencesDS.buildValidationSchema)();
|
|
20
|
+
const initialValues = (0, _MarketingPreferencesDS.setInitialValues)();
|
|
21
|
+
const {
|
|
22
|
+
mpValidationSchema,
|
|
23
|
+
mpValidationOptions
|
|
24
|
+
} = mpValidation;
|
|
23
25
|
|
|
24
26
|
// Or customise and override the config to suit the destination app's requirements:
|
|
25
|
-
|
|
27
|
+
const initalValueOverrides = {
|
|
26
28
|
mp_email: 'user@website.com' // Potentially provided earlier in the journey
|
|
27
29
|
};
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
const validationOverrides = {
|
|
30
32
|
mp_permissionEmail: {
|
|
31
33
|
hideInput: true
|
|
32
34
|
},
|
|
@@ -41,31 +43,37 @@ var validationOverrides = {
|
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
// Pass these override objects in as parameters
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
const mpValidationCustom = (0, _MarketingPreferencesDS.buildValidationSchema)(validationOverrides);
|
|
47
|
+
const initialValuesCustom = (0, _MarketingPreferencesDS.setInitialValues)(initalValueOverrides);
|
|
48
|
+
const {
|
|
49
|
+
mpValidationSchema: mpValidationSchemaCustom,
|
|
50
|
+
mpValidationOptions: mpValidationOptionsCustom
|
|
51
|
+
} = mpValidationCustom;
|
|
52
|
+
const MarketingPreferencesDSForm = () => {
|
|
49
53
|
function customSubmitHandler(formData) {
|
|
50
54
|
// eslint-disable-next-line no-console
|
|
51
55
|
console.log('Successful submission', formData);
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
// For our default instance:
|
|
55
|
-
|
|
59
|
+
const formMethods = (0, _reactHookForm.useForm)({
|
|
56
60
|
mode: 'onBlur',
|
|
57
61
|
defaultValues: initialValues,
|
|
58
62
|
resolver: (0, _yup.yupResolver)(mpValidationSchema)
|
|
59
63
|
});
|
|
60
|
-
|
|
64
|
+
const {
|
|
65
|
+
handleSubmit
|
|
66
|
+
} = formMethods;
|
|
61
67
|
|
|
62
68
|
// For our customised-instance:
|
|
63
|
-
|
|
69
|
+
const formMethodsCustom = (0, _reactHookForm.useForm)({
|
|
64
70
|
mode: 'onBlur',
|
|
65
71
|
defaultValues: initialValuesCustom,
|
|
66
72
|
resolver: (0, _yup.yupResolver)(mpValidationSchemaCustom)
|
|
67
73
|
});
|
|
68
|
-
|
|
74
|
+
const {
|
|
75
|
+
handleSubmit: handleSubmitCustom
|
|
76
|
+
} = formMethodsCustom;
|
|
69
77
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
70
78
|
tag: "p",
|
|
71
79
|
weight: "bold"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -8,16 +8,20 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _AssociatedFields = _interopRequireDefault(require("./_AssociatedFields"));
|
|
10
10
|
var _MarketingPreferencesDS = require("./MarketingPreferencesDS.style");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
const CheckAnswer = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
name,
|
|
14
|
+
mpValidationOptions,
|
|
15
|
+
userSelection,
|
|
16
|
+
formContext
|
|
17
|
+
} = _ref;
|
|
18
|
+
const {
|
|
19
|
+
setValue,
|
|
20
|
+
clearErrors,
|
|
21
|
+
register
|
|
22
|
+
} = formContext;
|
|
23
|
+
const onChange = e => {
|
|
24
|
+
let newVal;
|
|
21
25
|
if (e.target.checked) {
|
|
22
26
|
newVal = e.target.value;
|
|
23
27
|
} else {
|
|
@@ -26,8 +30,8 @@ var CheckAnswer = function CheckAnswer(_ref) {
|
|
|
26
30
|
// To ensure we're not letting invalid values get passed, reset any associated fields
|
|
27
31
|
// but only when it's not a hidden "passed values behind the scenes" field:
|
|
28
32
|
if (!mpValidationOptions[name].hideInput) {
|
|
29
|
-
|
|
30
|
-
theseFields.forEach(
|
|
33
|
+
const theseFields = _AssociatedFields.default[name].fieldNames;
|
|
34
|
+
theseFields.forEach(fieldName => {
|
|
31
35
|
setValue(fieldName, '');
|
|
32
36
|
});
|
|
33
37
|
}
|
|
@@ -38,10 +42,10 @@ var CheckAnswer = function CheckAnswer(_ref) {
|
|
|
38
42
|
|
|
39
43
|
/* If the click represents either a 'none selected' or a 'not required' option
|
|
40
44
|
(set in config), reset errors for all fields associated with this checkbox */
|
|
41
|
-
|
|
45
|
+
const reValidate = !mpValidationOptions[name][newVal];
|
|
42
46
|
if (reValidate) {
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
const theseFields = _AssociatedFields.default[name].fieldNames;
|
|
48
|
+
theseFields.forEach(fieldName => {
|
|
45
49
|
clearErrors(fieldName);
|
|
46
50
|
});
|
|
47
51
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -8,7 +8,7 @@ exports.defaultCopyTop = exports.defaultCopyBottom = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _Text = _interopRequireDefault(require("../../Atoms/Text/Text"));
|
|
10
10
|
var _Link = _interopRequireDefault(require("../../Atoms/Link/Link"));
|
|
11
|
-
|
|
11
|
+
const defaultCopyTop = exports.defaultCopyTop = /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
12
12
|
tag: "h3",
|
|
13
13
|
size: "xl",
|
|
14
14
|
family: "Anton",
|
|
@@ -24,7 +24,7 @@ var defaultCopyTop = exports.defaultCopyTop = /*#__PURE__*/_react.default.create
|
|
|
24
24
|
size: "md",
|
|
25
25
|
color: "grey_dark"
|
|
26
26
|
}, "Please tick the relevant boxes below if you would like to hear from us."));
|
|
27
|
-
|
|
27
|
+
const defaultCopyBottom = exports.defaultCopyBottom = /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
28
28
|
tag: "p",
|
|
29
29
|
color: "grey_dark"
|
|
30
30
|
}, "Update your preferences at any time by visiting our", ' ', /*#__PURE__*/_react.default.createElement(_Link.default, {
|