@paypal/checkout-components 5.0.189 → 5.0.192
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/CHANGELOG.md +18 -0
- package/__sdk__.js +1 -0
- package/dist/button.js +1 -1
- package/package.json +3 -3
- package/src/constants/button.js +5 -0
- package/src/funding/common.jsx +2 -2
- package/src/funding/config.js +3 -1
- package/src/funding/multiblanco/config.jsx +21 -0
- package/src/funding/multiblanco/index.js +4 -0
- package/src/funding/paylater/config.jsx +22 -2
- package/src/funding/paypal/template.jsx +12 -15
- package/src/lib/errors.js +6 -6
- package/src/marks/template.jsx +8 -8
- package/src/ui/buttons/button.jsx +11 -11
- package/src/ui/buttons/buttonDesigns/control.jsx +9 -0
- package/src/ui/buttons/buttonDesigns/divideLogoAnimation.jsx +174 -0
- package/src/ui/buttons/buttonDesigns/index.js +92 -0
- package/src/ui/buttons/buttonDesigns/inlineLogoTextDesign.jsx +123 -0
- package/src/ui/buttons/buttonDesigns/script.jsx +35 -0
- package/src/ui/buttons/buttonDesigns/types.js +13 -0
- package/src/ui/buttons/buttons.jsx +18 -18
- package/src/ui/buttons/props.js +6 -4
- package/src/ui/buttons/styles/responsive.js +7 -4
- package/src/zoid/buttons/container.jsx +3 -3
- package/src/zoid/buttons/util.js +1 -0
- package/src/zoid/card-fields/component.jsx +7 -3
- package/src/zoid/payment-fields/prerender.jsx +1 -24
- package/src/ui/buttons/button-animations/divide-logo-animation.jsx +0 -175
- package/src/ui/buttons/button-animations/index.js +0 -38
- package/src/ui/buttons/button-animations/label-text-next-to-logo-animation.jsx +0 -106
- package/src/ui/buttons/button-animations/script.jsx +0 -24
- package/src/ui/buttons/button-animations/types.js +0 -41
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
/** @jsx node */
|
|
3
|
-
import { LOGO_CLASS } from '@paypal/sdk-logos/src';
|
|
4
|
-
import { node, Fragment, type ChildType, type ElementNode } from 'jsx-pragmatic/src';
|
|
5
|
-
|
|
6
|
-
import { BUTTON_SIZE_STYLE } from '../config';
|
|
7
|
-
import { CLASS } from '../../../constants';
|
|
8
|
-
|
|
9
|
-
import type { ButtonAnimationOutputParams, LabelOptions } from './types';
|
|
10
|
-
|
|
11
|
-
export const ANIMATION = {
|
|
12
|
-
ELEMENT: ('label-next-to-logo-animation-element' : 'label-next-to-logo-animation-element'),
|
|
13
|
-
CONTAINER: ('label-next-to-logo-animation' : 'label-next-to-logo-animation')
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
function ComponentForAnimation({ animationLabelText } : LabelOptions) : ChildType {
|
|
17
|
-
return (
|
|
18
|
-
<Fragment>
|
|
19
|
-
<span data-animation-experiment="Varied_Button_Design" class={ ANIMATION.ELEMENT }>{animationLabelText}</span>
|
|
20
|
-
<style innerHTML={ `
|
|
21
|
-
.${ CLASS.DOM_READY } .${ ANIMATION.CONTAINER } img.${ LOGO_CLASS.LOGO }{
|
|
22
|
-
position: relative;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.${ ANIMATION.CONTAINER } .${ ANIMATION.ELEMENT } {
|
|
26
|
-
position: absolute;
|
|
27
|
-
opacity: 0;
|
|
28
|
-
color: #142C8E;
|
|
29
|
-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
30
|
-
font-size: 14px;
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
justify-content: space-around;
|
|
34
|
-
}
|
|
35
|
-
` } />;
|
|
36
|
-
</Fragment>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const getValidLabelContainer = function (document, configuration) : ElementNode | null {
|
|
41
|
-
const { ANIMATION_CONTAINER, PAYPAL_LABEL_CONTAINER } = configuration.cssStyles;
|
|
42
|
-
const { large, huge } = configuration;
|
|
43
|
-
|
|
44
|
-
// get the animation main container to force specificity( in css ) and make sure we are running the right animation
|
|
45
|
-
const animationContainer = (document && document.querySelector(`.${ ANIMATION_CONTAINER }`)) || null;
|
|
46
|
-
// get the label container element having into account the animation container to force specificity in css
|
|
47
|
-
const paypalLabelContainerElement = (animationContainer && animationContainer.querySelector(`.${ PAYPAL_LABEL_CONTAINER }`)) || null;
|
|
48
|
-
if (!animationContainer) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const animationContainerWidth = animationContainer.offsetWidth;
|
|
53
|
-
// only support large and extra large button sizes
|
|
54
|
-
if (animationContainerWidth < large.min || animationContainerWidth > huge.max) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
return paypalLabelContainerElement;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const createAnimation = function (animationContainerElement, cssClasses) : void {
|
|
61
|
-
const { ANIMATION_CONTAINER, DOM_READY, PAYPAL_LOGO, ANIMATION_ELEMENT } = cssClasses;
|
|
62
|
-
const animations = `
|
|
63
|
-
.${ DOM_READY } .${ ANIMATION_CONTAINER } img.${ PAYPAL_LOGO }{
|
|
64
|
-
position: fixed;
|
|
65
|
-
left: 0%;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.${ ANIMATION_CONTAINER } .${ ANIMATION_ELEMENT } {
|
|
69
|
-
position: fixed;
|
|
70
|
-
opacity: 1;
|
|
71
|
-
right:0%;
|
|
72
|
-
}
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
const style = document.createElement('style');
|
|
76
|
-
animationContainerElement.appendChild(style);
|
|
77
|
-
style.appendChild(document.createTextNode(animations));
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
export function setupLabelTextNextToLogoAnimation (animationLabelText : string) : ButtonAnimationOutputParams {
|
|
82
|
-
const animationProps = { animationLabelText };
|
|
83
|
-
const animationConfig = {
|
|
84
|
-
cssStyles: {
|
|
85
|
-
ANIMATION_CONTAINER: ANIMATION.CONTAINER,
|
|
86
|
-
ANIMATION_ELEMENT: ANIMATION.ELEMENT,
|
|
87
|
-
PAYPAL_LABEL_CONTAINER: CLASS.BUTTON_LABEL,
|
|
88
|
-
PAYPAL_LOGO: LOGO_CLASS.LOGO,
|
|
89
|
-
DOM_READY: CLASS.DOM_READY
|
|
90
|
-
},
|
|
91
|
-
large: { min: BUTTON_SIZE_STYLE.large.minWidth, max: BUTTON_SIZE_STYLE.large.maxWidth },
|
|
92
|
-
huge: { max: BUTTON_SIZE_STYLE.huge.maxWidth }
|
|
93
|
-
};
|
|
94
|
-
const buttonAnimationScript = `
|
|
95
|
-
const animationContainerElement = ${ getValidLabelContainer.toString() }( document, ${ JSON.stringify(animationConfig) })
|
|
96
|
-
if (animationContainerElement) {
|
|
97
|
-
const animation = ${ createAnimation.toString() }
|
|
98
|
-
animation(animationContainerElement, ${ JSON.stringify(animationConfig.cssStyles) })
|
|
99
|
-
}
|
|
100
|
-
`;
|
|
101
|
-
return {
|
|
102
|
-
buttonAnimationContainerClass: ANIMATION.CONTAINER,
|
|
103
|
-
buttonAnimationScript,
|
|
104
|
-
buttonAnimationComponent: (<ComponentForAnimation { ...animationProps } />)
|
|
105
|
-
};
|
|
106
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
/** @jsx node */
|
|
3
|
-
|
|
4
|
-
import { node, type ElementNode } from 'jsx-pragmatic/src';
|
|
5
|
-
|
|
6
|
-
import { getComponentScript } from '../script';
|
|
7
|
-
|
|
8
|
-
type ScriptProps = {|
|
|
9
|
-
nonce : ?string,
|
|
10
|
-
buttonAnimation : string
|
|
11
|
-
|};
|
|
12
|
-
|
|
13
|
-
export function ButtonAnimationExperimentScriptWrapper({ nonce, buttonAnimation } : ScriptProps) : ElementNode {
|
|
14
|
-
|
|
15
|
-
const scripts = `
|
|
16
|
-
const scriptFns = ${ getComponentScript().toString() };
|
|
17
|
-
scriptFns();
|
|
18
|
-
function onDomLoad(){ ${ buttonAnimation } };
|
|
19
|
-
document.addEventListener('DOMContentLoaded', onDomLoad);
|
|
20
|
-
`;
|
|
21
|
-
return (
|
|
22
|
-
<script nonce={ nonce } innerHTML={ `(function(){ ${ scripts }})()` } />
|
|
23
|
-
);
|
|
24
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
import { type ChildType, type ElementNode } from 'jsx-pragmatic/src';
|
|
3
|
-
|
|
4
|
-
export type ButtonAnimationOutputParams ={|
|
|
5
|
-
buttonAnimationContainerClass : string,
|
|
6
|
-
buttonAnimationScript : string,
|
|
7
|
-
buttonAnimationComponent : ChildType | null
|
|
8
|
-
|};
|
|
9
|
-
|
|
10
|
-
export type ButtonSizeProperties = {|
|
|
11
|
-
min? : number,
|
|
12
|
-
max? : number
|
|
13
|
-
|};
|
|
14
|
-
|
|
15
|
-
type ButtonAnimationCss = {|
|
|
16
|
-
DOM_READY : string,
|
|
17
|
-
ANIMATION_CONTAINER : string,
|
|
18
|
-
PAYPAL_LOGO : string,
|
|
19
|
-
ANIMATION_LABEL_CONTAINER : string,
|
|
20
|
-
PAYPAL_BUTTON_LABEL : string
|
|
21
|
-
|};
|
|
22
|
-
|
|
23
|
-
export type ButtonSizes = {|
|
|
24
|
-
large : ButtonSizeProperties,
|
|
25
|
-
huge : ButtonSizeProperties,
|
|
26
|
-
cssClasses : ButtonAnimationCss
|
|
27
|
-
|};
|
|
28
|
-
|
|
29
|
-
export type ButtonAnimation = {|
|
|
30
|
-
params : ButtonSizes,
|
|
31
|
-
fn : Function
|
|
32
|
-
|};
|
|
33
|
-
|
|
34
|
-
export type LabelOptions = {|
|
|
35
|
-
animationLabelText : string
|
|
36
|
-
|};
|
|
37
|
-
|
|
38
|
-
export type DivideLogoAnimationProps = {|
|
|
39
|
-
paypalLabelContainerElement : ElementNode,
|
|
40
|
-
paypalLogoStartingLeftPosition : string
|
|
41
|
-
|};
|