@tapcart/mobile-components 0.7.63 → 0.7.64

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.
@@ -25,12 +25,13 @@ export interface ApplePayButtonProps extends React.ButtonHTMLAttributes<HTMLButt
25
25
  boxSizing?: string | undefined;
26
26
  };
27
27
  onPaymentAuthorized?: (paymentData: ApplePayJS.ApplePayPayment) => Promise<boolean>;
28
+ onPaymentMethodSelected?: (paymentMethod: ApplePayJS.ApplePayPaymentMethod) => Promise<ApplePayJS.ApplePayPaymentMethodUpdate>;
28
29
  onShippingContactSelected?: (shippingContact: ApplePayJS.ApplePayPaymentContact) => Promise<ApplePayJS.ApplePayShippingMethodUpdate>;
29
30
  onShippingMethodSelected?: (shippingMethod: ApplePayJS.ApplePayShippingMethod) => Promise<ApplePayJS.ApplePayShippingMethodUpdate>;
30
31
  onPaymentCancelled?: (event?: ApplePayJS.Event) => void;
31
32
  }
32
33
  declare const ApplePayButton: {
33
- ({ displayName, amount, requiredBillingContactFields, requiredShippingContactFields, startSessionURL, startSessionCacheBypass, appId, domainName, countryCode, currencyCode, merchantCapabilities, supportedNetworks, buttonType, buttonStyle, applePayButtonStyle, onPaymentAuthorized, onShippingContactSelected, onShippingMethodSelected, onPaymentCancelled, }: ApplePayButtonProps): import("react/jsx-runtime").JSX.Element;
34
+ ({ displayName, amount, requiredBillingContactFields, requiredShippingContactFields, startSessionURL, startSessionCacheBypass, appId, domainName, countryCode, currencyCode, merchantCapabilities, supportedNetworks, buttonType, buttonStyle, applePayButtonStyle, onPaymentAuthorized, onPaymentMethodSelected, onShippingContactSelected, onShippingMethodSelected, onPaymentCancelled, }: ApplePayButtonProps): import("react/jsx-runtime").JSX.Element;
34
35
  displayName: string;
35
36
  };
36
37
  export { ApplePayButton };
