@tagadapay/plugin-sdk 2.6.8 → 2.6.10
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/dist/react/components/DebugDrawer.js +3 -3
- package/dist/react/components/GooglePayButton.js +3 -2
- package/dist/react/hooks/useApplePay.js +1 -1
- package/dist/v2/core/resources/storeConfig.d.ts +40 -6
- package/dist/v2/react/components/DebugDrawer.js +3 -3
- package/dist/v2/react/components/GooglePayButton.js +3 -2
- package/package.json +2 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import { useTagadaContext } from '../providers/TagadaProvider';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
5
4
|
import { usePluginConfig } from '../hooks/usePluginConfig';
|
|
5
|
+
import { useTagadaContext } from '../providers/TagadaProvider';
|
|
6
6
|
const safeStringify = (value) => {
|
|
7
7
|
if (value === null)
|
|
8
8
|
return 'null';
|
|
@@ -163,7 +163,7 @@ export const DebugDrawer = ({ isOpen, onClose }) => {
|
|
|
163
163
|
backgroundColor: pluginConfig.config.branding.primaryColor,
|
|
164
164
|
border: '1px solid #374151',
|
|
165
165
|
borderRadius: '3px',
|
|
166
|
-
} }), _jsx("span", { style: { color: '#10b981' }, children: pluginConfig.config.branding.primaryColor })] })] }))] })] }), _jsxs("div", { style: { marginBottom: '16px' }, children: [_jsx("h4", { style: { margin: '0 0 12px 0', color: '#9ca3af', fontSize: '14px' }, children: "Full Configuration" }), _jsx(TreeView, { data: pluginConfig, name: "pluginConfig" })] }), process.env
|
|
166
|
+
} }), _jsx("span", { style: { color: '#10b981' }, children: pluginConfig.config.branding.primaryColor })] })] }))] })] }), _jsxs("div", { style: { marginBottom: '16px' }, children: [_jsx("h4", { style: { margin: '0 0 12px 0', color: '#9ca3af', fontSize: '14px' }, children: "Full Configuration" }), _jsx(TreeView, { data: pluginConfig, name: "pluginConfig" })] }), typeof process !== 'undefined' && process.env?.NODE_ENV === 'development' && (_jsxs("div", { style: {
|
|
167
167
|
padding: '12px',
|
|
168
168
|
backgroundColor: '#1f2937',
|
|
169
169
|
border: '1px solid #374151',
|
|
@@ -6,8 +6,9 @@ import { useOrderSummary } from '../hooks/useOrderSummary';
|
|
|
6
6
|
import { usePayment } from '../hooks/usePayment';
|
|
7
7
|
import { useShippingRates } from '../hooks/useShippingRates';
|
|
8
8
|
import { Button } from './Button';
|
|
9
|
-
const basistheoryPublicKey = process.env
|
|
10
|
-
const basistheoryTenantId = process.env
|
|
9
|
+
const basistheoryPublicKey = (typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_BASIS_THEORY_PUBLIC_API_KEY) || '';
|
|
10
|
+
const basistheoryTenantId = (typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_BASIS_THEORY_TENANT_ID) ||
|
|
11
|
+
'0b283fa3-44a1-4535-adff-e99ad0a58a47';
|
|
11
12
|
export const GooglePayButton = ({ className = '', disabled = false, onSuccess, onError, onCancel, checkout, }) => {
|
|
12
13
|
const { googlePayPaymentMethod, reComputeOrderSummary, handleAddExpressId, updateCheckoutSessionValues, updateCustomerEmail, shippingMethods, setError: setContextError, } = useExpressPaymentMethods();
|
|
13
14
|
const [processingPayment, setProcessingPayment] = useState(false);
|
|
@@ -21,7 +21,7 @@ export function useApplePay(options = {}) {
|
|
|
21
21
|
const hasApplePaySession = !!window.ApplePaySession;
|
|
22
22
|
if (!hasApplePaySession) {
|
|
23
23
|
// In development, simulate Apple Pay availability for UI testing
|
|
24
|
-
const isDevelopment = process.env
|
|
24
|
+
const isDevelopment = (typeof process !== 'undefined' && process.env?.NODE_ENV === 'development') ||
|
|
25
25
|
window.location.hostname === 'localhost' ||
|
|
26
26
|
window.location.hostname.includes('127.0.0.1');
|
|
27
27
|
if (isDevelopment) {
|
|
@@ -4,12 +4,46 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ApiClient } from './apiClient';
|
|
6
6
|
export interface StoreConfig {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
badges?: {
|
|
8
|
+
url: string;
|
|
9
|
+
title: string;
|
|
10
|
+
}[];
|
|
11
|
+
colors?: {
|
|
12
|
+
primary?: string;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
};
|
|
15
|
+
sections?: {
|
|
16
|
+
id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
iconUrl?: string;
|
|
19
|
+
titleTrans?: {
|
|
20
|
+
[lang: string]: string;
|
|
21
|
+
};
|
|
22
|
+
descriptionTrans?: {
|
|
23
|
+
[lang: string]: string;
|
|
24
|
+
};
|
|
25
|
+
}[];
|
|
26
|
+
checkoutType?: string;
|
|
27
|
+
requirePhone?: boolean;
|
|
28
|
+
requireTerms?: boolean;
|
|
29
|
+
scarcityTimer?: {
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
messageTrans?: {
|
|
32
|
+
[lang: string]: string;
|
|
33
|
+
};
|
|
34
|
+
duration?: number;
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
};
|
|
37
|
+
showPoweredBy?: boolean;
|
|
38
|
+
precheckMarketing?: boolean;
|
|
39
|
+
privacyPolicyLink?: string;
|
|
40
|
+
requireAddressNumber?: boolean;
|
|
41
|
+
generalConditionsLink?: string;
|
|
42
|
+
computed?: {
|
|
43
|
+
availableShippingCountries?: string[];
|
|
44
|
+
threedsEnabled?: boolean;
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
};
|
|
13
47
|
[key: string]: any;
|
|
14
48
|
}
|
|
15
49
|
export interface GetStoreConfigOptions {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import { useTagadaContext } from '../providers/TagadaProvider';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
5
4
|
import { usePluginConfig } from '../hooks/usePluginConfig';
|
|
5
|
+
import { useTagadaContext } from '../providers/TagadaProvider';
|
|
6
6
|
const safeStringify = (value) => {
|
|
7
7
|
if (value === null)
|
|
8
8
|
return 'null';
|
|
@@ -163,7 +163,7 @@ export const DebugDrawer = ({ isOpen, onClose }) => {
|
|
|
163
163
|
backgroundColor: pluginConfig.config.branding.primaryColor,
|
|
164
164
|
border: '1px solid #374151',
|
|
165
165
|
borderRadius: '3px',
|
|
166
|
-
} }), _jsx("span", { style: { color: '#10b981' }, children: pluginConfig.config.branding.primaryColor })] })] }))] })] }), _jsxs("div", { style: { marginBottom: '16px' }, children: [_jsx("h4", { style: { margin: '0 0 12px 0', color: '#9ca3af', fontSize: '14px' }, children: "Full Configuration" }), _jsx(TreeView, { data: pluginConfig, name: "pluginConfig" })] }), process.env
|
|
166
|
+
} }), _jsx("span", { style: { color: '#10b981' }, children: pluginConfig.config.branding.primaryColor })] })] }))] })] }), _jsxs("div", { style: { marginBottom: '16px' }, children: [_jsx("h4", { style: { margin: '0 0 12px 0', color: '#9ca3af', fontSize: '14px' }, children: "Full Configuration" }), _jsx(TreeView, { data: pluginConfig, name: "pluginConfig" })] }), typeof process !== 'undefined' && process.env?.NODE_ENV === 'development' && (_jsxs("div", { style: {
|
|
167
167
|
padding: '12px',
|
|
168
168
|
backgroundColor: '#1f2937',
|
|
169
169
|
border: '1px solid #374151',
|
|
@@ -6,8 +6,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import GooglePayButtonReact from '@google-pay/button-react';
|
|
7
7
|
import { useCallback, useEffect, useState } from 'react';
|
|
8
8
|
import { useExpressPaymentMethods } from '../hooks/useExpressPaymentMethods';
|
|
9
|
-
const basistheoryPublicKey = process.env
|
|
10
|
-
const basistheoryTenantId = process.env
|
|
9
|
+
const basistheoryPublicKey = (typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_BASIS_THEORY_PUBLIC_API_KEY) || '';
|
|
10
|
+
const basistheoryTenantId = (typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_BASIS_THEORY_TENANT_ID) ||
|
|
11
|
+
'0b283fa3-44a1-4535-adff-e99ad0a58a47';
|
|
11
12
|
export const GooglePayButton = ({ className = '', disabled = false, onSuccess, onError, onCancel, checkout, size = 'lg', buttonColor = 'black', buttonType = 'plain', }) => {
|
|
12
13
|
const { googlePayPaymentMethod, shippingMethods, lineItems, handleAddExpressId, updateCheckoutSessionValues, updateCustomerEmail, reComputeOrderSummary, setError: setContextError, } = useExpressPaymentMethods();
|
|
13
14
|
const [processingPayment, setProcessingPayment] = useState(false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tagadapay/plugin-sdk",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.10",
|
|
4
4
|
"description": "Modern React SDK for building Tagada Pay plugins",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"@basis-theory/basis-theory-js": "^4.30.0",
|
|
60
60
|
"@basis-theory/basis-theory-react": "^1.32.5",
|
|
61
61
|
"@basis-theory/web-threeds": "^1.0.1",
|
|
62
|
+
"@google-pay/button-react": "^3.0.10",
|
|
62
63
|
"@tanstack/react-query": "^5.90.2",
|
|
63
64
|
"axios": "^1.10.0",
|
|
64
65
|
"iso3166-2-db": "^2.3.11",
|