@paypal/checkout-components 5.0.248 → 5.0.249

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paypal/checkout-components",
3
- "version": "5.0.248",
3
+ "version": "5.0.249",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,7 +26,8 @@
26
26
  "reinstall": "rimraf flow-typed && rimraf node_modules && npm install && flow-typed install",
27
27
  "release": "./scripts/publish.sh",
28
28
  "start": "npm run webpack -- --progress --watch",
29
- "test": "npm run jest-ssr && npm run karma && npm run jest-screenshot",
29
+ "test": "npm run test:unit && npm run jest-ssr && npm run karma && npm run jest-screenshot",
30
+ "test:unit": "vitest",
30
31
  "typecheck": "npm run flow-typed && npm run flow",
31
32
  "version": "./scripts/version.sh",
32
33
  "webpack": "babel-node $(npm bin)/webpack",
@@ -62,6 +63,7 @@
62
63
  "license": "Apache-2.0",
63
64
  "readmeFilename": "README.md",
64
65
  "devDependencies": {
66
+ "@bunchtogether/vite-plugin-flow": "^1.0.2",
65
67
  "@krakenjs/grumbler-scripts": "^8.0.7",
66
68
  "@krakenjs/sync-browser-mocks": "^3.0.0",
67
69
  "babel-core": "^7.0.0-bridge.0",
@@ -86,7 +88,9 @@
86
88
  "prettier": "^2.5.1",
87
89
  "prettier-plugin-sh": "^0.10.0",
88
90
  "puppeteer": "^1.20.0",
89
- "serve": "^13.0.0"
91
+ "serve": "^13.0.0",
92
+ "vite": "^3.2.4",
93
+ "vitest": "^0.25.3"
90
94
  },
91
95
  "dependencies": {
92
96
  "@krakenjs/belter": "^2.0.0",
@@ -0,0 +1,40 @@
1
+ /* @flow */
2
+
3
+ import { ZalgoPromise } from '@krakenjs/zalgo-promise/src';
4
+
5
+ import { ValidationError } from "../../lib"
6
+
7
+ type SaveActionConfig = {|
8
+ createVaultSetupToken: () => ZalgoPromise<string>,
9
+ onApprove: ({| vaultSetupToken: string |}) => void,
10
+ |};
11
+
12
+ export type CreateSaveAction = (config: SaveActionConfig) => {|type: 'SAVE', ... SaveActionConfig|}
13
+
14
+ /**
15
+ * These are the input configurations required from the merchant.
16
+ */
17
+ const REQUIRED_INPUTS = {
18
+ onApprove: 'function',
19
+ createVaultSetupToken: 'function'
20
+ }
21
+
22
+ const validateSaveConfig = (config: SaveActionConfig): void => {
23
+ for (const [inputProp, inputType] of Object.entries(REQUIRED_INPUTS)) {
24
+ if (!config[inputProp] || typeof config[inputProp] !== inputType) {
25
+ throw new ValidationError(`Save action is missing the required '${inputProp}' callback`)
26
+ }
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Creating a Save action allows us to validate initial inputs from the merchant, and then return the resulting object.
32
+ */
33
+ export const createSaveAction: CreateSaveAction = (config) => {
34
+ validateSaveConfig(config)
35
+
36
+ return {
37
+ type: "SAVE",
38
+ ...config,
39
+ }
40
+ };
@@ -291,7 +291,7 @@ function ShowInstrumentsOnFile(opts) : ?ChildType {
291
291
  )
292
292
  : (
293
293
  <div class='fi-container'>
294
- <div class='fi-logo' optional={ 1 }>
294
+ <div class='fi-logo'>
295
295
  {
296
296
  (instrument && logo)
297
297
  ? logo
@@ -0,0 +1,21 @@
1
+ /* @flow */
2
+
3
+ import { isPayPalDomain } from "@paypal/sdk-client/src";
4
+
5
+ import type { LazyProtectedExport } from "../types";
6
+ import { createSaveAction, type CreateSaveAction } from "../actions/save";
7
+
8
+ function protectedExport<T>(xport: T): ?T {
9
+ if (isPayPalDomain()) {
10
+ return xport;
11
+ }
12
+ }
13
+
14
+ export const actions: LazyProtectedExport<{|
15
+ Save: CreateSaveAction,
16
+ |}> = {
17
+ __get__: () =>
18
+ protectedExport({
19
+ Save: createSaveAction,
20
+ }),
21
+ };
@@ -126,10 +126,7 @@ export const buttonStyle = `
126
126
  margin-top: 10px;
127
127
  }
128
128
 
129
- @media only screen and (max-width: ${ MIN_VAULT_BUTTON_WIDTH }px) {
130
- .menu-button {
131
- display: none;
132
- }
129
+ @media only screen and (max-width: ${ MIN_VAULT_BUTTON_WIDTH - 1 }px) {
133
130
  .${ CLASS.CONTAINER } .${ CLASS.BUTTON_ROW }.${ CLASS.WALLET }.${ CLASS.WALLET_MENU } .${ CLASS.BUTTON } {
134
131
  border-top-right-radius: 4px;
135
132
  border-bottom-right-radius: 4px;