@tap-payments/apple-pay-button 0.0.12-test → 0.0.14-test

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.
@@ -37,4 +37,3 @@ export declare const SupportedNetworks: {
37
37
  readonly Maestro: "maestro";
38
38
  };
39
39
  export declare const ApplePayVersion = 5;
40
- export declare const ApplePaySDK = "https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js";
@@ -37,4 +37,3 @@ export var SupportedNetworks = {
37
37
  Maestro: 'maestro'
38
38
  };
39
39
  export var ApplePayVersion = 5;
40
- export var ApplePaySDK = 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';
@@ -1,7 +1,23 @@
1
- apple-pay-button {
1
+
2
+ .button-applepay-tap {
3
+ -webkit-appearance: -apple-pay-button;
2
4
  display: block;
3
- --apple-pay-button-width: 100%;
4
- --apple-pay-button-height: 48px;
5
- --apple-pay-button-border-radius: 5px;
6
- --apple-pay-button-padding: 0px 0px;
5
+ width: 100%;
6
+ height: 48px;
7
+ min-height: 30px;
8
+ cursor: pointer;
7
9
  }
10
+ .button-applepay-tap:disabled {
11
+ cursor: default;
12
+ }
13
+ .black {
14
+ -apple-pay-button-style: black;
15
+ }
16
+ .white {
17
+ -apple-pay-button-style: white;
18
+ }
19
+ .whiteOutline {
20
+ -apple-pay-button-style: white;
21
+ border: solid 1px gray;
22
+ }
23
+
@@ -2,12 +2,5 @@
2
2
  import { ApplePayButtonProps } from '../../@types';
3
3
  import './ApplePayButton.css';
4
4
  export type { ApplePayButtonProps };
5
- declare global {
6
- namespace JSX {
7
- interface IntrinsicElements {
8
- 'apple-pay-button': unknown;
9
- }
10
- }
11
- }
12
5
  export declare function ApplePayButton(props: ApplePayButtonProps): JSX.Element;
13
6
  export declare const renderApplePayButton: (props: ApplePayButtonProps, elementId: string) => any;
@@ -14,12 +14,10 @@ import * as React from 'react';
14
14
  import { createRoot } from 'react-dom/client';
15
15
  import { findOrCreateElementAndInject } from '../../utils';
16
16
  import { useApplePay } from '../../hooks/useApplePay';
17
- import { ApplePaySDK, ButtonStyle, ButtonType, Locale, Scope } from '../../constants';
17
+ import { ButtonStyle, ButtonType, Locale, Scope } from '../../constants';
18
18
  import './ApplePayButton.css';
19
- import { useScript } from '../../hooks';
20
19
  var ApplePay = React.memo(function (_a) {
21
20
  var publicKey = _a.publicKey, merchant = _a.merchant, transaction = _a.transaction, billingContact = _a.billingContact, supportedNetworks = _a.supportedNetworks, onCancel = _a.onCancel, onError = _a.onError, onSuccess = _a.onSuccess, onClick = _a.onClick, metaData = _a.metaData, _b = _a.scope, scope = _b === void 0 ? Scope.TapToken : _b, _c = _a.buttonStyle, buttonStyle = _c === void 0 ? ButtonStyle.WhiteOutline : _c, _d = _a.type, type = _d === void 0 ? ButtonType.PLAIN : _d, _e = _a.locale, locale = _e === void 0 ? Locale.EN : _e;
22
- useScript(ApplePaySDK);
23
21
  var _f = useApplePay({
24
22
  publicKey: publicKey,
25
23
  merchant: merchant,
@@ -32,10 +30,19 @@ var ApplePay = React.memo(function (_a) {
32
30
  scope: scope,
33
31
  metaData: metaData
34
32
  }), loading = _f.loading, onApplePayButtonClicked = _f.onApplePayButtonClicked, disabled = _f.disabled;
35
- return (_jsx("apple-pay-button", { onClick: function () {
33
+ var ref = React.useRef();
34
+ React.useEffect(function () {
35
+ var _a;
36
+ if (ref.current) {
37
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.click();
38
+ }
39
+ });
40
+ return (_jsx("button", { className: "button-applepay-tap ".concat(buttonStyle), style: {
41
+ '-apple-pay-button-type': type
42
+ }, onClick: function () {
36
43
  onApplePayButtonClicked();
37
44
  onClick === null || onClick === void 0 ? void 0 : onClick();
38
- }, disabled: loading || disabled, buttonstyle: buttonStyle, type: type, locale: locale }));
45
+ }, lang: locale, disabled: loading || disabled }));
39
46
  });
40
47
  export function ApplePayButton(props) {
41
48
  return _jsx(ApplePay, __assign({}, props));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/apple-pay-button",
3
- "version": "0.0.12-test",
3
+ "version": "0.0.14-test",
4
4
  "description": "Apple Pay Button React Component",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",