@paypal/checkout-components 5.0.191 → 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 +6 -0
- package/dist/button.js +1 -1
- package/package.json +1 -1
- package/src/ui/buttons/buttonDesigns/divideLogoAnimation.jsx +0 -5
- package/src/ui/buttons/buttonDesigns/inlineLogoTextDesign.jsx +0 -5
- package/src/zoid/buttons/component.jsx +1 -10
- package/src/zoid/buttons/util.js +2 -56
package/package.json
CHANGED
|
@@ -141,11 +141,6 @@ export function getDivideLogoAnimation(designProps : DivideLogoAnimationProps, c
|
|
|
141
141
|
&& paypalLabelContainerElement.contains(style)
|
|
142
142
|
) {
|
|
143
143
|
paypalLabelContainerElement.removeChild(style);
|
|
144
|
-
} else if (
|
|
145
|
-
(designContainer.offsetWidth <= max || designContainer.offsetWidth >= min)
|
|
146
|
-
&& !paypalLabelContainerElement.contains(style)
|
|
147
|
-
) {
|
|
148
|
-
paypalLabelContainerElement.appendChild(style);
|
|
149
144
|
}
|
|
150
145
|
});
|
|
151
146
|
}
|
|
@@ -90,11 +90,6 @@ export const getInlineLabelTextDesign = function (designProps : InlineLogoTextPr
|
|
|
90
90
|
&& paypalLabelContainerElement.contains(style)
|
|
91
91
|
) {
|
|
92
92
|
paypalLabelContainerElement.removeChild(style);
|
|
93
|
-
} else if (
|
|
94
|
-
(designContainer.offsetWidth <= max || designContainer.offsetWidth >= min)
|
|
95
|
-
&& !paypalLabelContainerElement.contains(style)
|
|
96
|
-
) {
|
|
97
|
-
paypalLabelContainerElement.appendChild(style);
|
|
98
93
|
}
|
|
99
94
|
});
|
|
100
95
|
}
|
|
@@ -20,7 +20,7 @@ import { isFundingEligible } from '../../funding';
|
|
|
20
20
|
import { containerTemplate } from './container';
|
|
21
21
|
import { PrerenderedButtons } from './prerender';
|
|
22
22
|
import { applePaySession, determineFlow, isSupportedNativeBrowser, createVenmoExperiment,
|
|
23
|
-
getVenmoExperiment, createNoPaylaterExperiment, getNoPaylaterExperiment, getRenderedButtons
|
|
23
|
+
getVenmoExperiment, createNoPaylaterExperiment, getNoPaylaterExperiment, getRenderedButtons } from './util';
|
|
24
24
|
|
|
25
25
|
export type ButtonsComponent = ZoidComponent<ButtonProps>;
|
|
26
26
|
|
|
@@ -352,15 +352,6 @@ export const getButtonsComponent : () => ButtonsComponent = memoize(() => {
|
|
|
352
352
|
required: false
|
|
353
353
|
},
|
|
354
354
|
|
|
355
|
-
buttonSize: {
|
|
356
|
-
type: 'string',
|
|
357
|
-
required: false,
|
|
358
|
-
value: ({ props, container }) => {
|
|
359
|
-
return getButtonSize(props, container);
|
|
360
|
-
},
|
|
361
|
-
queryParam: true
|
|
362
|
-
},
|
|
363
|
-
|
|
364
355
|
apiStageHost: {
|
|
365
356
|
type: 'string',
|
|
366
357
|
value: getAPIStageHost,
|
package/src/zoid/buttons/util.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/* @flow */
|
|
2
|
-
import { supportsPopups as userAgentSupportsPopups, isAndroid, isChrome, isIos, isSafari, isSFVC, type Experiment, isDevice, isTablet
|
|
2
|
+
import { supportsPopups as userAgentSupportsPopups, isAndroid, isChrome, isIos, isSafari, isSFVC, type Experiment, isDevice, isTablet } from 'belter/src';
|
|
3
3
|
import { FUNDING } from '@paypal/sdk-constants/src';
|
|
4
4
|
import { getEnableFunding, getDisableFunding, createExperiment, getFundingEligibility, getPlatform, getComponents } from '@paypal/sdk-client/src';
|
|
5
5
|
import { getRefinedFundingEligibility } from '@paypal/funding-components/src';
|
|
6
6
|
|
|
7
7
|
import type { Experiment as EligibilityExperiment } from '../../types';
|
|
8
|
-
import { BUTTON_FLOW
|
|
8
|
+
import { BUTTON_FLOW } from '../../constants';
|
|
9
9
|
import type { ApplePaySessionConfigRequest, CreateBillingAgreement, CreateSubscription, ButtonProps } from '../../ui/buttons/props';
|
|
10
10
|
import { determineEligibleFunding } from '../../funding';
|
|
11
|
-
import { BUTTON_SIZE_STYLE } from '../../ui/buttons/config';
|
|
12
11
|
|
|
13
12
|
type DetermineFlowOptions = {|
|
|
14
13
|
createBillingAgreement : CreateBillingAgreement,
|
|
@@ -223,56 +222,3 @@ export function applePaySession() : ?ApplePaySessionConfigRequest {
|
|
|
223
222
|
return undefined;
|
|
224
223
|
}
|
|
225
224
|
}
|
|
226
|
-
|
|
227
|
-
export function getButtonSize(props : ButtonProps, container : string | HTMLElement | void) : string | void {
|
|
228
|
-
if (!container) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
let containerWidth = 0;
|
|
233
|
-
|
|
234
|
-
if (typeof container === 'string') {
|
|
235
|
-
const containerElement = document.querySelector(container);
|
|
236
|
-
containerWidth = containerElement?.offsetWidth || 0;
|
|
237
|
-
} else {
|
|
238
|
-
containerWidth = getElement(container)?.offsetWidth;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const layout = props?.style?.layout || BUTTON_LAYOUT.HORIZONTAL;
|
|
242
|
-
const numButtonsRendered = props?.renderedButtons?.length || 1;
|
|
243
|
-
const {
|
|
244
|
-
tiny,
|
|
245
|
-
small,
|
|
246
|
-
medium,
|
|
247
|
-
large,
|
|
248
|
-
huge
|
|
249
|
-
} = BUTTON_SIZE_STYLE;
|
|
250
|
-
|
|
251
|
-
if (containerWidth) {
|
|
252
|
-
let buttonWidth = Math.min(containerWidth, 750);
|
|
253
|
-
const spaceBetweenHorizontalButtons = 8;
|
|
254
|
-
if (layout === BUTTON_LAYOUT.HORIZONTAL && numButtonsRendered === 2) {
|
|
255
|
-
buttonWidth = (buttonWidth - spaceBetweenHorizontalButtons) / 2;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if (tiny.minWidth <= buttonWidth && buttonWidth <= tiny.maxWidth) {
|
|
259
|
-
return BUTTON_SIZE.TINY;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (small.minWidth < buttonWidth && buttonWidth <= small.maxWidth) {
|
|
263
|
-
return BUTTON_SIZE.SMALL;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (medium.minWidth < buttonWidth && buttonWidth <= medium.maxWidth) {
|
|
267
|
-
return BUTTON_SIZE.MEDIUM;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if (large.minWidth < buttonWidth && buttonWidth <= large.maxWidth) {
|
|
271
|
-
return BUTTON_SIZE.LARGE;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
if (huge.minWidth < buttonWidth) {
|
|
275
|
-
return BUTTON_SIZE.HUGE;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|