@@ -1 +1 @@
1
- {"version":3,"file":"apple-pay-button.d.ts","sourceRoot":"","sources":["../../../components/ui/apple-pay-button.tsx"],"names":[],"mappings":";AAEA,OAAO,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AO,EAAE,cAAc,EAAE,CAAA"}
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  import ApplePayButtonComponent from "apple-pay-button";
13
- const ApplePayButton = ({ displayName, amount, requiredBillingContactFields = ["name", "postalAddress", "phone", "email"], requiredShippingContactFields = ["name", "postalAddress", "phone", "email"], startSessionURL, startSessionCacheBypass = false, appId, domainName, countryCode = "US", currencyCode = "USD", merchantCapabilities = ["supports3DS"], supportedNetworks = ["visa", "masterCard", "amex", "discover"], buttonType = "plain", buttonStyle = "white-outline", applePayButtonStyle, onPaymentAuthorized, onShippingContactSelected, onShippingMethodSelected, onPaymentCancelled, }) => {
13
+ const ApplePayButton = ({ displayName, amount, requiredBillingContactFields = ["name", "postalAddress", "phone", "email"], requiredShippingContactFields = ["name", "postalAddress", "phone", "email"], startSessionURL, startSessionCacheBypass = false, appId, domainName, countryCode = "US", currencyCode = "USD", merchantCapabilities = ["supports3DS"], supportedNetworks = ["visa", "masterCard", "amex", "discover"], buttonType = "plain", buttonStyle = "white-outline", applePayButtonStyle, onPaymentAuthorized, onPaymentMethodSelected, onShippingContactSelected, onShippingMethodSelected, onPaymentCancelled, }) => {
14
14
  const onClick = () => {
15
15
  const applePayRequest = {
16
16
  countryCode,
@@ -59,16 +59,20 @@ const ApplePayButton = ({ displayName, amount, requiredBillingContactFields = ["
59
59
  console.error("Error during validating merchant");
60
60
  }
61
61
  });
62
- session.onpaymentmethodselected = (event) => {
63
- const update = {
62
+ session.onpaymentmethodselected = (event) => __awaiter(void 0, void 0, void 0, function* () {
63
+ const paymentMethod = event.paymentMethod;
64
+ let update = {
64
65
  newTotal: {
65
66
  label: displayName,
66
67
  type: "final",
67
68
  amount: amount.toString(),
68
69
  },
69
70
  };
71
+ if (onPaymentMethodSelected) {
72
+ update = yield onPaymentMethodSelected(paymentMethod);
73
+ }
70
74
  session.completePaymentMethodSelection(update);
71
- };
75
+ });
72
76
  session.onshippingmethodselected = (event) => __awaiter(void 0, void 0, void 0, function* () {
73
77
  const shippingMethod = event.shippingMethod;
74
78
  let update = {
@@ -1 +1 @@
1
- {"version":3,"file":"tap.d.ts","sourceRoot":"","sources":["../../../components/ui/tap.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAMZ,SAAS,EACV,MAAM,OAAO,CAAA;AAyFd,QAAA,MAAM,MAAM;6BAyBU,GAAG,KAAK,IAAI,aACb,GAAG;;;CAmBvB,CAAA;AAED,UAAU,QAAQ;IAChB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,QAAA,MAAM,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAuC3B,CAAA;AAED,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA"}
1
+ {"version":3,"file":"tap.d.ts","sourceRoot":"","sources":["../../../components/ui/tap.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAMZ,SAAS,EACV,MAAM,OAAO,CAAA;AAyFd,QAAA,MAAM,MAAM;6BAyBU,GAAG,KAAK,IAAI,aACb,GAAG;;;CA2BvB,CAAA;AAED,UAAU,QAAQ;IAChB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,QAAA,MAAM,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAuC3B,CAAA;AAED,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA"}
@@ -92,11 +92,21 @@ const useTap = (tapThreshold = 10) => {
92
92
  return;
93
93
  if (event.type === "touchend" && !data.touchMoved) {
94
94
  handler(event);
95
- (_a = webbridgeActions.action) === null || _a === void 0 ? void 0 : _a.call(webbridgeActions, "trigger/haptic");
95
+ try {
96
+ (_a = webbridgeActions.action) === null || _a === void 0 ? void 0 : _a.call(webbridgeActions, "trigger/haptic");
97
+ }
98
+ catch (e) {
99
+ console.error(e);
100
+ }
96
101
  }
97
102
  else if (event.type === "click" && !data.touchStarted) {
98
103
  handler(event);
99
- (_b = webbridgeActions.action) === null || _b === void 0 ? void 0 : _b.call(webbridgeActions, "trigger/haptic");
104
+ try {
105
+ (_b = webbridgeActions.action) === null || _b === void 0 ? void 0 : _b.call(webbridgeActions, "trigger/haptic");
106
+ }
107
+ catch (e) {
108
+ console.error(e);
109
+ }
100
110
  setIsPressed(true);
101
111
  setTimeout(() => setIsPressed(false), 100);
102
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.7.63",
3
+ "version": "0.7.64",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",
@@ -57,7 +57,7 @@
57
57
  "@radix-ui/react-toggle": "^1.0.3",
58
58
  "@radix-ui/react-toggle-group": "^1.0.4",
59
59
  "@tabler/icons-react": "^3.2.0",
60
- "@tapcart/webbridge-react": "^1.14.2",
60
+ "@tapcart/webbridge-react": "^1.15.0",
61
61
  "apple-pay-button": "^1.1.7",
62
62
  "class-variance-authority": "^0.6.0",
63
63
  "clsx": "^1.2.1",