@comicrelief/component-library 7.24.0 → 7.24.2
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 +3 -3
- package/dist/components/Atoms/SocialIcons/Utils/Links.js +19 -20
- package/dist/components/Atoms/SocialIcons/assets/X-white-Subtract.svg +3 -0
- 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 +34 -37
- 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 +53 -78
- 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/Atoms/SocialIcons/Utils/Icons.js +1 -1
- package/src/components/Atoms/SocialIcons/assets/X-white-Subtract.svg +3 -0
- package/src/components/Molecules/Logos/Logos.js +18 -6
- package/src/components/Molecules/Logos/Logos.md +5 -0
- 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
- package/dist/components/Atoms/SocialIcons/assets/x-logo.svg +0 -3
- package/src/components/Atoms/SocialIcons/assets/x-logo.svg +0 -3
|
@@ -1,11 +1,11 @@
|
|
|
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
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _reactResponsive = require("react-responsive");
|
|
11
11
|
var _size = require("../../../theme/shared/size");
|
|
@@ -13,47 +13,44 @@ var _Text = _interopRequireDefault(require("../../Atoms/Text/Text"));
|
|
|
13
13
|
var _Picture = _interopRequireDefault(require("../../Atoms/Picture/Picture"));
|
|
14
14
|
var _Form = _interopRequireDefault(require("./Form/Form"));
|
|
15
15
|
var _Donate = require("./Donate.style");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
16
|
+
const Donate = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
alt,
|
|
19
|
+
cartID,
|
|
20
|
+
clientID,
|
|
21
|
+
desktopOverlayColor,
|
|
22
|
+
mobileBackgroundColor,
|
|
23
|
+
submitButtonColor,
|
|
24
|
+
textColor,
|
|
25
|
+
donateLink,
|
|
26
|
+
data,
|
|
27
|
+
title,
|
|
28
|
+
subtitle,
|
|
29
|
+
otherAmountText,
|
|
30
|
+
formAlignRight,
|
|
31
|
+
images,
|
|
32
|
+
image,
|
|
33
|
+
imageLow,
|
|
34
|
+
mobileImages,
|
|
35
|
+
mobileImage,
|
|
36
|
+
mobileImageLow,
|
|
37
|
+
mobileAlt,
|
|
38
|
+
mbshipID,
|
|
39
|
+
noMoneyBuys,
|
|
40
|
+
PopUpText,
|
|
41
|
+
chooseAmountText,
|
|
42
|
+
isDesktopOverride,
|
|
43
|
+
otherAmountValue
|
|
44
|
+
} = _ref;
|
|
45
|
+
let isDesktop = (0, _reactResponsive.useMediaQuery)({
|
|
46
46
|
query: "(min-width: ".concat(_size.screen.medium, ")")
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
// To let us store any updated override, and force a re-render
|
|
50
|
-
|
|
51
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
52
|
-
overrideValue = _useState2[0],
|
|
53
|
-
setOverrideValue = _useState2[1];
|
|
50
|
+
const [overrideValue, setOverrideValue] = (0, _react.useState)(null);
|
|
54
51
|
|
|
55
52
|
// Store the updated override value
|
|
56
|
-
(0, _react.useEffect)(
|
|
53
|
+
(0, _react.useEffect)(() => {
|
|
57
54
|
setOverrideValue(isDesktopOverride);
|
|
58
55
|
}, [isDesktopOverride]);
|
|
59
56
|
|
|
@@ -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
|
});
|
|
@@ -14,122 +14,154 @@ var _Picture = _interopRequireDefault(require("../../Atoms/Picture/Picture"));
|
|
|
14
14
|
var _zIndex = _interopRequireDefault(require("../../../theme/shared/zIndex"));
|
|
15
15
|
// import styled, { css } from 'styled-components';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const Container = exports.Container = _styledComponents.default.div.withConfig({
|
|
18
18
|
displayName: "Donatestyle__Container",
|
|
19
19
|
componentId: "sc-8rjm3t-0"
|
|
20
|
-
})(["position:relative;display:flex;flex-direction:column;justify-content:center;height:auto;background-color:", ";", "{flex-direction:row;align-items:center;justify-content:inherit;background-color:", ";}"],
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
})(["position:relative;display:flex;flex-direction:column;justify-content:center;height:auto;background-color:", ";", "{flex-direction:row;align-items:center;justify-content:inherit;background-color:", ";}"], _ref => {
|
|
21
|
+
let {
|
|
22
|
+
theme,
|
|
23
|
+
mobileBackgroundColor
|
|
24
|
+
} = _ref;
|
|
23
25
|
return theme.color(mobileBackgroundColor);
|
|
24
|
-
}, (0, _size.media)('medium'),
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
}, (0, _size.media)('medium'), _ref2 => {
|
|
27
|
+
let {
|
|
28
|
+
theme,
|
|
29
|
+
desktopOverlayColor
|
|
30
|
+
} = _ref2;
|
|
27
31
|
return theme.color(desktopOverlayColor);
|
|
28
32
|
});
|
|
29
|
-
|
|
33
|
+
const PopUp = exports.PopUp = _styledComponents.default.div.withConfig({
|
|
30
34
|
displayName: "Donatestyle__PopUp",
|
|
31
35
|
componentId: "sc-8rjm3t-1"
|
|
32
36
|
})(["background:green;height:100px;"]);
|
|
33
|
-
|
|
37
|
+
const BgImage = exports.BgImage = (0, _styledComponents.default)(_Picture.default).withConfig({
|
|
34
38
|
displayName: "Donatestyle__BgImage",
|
|
35
39
|
componentId: "sc-8rjm3t-2"
|
|
36
|
-
})(["display:block;position:absolute;bottom:0;left:0;right:0;height:100%;", ""],
|
|
37
|
-
|
|
40
|
+
})(["display:block;position:absolute;bottom:0;left:0;right:0;height:100%;", ""], _ref3 => {
|
|
41
|
+
let {
|
|
42
|
+
backgroundColor
|
|
43
|
+
} = _ref3;
|
|
38
44
|
return backgroundColor !== 'transparent' && "\n opacity: 0.4;\n ";
|
|
39
45
|
});
|
|
40
|
-
|
|
46
|
+
const Wrapper = exports.Wrapper = _styledComponents.default.div.withConfig({
|
|
41
47
|
displayName: "Donatestyle__Wrapper",
|
|
42
48
|
componentId: "sc-8rjm3t-3"
|
|
43
|
-
})(["position:relative;text-align:center;padding:", " ", ";flex-direction:row;align-items:center;display:block;width:100%;flex-direction:", ";", "{padding:", " ", ";}", "{display:flex;padding:", " 0;}"], (0, _spacing.default)('l'), (0, _spacing.default)('md'),
|
|
44
|
-
|
|
49
|
+
})(["position:relative;text-align:center;padding:", " ", ";flex-direction:row;align-items:center;display:block;width:100%;flex-direction:", ";", "{padding:", " ", ";}", "{display:flex;padding:", " 0;}"], (0, _spacing.default)('l'), (0, _spacing.default)('md'), _ref4 => {
|
|
50
|
+
let {
|
|
51
|
+
formAlignRight
|
|
52
|
+
} = _ref4;
|
|
45
53
|
return formAlignRight === true ? 'row-reverse' : 'row';
|
|
46
54
|
}, (0, _size.media)('small'), (0, _spacing.default)('xl'), (0, _spacing.default)('md'), (0, _size.media)('medium'), (0, _spacing.default)('xl'));
|
|
47
|
-
|
|
55
|
+
const Header = exports.Header = _styledComponents.default.div.withConfig({
|
|
48
56
|
displayName: "Donatestyle__Header",
|
|
49
57
|
componentId: "sc-8rjm3t-4"
|
|
50
|
-
})(["width:100%;display:flex;font-family:", ";", "{width:50%;padding:", ";align-items:center;}"],
|
|
51
|
-
|
|
58
|
+
})(["width:100%;display:flex;font-family:", ";", "{width:50%;padding:", ";align-items:center;}"], _ref5 => {
|
|
59
|
+
let {
|
|
60
|
+
theme
|
|
61
|
+
} = _ref5;
|
|
52
62
|
return theme.fontFamilies(theme.font.regular);
|
|
53
63
|
}, (0, _size.media)('medium'), (0, _spacing.default)('xl'));
|
|
54
|
-
|
|
64
|
+
const HeaderInner = exports.HeaderInner = _styledComponents.default.div.withConfig({
|
|
55
65
|
displayName: "Donatestyle__HeaderInner",
|
|
56
66
|
componentId: "sc-8rjm3t-5"
|
|
57
67
|
})(["position:relative;text-align:left;"]);
|
|
58
|
-
|
|
68
|
+
const FormWrapper = exports.FormWrapper = _styledComponents.default.div.withConfig({
|
|
59
69
|
displayName: "Donatestyle__FormWrapper",
|
|
60
70
|
componentId: "sc-8rjm3t-6"
|
|
61
|
-
})(["position:relative;font-family:", ";", "{width:50%;}"],
|
|
62
|
-
|
|
71
|
+
})(["position:relative;font-family:", ";", "{width:50%;}"], _ref6 => {
|
|
72
|
+
let {
|
|
73
|
+
theme
|
|
74
|
+
} = _ref6;
|
|
63
75
|
return theme.fontFamilies(theme.font.regular);
|
|
64
76
|
}, (0, _size.media)('medium'));
|
|
65
|
-
|
|
77
|
+
const Error = exports.Error = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
66
78
|
displayName: "Donatestyle__Error",
|
|
67
79
|
componentId: "sc-8rjm3t-7"
|
|
68
|
-
})(["color:", ";font-size:", ";font-weight:500;margin-top:", ";"],
|
|
69
|
-
|
|
80
|
+
})(["color:", ";font-size:", ";font-weight:500;margin-top:", ";"], _ref7 => {
|
|
81
|
+
let {
|
|
82
|
+
theme
|
|
83
|
+
} = _ref7;
|
|
70
84
|
return theme.color('red');
|
|
71
|
-
},
|
|
72
|
-
|
|
85
|
+
}, _ref8 => {
|
|
86
|
+
let {
|
|
87
|
+
theme
|
|
88
|
+
} = _ref8;
|
|
73
89
|
return theme.fontSize('s');
|
|
74
90
|
}, (0, _spacing.default)('l'));
|
|
75
|
-
|
|
91
|
+
const Form = exports.Form = _styledComponents.default.form.withConfig({
|
|
76
92
|
displayName: "Donatestyle__Form",
|
|
77
93
|
componentId: "sc-8rjm3t-8"
|
|
78
|
-
})(["position:relative;width:100%;background-color:", ";box-shadow:0px 0px 16px rgba(0,0,0,0.15);border-radius:10px;margin-top:", ";h3{margin-top:", ";}input{max-width:100%;margin:0;}input[type='submit']{margin:", " 0;}", "{width:450px;margin-right:auto;margin-left:auto;}"],
|
|
79
|
-
|
|
94
|
+
})(["position:relative;width:100%;background-color:", ";box-shadow:0px 0px 16px rgba(0,0,0,0.15);border-radius:10px;margin-top:", ";h3{margin-top:", ";}input{max-width:100%;margin:0;}input[type='submit']{margin:", " 0;}", "{width:450px;margin-right:auto;margin-left:auto;}"], _ref9 => {
|
|
95
|
+
let {
|
|
96
|
+
theme
|
|
97
|
+
} = _ref9;
|
|
80
98
|
return theme.color('white');
|
|
81
99
|
}, (0, _spacing.default)('md'), (0, _spacing.default)('md'), (0, _spacing.default)('l'), (0, _size.media)('small'));
|
|
82
|
-
|
|
100
|
+
const OuterFieldset = exports.OuterFieldset = _styledComponents.default.fieldset.withConfig({
|
|
83
101
|
displayName: "Donatestyle__OuterFieldset",
|
|
84
102
|
componentId: "sc-8rjm3t-9"
|
|
85
103
|
})(["padding:0 ", " ", ";margin:0;border:none;", "{padding:0 ", " ", ";}input[type='submit']{margin-bottom:0;}"], (0, _spacing.default)('md'), (0, _spacing.default)('md'), (0, _size.media)('small'), (0, _spacing.default)('l'), (0, _spacing.default)('l'));
|
|
86
|
-
|
|
104
|
+
const Legend = exports.Legend = _styledComponents.default.legend.withConfig({
|
|
87
105
|
displayName: "Donatestyle__Legend",
|
|
88
106
|
componentId: "sc-8rjm3t-10"
|
|
89
107
|
})(["margin:0;padding:", " ", ";display:block;width:100%;"], (0, _spacing.default)('l'), (0, _spacing.default)('sm'));
|
|
90
|
-
|
|
108
|
+
const MoneyBuys = exports.MoneyBuys = _styledComponents.default.div.withConfig({
|
|
91
109
|
displayName: "Donatestyle__MoneyBuys",
|
|
92
110
|
componentId: "sc-8rjm3t-11"
|
|
93
111
|
})(["display:flex;justify-content:space-between;flex-direction:column;margin-bottom:", ";", "{flex-direction:row;}label{flex:0 0 30%;margin-bottom:", ";", "{margin-bottom:0;}input{cursor:pointer;padding:", " ", ";}}"], (0, _spacing.default)('l'), (0, _size.media)('small'), (0, _spacing.default)('sm'), (0, _size.media)('small'), (0, _spacing.default)('m'), (0, _spacing.default)('sm'));
|
|
94
|
-
|
|
112
|
+
const FormFieldset = exports.FormFieldset = _styledComponents.default.div.withConfig({
|
|
95
113
|
displayName: "Donatestyle__FormFieldset",
|
|
96
114
|
componentId: "sc-8rjm3t-12"
|
|
97
115
|
})(["display:flex;align-items:center;justify-content:center;"]);
|
|
98
|
-
|
|
116
|
+
const Label = exports.Label = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
99
117
|
displayName: "Donatestyle__Label",
|
|
100
118
|
componentId: "sc-8rjm3t-13"
|
|
101
119
|
})(["margin-right:", ";"], (0, _spacing.default)('sm'));
|
|
102
|
-
|
|
120
|
+
const AmountField = exports.AmountField = (0, _styledComponents.default)(_Input.default).withConfig({
|
|
103
121
|
displayName: "Donatestyle__AmountField",
|
|
104
122
|
componentId: "sc-8rjm3t-14"
|
|
105
|
-
})(["position:relative;flex-basis:50%;flex-shrink:0;flex-grow:0;font-weight:400;display:block;", "{flex-basis:60%;}span{position:absolute;font-size:20px;top:50%;transform:translateY(-50%);left:0px;font-weight:500;padding:0px 15px;", ";}input{height:48px;border:2px solid ", ";background:", ";border-radius:10px;padding:", " ", " ", " ", ";&:focus{outline:none;border:2px solid ", ";}}"], (0, _size.media)('small'), (0, _zIndex.default)('high'),
|
|
106
|
-
|
|
123
|
+
})(["position:relative;flex-basis:50%;flex-shrink:0;flex-grow:0;font-weight:400;display:block;", "{flex-basis:60%;}span{position:absolute;font-size:20px;top:50%;transform:translateY(-50%);left:0px;font-weight:500;padding:0px 15px;", ";}input{height:48px;border:2px solid ", ";background:", ";border-radius:10px;padding:", " ", " ", " ", ";&:focus{outline:none;border:2px solid ", ";}}"], (0, _size.media)('small'), (0, _zIndex.default)('high'), _ref10 => {
|
|
124
|
+
let {
|
|
125
|
+
theme
|
|
126
|
+
} = _ref10;
|
|
107
127
|
return theme.color('grey');
|
|
108
|
-
},
|
|
109
|
-
|
|
128
|
+
}, _ref11 => {
|
|
129
|
+
let {
|
|
130
|
+
theme
|
|
131
|
+
} = _ref11;
|
|
110
132
|
return theme.color('grey_light');
|
|
111
|
-
}, (0, _spacing.default)('sm'), (0, _spacing.default)('md'), (0, _spacing.default)('sm'), (0, _spacing.default)('l'),
|
|
112
|
-
|
|
133
|
+
}, (0, _spacing.default)('sm'), (0, _spacing.default)('md'), (0, _spacing.default)('sm'), (0, _spacing.default)('l'), _ref12 => {
|
|
134
|
+
let {
|
|
135
|
+
theme
|
|
136
|
+
} = _ref12;
|
|
113
137
|
return theme.color('grey');
|
|
114
138
|
});
|
|
115
|
-
|
|
139
|
+
const Copy = exports.Copy = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
116
140
|
displayName: "Donatestyle__Copy",
|
|
117
141
|
componentId: "sc-8rjm3t-15"
|
|
118
142
|
})(["line-height:1.5;margin-top:", ";"], (0, _spacing.default)('l'));
|
|
119
|
-
|
|
143
|
+
const Button = exports.Button = _styledComponents.default.button.withConfig({
|
|
120
144
|
displayName: "Donatestyle__Button",
|
|
121
145
|
componentId: "sc-8rjm3t-16"
|
|
122
|
-
})(["width:100%;margin:", " 0 ", ";color:", ";font-size:", ";font-weight:bold;cursor:pointer;min-height:48px;background:", ";text-decoration:none;border-radius:2rem;border:none;box-shadow:0px 0px 16px rgba(0,0,0,0.15);appearance:none;:active,:focus,:hover{outline:none;background-color:", ";}", "{padding:", " ", ";}"], (0, _spacing.default)('l'), (0, _spacing.default)('l'),
|
|
123
|
-
|
|
146
|
+
})(["width:100%;margin:", " 0 ", ";color:", ";font-size:", ";font-weight:bold;cursor:pointer;min-height:48px;background:", ";text-decoration:none;border-radius:2rem;border:none;box-shadow:0px 0px 16px rgba(0,0,0,0.15);appearance:none;:active,:focus,:hover{outline:none;background-color:", ";}", "{padding:", " ", ";}"], (0, _spacing.default)('l'), (0, _spacing.default)('l'), _ref13 => {
|
|
147
|
+
let {
|
|
148
|
+
theme
|
|
149
|
+
} = _ref13;
|
|
124
150
|
return theme.color('white');
|
|
125
|
-
},
|
|
126
|
-
|
|
151
|
+
}, _ref14 => {
|
|
152
|
+
let {
|
|
153
|
+
theme
|
|
154
|
+
} = _ref14;
|
|
127
155
|
return theme.fontSize('s');
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
|
|
156
|
+
}, _ref15 => {
|
|
157
|
+
let {
|
|
158
|
+
theme,
|
|
159
|
+
color
|
|
160
|
+
} = _ref15;
|
|
131
161
|
return theme.color(color);
|
|
132
|
-
},
|
|
133
|
-
|
|
162
|
+
}, _ref16 => {
|
|
163
|
+
let {
|
|
164
|
+
theme
|
|
165
|
+
} = _ref16;
|
|
134
166
|
return theme.color('coral_dark');
|
|
135
167
|
}, (0, _size.media)('small'), (0, _spacing.default)('md'), (0, _spacing.default)('l'));
|
|
@@ -1,15 +1,15 @@
|
|
|
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
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
require("jest-styled-components");
|
|
6
6
|
var _shallowWithTheme = _interopRequireDefault(require("../../../hoc/shallowWithTheme"));
|
|
7
7
|
var _Donate = _interopRequireDefault(require("./Donate"));
|
|
8
8
|
var _data = _interopRequireDefault(require("./dev-data/data"));
|
|
9
9
|
var _dataSingle = _interopRequireDefault(require("./dev-data/data-single"));
|
|
10
|
-
|
|
11
|
-
it('Monthly donation renders correctly',
|
|
12
|
-
|
|
10
|
+
const defaultData = require('../../../styleguide/data/data').defaultData;
|
|
11
|
+
it('Monthly donation renders correctly', () => {
|
|
12
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Donate.default, {
|
|
13
13
|
alt: "Background image",
|
|
14
14
|
backgroundColor: "blue_dark",
|
|
15
15
|
formAlignRight: true,
|
|
@@ -26,8 +26,8 @@ it('Monthly donation renders correctly', function () {
|
|
|
26
26
|
})).toJSON();
|
|
27
27
|
expect(tree).toMatchSnapshot();
|
|
28
28
|
});
|
|
29
|
-
it('Single donation renders correctly',
|
|
30
|
-
|
|
29
|
+
it('Single donation renders correctly', () => {
|
|
30
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Donate.default, {
|
|
31
31
|
backgroundColor: "blue_dark",
|
|
32
32
|
formAlignRight: false,
|
|
33
33
|
imageLow: defaultData.pictures.imageLow,
|
|
@@ -43,8 +43,8 @@ it('Single donation renders correctly', function () {
|
|
|
43
43
|
})).toJSON();
|
|
44
44
|
expect(tree).toMatchSnapshot();
|
|
45
45
|
});
|
|
46
|
-
it('Single donation with no Money Buys renders correctly',
|
|
47
|
-
|
|
46
|
+
it('Single donation with no Money Buys renders correctly', () => {
|
|
47
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Donate.default, {
|
|
48
48
|
backgroundColor: "blue_dark",
|
|
49
49
|
formAlignRight: false,
|
|
50
50
|
imageLow: defaultData.pictures.imageLow,
|
|
@@ -62,8 +62,8 @@ it('Single donation with no Money Buys renders correctly', function () {
|
|
|
62
62
|
})).toJSON();
|
|
63
63
|
expect(tree).toMatchSnapshot();
|
|
64
64
|
});
|
|
65
|
-
it('"Single Giving, No Money Buys, with overridden manual input value" renders correctly',
|
|
66
|
-
|
|
65
|
+
it('"Single Giving, No Money Buys, with overridden manual input value" renders correctly', () => {
|
|
66
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Donate.default, {
|
|
67
67
|
mobileBackgroundColor: "blue_dark",
|
|
68
68
|
desktopOverlayColor: "blue_dark",
|
|
69
69
|
formAlignRight: false,
|
|
@@ -1,12 +1,11 @@
|
|
|
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
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
9
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
10
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
10
|
var _PopUpComponent = _interopRequireDefault(require("./PopUpComponent"));
|
|
12
11
|
var _Text = _interopRequireDefault(require("../../../Atoms/Text/Text"));
|
|
@@ -14,68 +13,50 @@ var _MoneyBuy = _interopRequireDefault(require("../MoneyBuy/MoneyBuy"));
|
|
|
14
13
|
var _Membership = require("../../../../utils/Membership");
|
|
15
14
|
var _Donate = require("../Donate.style");
|
|
16
15
|
var _GivingSelector = _interopRequireDefault(require("../GivingSelector/GivingSelector"));
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
41
|
-
errorMsg = _useState4[0],
|
|
42
|
-
setErrorMsg = _useState4[1];
|
|
43
|
-
var _useState5 = (0, _react.useState)(10),
|
|
44
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
45
|
-
amountDonate = _useState6[0],
|
|
46
|
-
setAmountDonate = _useState6[1];
|
|
47
|
-
var _useState7 = (0, _react.useState)(true),
|
|
48
|
-
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
49
|
-
moneyBuyCopy = _useState8[0],
|
|
50
|
-
setMoneyBuyCopy = _useState8[1];
|
|
51
|
-
var _useState9 = (0, _react.useState)(false),
|
|
52
|
-
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
53
|
-
popOpen = _useState10[0],
|
|
54
|
-
setPopOpen = _useState10[1];
|
|
16
|
+
const Signup = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
data: {
|
|
19
|
+
singleGiving,
|
|
20
|
+
regularGiving
|
|
21
|
+
},
|
|
22
|
+
donateLink,
|
|
23
|
+
otherAmountText,
|
|
24
|
+
clientID,
|
|
25
|
+
cartID,
|
|
26
|
+
mbshipID,
|
|
27
|
+
noMoneyBuys,
|
|
28
|
+
PopUpText,
|
|
29
|
+
chooseAmountText,
|
|
30
|
+
submitButtonColor,
|
|
31
|
+
otherAmountValue,
|
|
32
|
+
...rest
|
|
33
|
+
} = _ref;
|
|
34
|
+
const [givingType, setGivingType] = (0, _react.useState)('single');
|
|
35
|
+
const [errorMsg, setErrorMsg] = (0, _react.useState)(false);
|
|
36
|
+
const [amountDonate, setAmountDonate] = (0, _react.useState)(10);
|
|
37
|
+
const [moneyBuyCopy, setMoneyBuyCopy] = (0, _react.useState)(true);
|
|
38
|
+
const [popOpen, setPopOpen] = (0, _react.useState)(false);
|
|
55
39
|
// In order to keep track of whether the user has ever been shown the popup
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
popUpShown = _useState12[0],
|
|
59
|
-
setPopUpShown = _useState12[1];
|
|
60
|
-
(0, _react.useEffect)(function () {
|
|
40
|
+
const [popUpShown, setPopUpShown] = (0, _react.useState)(false);
|
|
41
|
+
(0, _react.useEffect)(() => {
|
|
61
42
|
// If a specific 'other amount' has been passed down, use it,
|
|
62
43
|
// otherwise assign based on the associated moneybuys:
|
|
63
44
|
if (otherAmountValue) {
|
|
64
45
|
setAmountDonate(otherAmountValue);
|
|
65
46
|
} else {
|
|
66
|
-
|
|
47
|
+
const givingData = givingType === 'single' ? singleGiving : regularGiving;
|
|
67
48
|
|
|
68
49
|
// Check the 2nd moneybuy exists before using it;
|
|
69
50
|
// 'philantrophy' carts have been set up to use a single moneybuy.
|
|
70
51
|
// See ENG-1685 for more details
|
|
71
|
-
|
|
52
|
+
const thisAmount = givingData.moneybuys[1] ? givingData.moneybuys[1].value : givingData.moneybuys[0].value;
|
|
72
53
|
setAmountDonate(thisAmount);
|
|
73
54
|
}
|
|
74
55
|
}, [givingType, singleGiving, regularGiving, otherAmountValue]);
|
|
75
|
-
(0, _react.useEffect)(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
givingData.moneybuys.map(
|
|
56
|
+
(0, _react.useEffect)(() => {
|
|
57
|
+
const givingData = givingType === 'single' ? singleGiving : regularGiving;
|
|
58
|
+
let moneyBuyNewDescription = otherAmountText;
|
|
59
|
+
givingData.moneybuys.map((moneyBuy, index) => {
|
|
79
60
|
if (moneyBuy.value === amountDonate) {
|
|
80
61
|
moneyBuyNewDescription = moneyBuy.description;
|
|
81
62
|
}
|
|
@@ -92,10 +73,10 @@ var Signup = function Signup(_ref) {
|
|
|
92
73
|
|
|
93
74
|
// Updates our flag that differentiates between the popup
|
|
94
75
|
// being *currently* open and it *ever* having been shown to user
|
|
95
|
-
(0, _react.useEffect)(
|
|
76
|
+
(0, _react.useEffect)(() => {
|
|
96
77
|
if (popOpen && !popUpShown) setPopUpShown(true);
|
|
97
78
|
}, [popOpen, popUpShown]);
|
|
98
|
-
|
|
79
|
+
const submitDonation = (event, amount, clientId, cartId, mbshipId, donateURL) => {
|
|
99
80
|
event.preventDefault();
|
|
100
81
|
if ((0, _Membership.isAmountValid)(amount) && !errorMsg) {
|
|
101
82
|
(0, _Membership.handleDonateSubmission)(amount, clientId, cartId, mbshipId, donateURL, givingType, popUpShown);
|
|
@@ -106,21 +87,21 @@ var Signup = function Signup(_ref) {
|
|
|
106
87
|
};
|
|
107
88
|
|
|
108
89
|
// Update the local state if the prop has been set and changed
|
|
109
|
-
(0, _react.useEffect)(
|
|
90
|
+
(0, _react.useEffect)(() => {
|
|
110
91
|
if (otherAmountValue) {
|
|
111
92
|
setAmountDonate(otherAmountValue);
|
|
112
93
|
}
|
|
113
94
|
}, [otherAmountValue, setAmountDonate]);
|
|
114
95
|
|
|
115
96
|
// Create money buy boxes
|
|
116
|
-
|
|
117
|
-
|
|
97
|
+
const givingData = givingType === 'single' ? singleGiving : regularGiving;
|
|
98
|
+
const showGivingSelector = singleGiving !== null && regularGiving !== null;
|
|
118
99
|
|
|
119
100
|
// Create ref for amount input
|
|
120
|
-
|
|
101
|
+
const amountRef = (0, _react.useRef)(null);
|
|
121
102
|
// Create ref for amount button
|
|
122
|
-
|
|
123
|
-
|
|
103
|
+
const buttonRef = (0, _react.useRef)(null);
|
|
104
|
+
const handleClickOutside = (0, _react.useCallback)(event => {
|
|
124
105
|
if (!errorMsg) {
|
|
125
106
|
return;
|
|
126
107
|
}
|
|
@@ -131,23 +112,23 @@ var Signup = function Signup(_ref) {
|
|
|
131
112
|
// Check the 2nd moneybuy exists before using it;
|
|
132
113
|
// 'philantrophy' carts have been set up to use a single moneybuy.
|
|
133
114
|
// See ENG-1685 for more details
|
|
134
|
-
|
|
115
|
+
const thisAmount = givingData.moneybuys[1] ? givingData.moneybuys[1].value : givingData.moneybuys[0].value;
|
|
135
116
|
setAmountDonate(thisAmount);
|
|
136
117
|
}
|
|
137
118
|
}, [errorMsg, givingData.moneybuys]);
|
|
138
119
|
|
|
139
120
|
// Listen for click outside custom amount input if there is no value entered.
|
|
140
|
-
(0, _react.useEffect)(
|
|
121
|
+
(0, _react.useEffect)(() => {
|
|
141
122
|
// Bind the event listener
|
|
142
123
|
document.addEventListener('mousedown', handleClickOutside);
|
|
143
|
-
return
|
|
124
|
+
return () => {
|
|
144
125
|
// Unbind the event listener on clean up
|
|
145
126
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
146
127
|
};
|
|
147
128
|
}, [errorMsg, handleClickOutside]);
|
|
148
129
|
|
|
149
130
|
// Create function to conditionally render button text
|
|
150
|
-
|
|
131
|
+
const renderButtonText = () => {
|
|
151
132
|
if (errorMsg) {
|
|
152
133
|
return 'Donate';
|
|
153
134
|
}
|
|
@@ -158,31 +139,27 @@ var Signup = function Signup(_ref) {
|
|
|
158
139
|
};
|
|
159
140
|
return /*#__PURE__*/_react.default.createElement(_Donate.FormWrapper, null, showGivingSelector && /*#__PURE__*/_react.default.createElement(_GivingSelector.default, {
|
|
160
141
|
givingType: givingType,
|
|
161
|
-
changeGivingType:
|
|
162
|
-
return setGivingType(data);
|
|
163
|
-
},
|
|
142
|
+
changeGivingType: data => setGivingType(data),
|
|
164
143
|
setPopOpen: setPopOpen,
|
|
165
144
|
mbshipID: mbshipID
|
|
166
145
|
}), popOpen && /*#__PURE__*/_react.default.createElement(_PopUpComponent.default, {
|
|
167
146
|
PopUpText: PopUpText,
|
|
168
147
|
setPopOpen: setPopOpen
|
|
169
148
|
}), /*#__PURE__*/_react.default.createElement(_Donate.Form, {
|
|
170
|
-
onSubmit:
|
|
171
|
-
return submitDonation(e, amountDonate, clientID, cartID, mbshipID, donateLink);
|
|
172
|
-
}
|
|
149
|
+
onSubmit: e => submitDonation(e, amountDonate, clientID, cartID, mbshipID, donateLink)
|
|
173
150
|
}, /*#__PURE__*/_react.default.createElement(_Donate.OuterFieldset, null, /*#__PURE__*/_react.default.createElement(_Donate.Legend, null, /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
174
151
|
tag: "span",
|
|
175
152
|
size: "l",
|
|
176
153
|
weight: "bold"
|
|
177
|
-
}, chooseAmountText || "".concat(noMoneyBuys ? 'Enter' : 'Choose', " an amount to give"))), !noMoneyBuys && /*#__PURE__*/_react.default.createElement(_Donate.MoneyBuys, null, givingData.moneybuys.map(
|
|
178
|
-
|
|
154
|
+
}, chooseAmountText || "".concat(noMoneyBuys ? 'Enter' : 'Choose', " an amount to give"))), !noMoneyBuys && /*#__PURE__*/_react.default.createElement(_Donate.MoneyBuys, null, givingData.moneybuys.map((_ref2, index) => {
|
|
155
|
+
let {
|
|
156
|
+
value
|
|
157
|
+
} = _ref2;
|
|
179
158
|
return /*#__PURE__*/_react.default.createElement(_MoneyBuy.default, {
|
|
180
159
|
isSelected: amountDonate === value,
|
|
181
160
|
amount: value.toString(),
|
|
182
161
|
description: "\xA3".concat((0, _Membership.amountFormatter)(value)),
|
|
183
|
-
setOtherAmount:
|
|
184
|
-
return setAmountDonate(value);
|
|
185
|
-
},
|
|
162
|
+
setOtherAmount: () => setAmountDonate(value),
|
|
186
163
|
key: value,
|
|
187
164
|
name: "".concat(mbshipID, "--moneyBuy").concat(index + 1),
|
|
188
165
|
id: "".concat(mbshipID, "--moneyBuy-box").concat(index + 1)
|
|
@@ -206,9 +183,7 @@ var Signup = function Signup(_ref) {
|
|
|
206
183
|
pattern: "[^[0-9]+([,.][0-9]+)?$]" // this only applies on submit
|
|
207
184
|
,
|
|
208
185
|
placeholder: "0.00",
|
|
209
|
-
onChange:
|
|
210
|
-
return setAmountDonate(e.target.value.trim());
|
|
211
|
-
},
|
|
186
|
+
onChange: e => setAmountDonate(e.target.value.trim()),
|
|
212
187
|
"aria-label": "Input a different amount",
|
|
213
188
|
ref: amountRef
|
|
214
189
|
}))), amountDonate >= 1 && !noMoneyBuys && moneyBuyCopy && /*#__PURE__*/_react.default.createElement(_Donate.Copy, {
|