@tagadapay/plugin-sdk 3.1.25 → 4.0.0
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/README.md +1129 -1129
- package/build-cdn.js +499 -499
- package/dist/external-tracker.js +5 -5
- package/dist/external-tracker.min.js +2 -2
- package/dist/external-tracker.min.js.map +2 -2
- package/dist/react/config/payment.d.ts +2 -2
- package/dist/react/config/payment.js +5 -5
- package/dist/react/hooks/usePayment.d.ts +7 -0
- package/dist/react/hooks/usePayment.js +1 -0
- package/dist/react/providers/TagadaProvider.js +5 -5
- package/dist/tagada-react-sdk-minimal.min.js +2 -2
- package/dist/tagada-react-sdk-minimal.min.js.map +4 -4
- package/dist/tagada-react-sdk.js +1616 -1275
- package/dist/tagada-react-sdk.min.js +2 -2
- package/dist/tagada-react-sdk.min.js.map +4 -4
- package/dist/tagada-sdk.js +869 -27
- package/dist/tagada-sdk.min.js +2 -2
- package/dist/tagada-sdk.min.js.map +4 -4
- package/dist/v2/core/config/environment.d.ts +3 -3
- package/dist/v2/core/config/environment.js +7 -7
- package/dist/v2/core/funnelClient.d.ts +2 -0
- package/dist/v2/core/resources/funnel.d.ts +1 -1
- package/dist/v2/core/resources/geo.d.ts +50 -0
- package/dist/v2/core/resources/geo.js +35 -0
- package/dist/v2/core/resources/payments.d.ts +19 -1
- package/dist/v2/core/resources/payments.js +8 -0
- package/dist/v2/core/utils/previewModeIndicator.js +101 -101
- package/dist/v2/react/components/FunnelScriptInjector.js +167 -19
- package/dist/v2/react/components/StripeExpressButton.d.ts +8 -0
- package/dist/v2/react/components/StripeExpressButton.js +22 -1
- package/dist/v2/react/hooks/payment-actions/useNgeniusThreedsAction.d.ts +15 -0
- package/dist/v2/react/hooks/payment-actions/useNgeniusThreedsAction.js +166 -0
- package/dist/v2/react/hooks/payment-actions/usePaymentActionHandler.js +12 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentProcessors.js +1 -0
- package/dist/v2/react/hooks/useISOData.js +25 -7
- package/dist/v2/react/hooks/usePaymentPolling.d.ts +1 -1
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +12 -4
- package/dist/v2/react/providers/TagadaProvider.js +5 -5
- package/dist/v2/standalone/apple-pay-service.d.ts +12 -0
- package/dist/v2/standalone/apple-pay-service.js +12 -0
- package/dist/v2/standalone/external-tracker.d.ts +1 -1
- package/dist/v2/standalone/google-pay-service.d.ts +9 -0
- package/dist/v2/standalone/google-pay-service.js +9 -0
- package/dist/v2/standalone/index.d.ts +8 -1
- package/dist/v2/standalone/index.js +7 -0
- package/dist/v2/standalone/payment-service.d.ts +18 -5
- package/dist/v2/standalone/payment-service.js +62 -9
- package/package.json +115 -114
|
@@ -38,11 +38,11 @@ const InitializationLoader = () => (_jsxs("div", { style: {
|
|
|
38
38
|
borderTop: '1.5px solid #9ca3af',
|
|
39
39
|
borderRadius: '50%',
|
|
40
40
|
animation: 'tagada-spin 1s linear infinite',
|
|
41
|
-
} }), _jsx("span", { children: "Loading..." }), _jsx("style", { children: `
|
|
42
|
-
@keyframes tagada-spin {
|
|
43
|
-
0% { transform: rotate(0deg); }
|
|
44
|
-
100% { transform: rotate(360deg); }
|
|
45
|
-
}
|
|
41
|
+
} }), _jsx("span", { children: "Loading..." }), _jsx("style", { children: `
|
|
42
|
+
@keyframes tagada-spin {
|
|
43
|
+
0% { transform: rotate(0deg); }
|
|
44
|
+
100% { transform: rotate(360deg); }
|
|
45
|
+
}
|
|
46
46
|
` })] }));
|
|
47
47
|
const TagadaContext = createContext(null);
|
|
48
48
|
export function TagadaProvider({ children, environment, customApiConfig, debugMode, localConfig, blockUntilSessionReady = false, rawPluginConfig, features, funnelId, autoInitializeFunnel = true, onNavigate, onFunnelError, debugScripts = [], }) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apple Pay Service (Standalone) — re-export shim.
|
|
3
|
+
*
|
|
4
|
+
* The canonical implementation lives in `@tagadapay/core-js` so partner
|
|
5
|
+
* code, the studio, the native checkout, and the plugin-sdk all share a
|
|
6
|
+
* single source of truth for the native Apple Pay primitive (BasisTheory
|
|
7
|
+
* tokenization, no checkout session). This file preserves the historical
|
|
8
|
+
* import path `@tagadapay/plugin-sdk/v2/standalone` so existing consumers
|
|
9
|
+
* (studio-app, vanilla-checkout templates, …) keep working without
|
|
10
|
+
* code changes.
|
|
11
|
+
*/
|
|
12
|
+
export { isApplePayAvailable, startApplePaySession, type ApplePayServiceConfig, type ApplePayPaymentRequest, type ApplePayTokenResult, type ApplePayShippingContact, type ApplePayCallbacks, } from '@tagadapay/core-js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apple Pay Service (Standalone) — re-export shim.
|
|
3
|
+
*
|
|
4
|
+
* The canonical implementation lives in `@tagadapay/core-js` so partner
|
|
5
|
+
* code, the studio, the native checkout, and the plugin-sdk all share a
|
|
6
|
+
* single source of truth for the native Apple Pay primitive (BasisTheory
|
|
7
|
+
* tokenization, no checkout session). This file preserves the historical
|
|
8
|
+
* import path `@tagadapay/plugin-sdk/v2/standalone` so existing consumers
|
|
9
|
+
* (studio-app, vanilla-checkout templates, …) keep working without
|
|
10
|
+
* code changes.
|
|
11
|
+
*/
|
|
12
|
+
export { isApplePayAvailable, startApplePaySession, } from '@tagadapay/core-js';
|
|
@@ -36,7 +36,7 @@ export interface TagadaTrackerConfig {
|
|
|
36
36
|
stepName?: string;
|
|
37
37
|
/** Step type (optional — e.g., 'landing', 'offer', 'external') */
|
|
38
38
|
stepType?: string;
|
|
39
|
-
/** API base URL (defaults to https://
|
|
39
|
+
/** API base URL (defaults to https://api.tagada.io) */
|
|
40
40
|
apiBaseUrl?: string;
|
|
41
41
|
/** Enable debug logging */
|
|
42
42
|
debug?: boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Pay Service (Standalone) — re-export shim.
|
|
3
|
+
*
|
|
4
|
+
* The canonical implementation lives in `@tagadapay/core-js`. This file
|
|
5
|
+
* preserves the historical import path `@tagadapay/plugin-sdk/v2/standalone`
|
|
6
|
+
* for downstream consumers (studio-app, vanilla-checkout templates,
|
|
7
|
+
* payment-error-dashboard) — they keep working unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export { isGooglePayAvailable, startGooglePaySession, type GooglePayServiceConfig, type GooglePayPaymentRequest, type GooglePayTokenResult, type GooglePayAddress, type GooglePayCallbacks, } from '@tagadapay/core-js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Pay Service (Standalone) — re-export shim.
|
|
3
|
+
*
|
|
4
|
+
* The canonical implementation lives in `@tagadapay/core-js`. This file
|
|
5
|
+
* preserves the historical import path `@tagadapay/plugin-sdk/v2/standalone`
|
|
6
|
+
* for downstream consumers (studio-app, vanilla-checkout templates,
|
|
7
|
+
* payment-error-dashboard) — they keep working unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export { isGooglePayAvailable, startGooglePaySession, } from '@tagadapay/core-js';
|
|
@@ -25,12 +25,15 @@ export { TagadaClient, ApiClient, CheckoutResource };
|
|
|
25
25
|
export { ShippingRatesResource } from '../core/resources/shippingRates';
|
|
26
26
|
export { PaymentsResource } from '../core/resources/payments';
|
|
27
27
|
export { OrdersResource } from '../core/resources/orders';
|
|
28
|
+
export { OffersResource } from '../core/resources/offers';
|
|
28
29
|
export { ExpressPaymentMethodsResource } from '../core/resources/expressPaymentMethods';
|
|
29
30
|
export type { PaymentMethod as ExpressPaymentMethod } from '../core/resources/expressPaymentMethods';
|
|
30
31
|
export type { ShippingRate, ShippingRatesResponse, ShippingRatesPreviewParams } from '../core/resources/shippingRates';
|
|
31
|
-
export type { Payment, PaymentResponse, CardPaymentMethod, BasisTheoryInstance, GooglePayToken, ApplePayToken, PaymentInstrumentInput, PaymentInstrumentResponse, PaymentInstrumentCustomerResponse, } from '../core/resources/payments';
|
|
32
|
+
export type { Payment, PaymentResponse, PaymentOptions, CardPaymentMethod, BasisTheoryInstance, GooglePayToken, ApplePayToken, PaymentInstrumentInput, PaymentInstrumentResponse, PaymentInstrumentCustomerResponse, } from '../core/resources/payments';
|
|
32
33
|
export { StoreConfigResource } from '../core/resources/storeConfig';
|
|
33
34
|
export type { StoreConfig } from '../core/resources/storeConfig';
|
|
35
|
+
export { GeoResource } from '../core/resources/geo';
|
|
36
|
+
export type { GeoLocationData } from '../core/resources/geo';
|
|
34
37
|
export { ThreedsResource } from '../core/resources/threeds';
|
|
35
38
|
export { ISODataCore } from '../core/isoData';
|
|
36
39
|
export type { ISOCountry, ISORegion } from '../core/isoData';
|
|
@@ -50,6 +53,10 @@ export { getAssignedStepConfig } from '../core/funnelClient';
|
|
|
50
53
|
export type { RuntimeStepConfig } from '../core/funnelClient';
|
|
51
54
|
export { PaymentService } from './payment-service';
|
|
52
55
|
export type { PaymentServiceConfig, PaymentResult, PaymentCallbacks, CardData, ApmData, } from './payment-service';
|
|
56
|
+
export { isApplePayAvailable, startApplePaySession } from './apple-pay-service';
|
|
57
|
+
export type { ApplePayServiceConfig, ApplePayPaymentRequest, ApplePayTokenResult, ApplePayShippingContact, ApplePayCallbacks, } from './apple-pay-service';
|
|
58
|
+
export { isGooglePayAvailable, startGooglePaySession } from './google-pay-service';
|
|
59
|
+
export type { GooglePayServiceConfig, GooglePayPaymentRequest, GooglePayTokenResult, GooglePayAddress, GooglePayCallbacks, } from './google-pay-service';
|
|
53
60
|
/**
|
|
54
61
|
* Get BasisTheory public API key based on hostname detection.
|
|
55
62
|
* Delegates to the centralized isProductionBasisTheory() logic.
|
|
@@ -134,9 +134,12 @@ export { TagadaClient, ApiClient, CheckoutResource };
|
|
|
134
134
|
export { ShippingRatesResource } from '../core/resources/shippingRates';
|
|
135
135
|
export { PaymentsResource } from '../core/resources/payments';
|
|
136
136
|
export { OrdersResource } from '../core/resources/orders';
|
|
137
|
+
export { OffersResource } from '../core/resources/offers';
|
|
137
138
|
export { ExpressPaymentMethodsResource } from '../core/resources/expressPaymentMethods';
|
|
138
139
|
// Re-export Store Config (for standalone resolvers / builders)
|
|
139
140
|
export { StoreConfigResource } from '../core/resources/storeConfig';
|
|
141
|
+
// Re-export Geo Resource (for standalone geolocation / country detection)
|
|
142
|
+
export { GeoResource } from '../core/resources/geo';
|
|
140
143
|
// Re-export 3DS Resource (for standalone resolvers / builders)
|
|
141
144
|
export { ThreedsResource } from '../core/resources/threeds';
|
|
142
145
|
// Re-export ISO Data Core (for standalone address form / resolvers)
|
|
@@ -155,6 +158,10 @@ export { getAssignedPaymentFlowId };
|
|
|
155
158
|
export { getAssignedStepConfig } from '../core/funnelClient';
|
|
156
159
|
// Re-export Payment Service (standalone payment processing — no React)
|
|
157
160
|
export { PaymentService } from './payment-service';
|
|
161
|
+
// Re-export Apple Pay Service (standalone native Apple Pay — no React)
|
|
162
|
+
export { isApplePayAvailable, startApplePaySession } from './apple-pay-service';
|
|
163
|
+
// Re-export Google Pay Service (standalone native Google Pay — no React)
|
|
164
|
+
export { isGooglePayAvailable, startGooglePaySession } from './google-pay-service';
|
|
158
165
|
/**
|
|
159
166
|
* Get BasisTheory public API key based on hostname detection.
|
|
160
167
|
* Delegates to the centralized isProductionBasisTheory() logic.
|
|
@@ -51,6 +51,8 @@ export interface PaymentCallbacks {
|
|
|
51
51
|
onSuccess?: (payment: Payment) => void;
|
|
52
52
|
onFailure?: (error: string) => void;
|
|
53
53
|
onRedirectReturn?: (paymentId: string) => void;
|
|
54
|
+
/** Called before a browser redirect, allows caller to await async work (e.g. funnel navigate) */
|
|
55
|
+
onBeforeRedirect?: (payment: Payment, redirectUrl: string) => Promise<void>;
|
|
54
56
|
}
|
|
55
57
|
export interface PollingCallbacks {
|
|
56
58
|
onSuccess: (payment: Payment) => void;
|
|
@@ -101,6 +103,7 @@ export declare class PaymentService {
|
|
|
101
103
|
private handleTrustFlowAuth;
|
|
102
104
|
private handleFinixRadar;
|
|
103
105
|
private handleStripeRadar;
|
|
106
|
+
private handleNgeniusThreeds;
|
|
104
107
|
private handleAirwallexRadar;
|
|
105
108
|
private handleMasterCardAuth;
|
|
106
109
|
private loadScript;
|
|
@@ -126,9 +129,19 @@ export declare class PaymentService {
|
|
|
126
129
|
id: string;
|
|
127
130
|
sessionId: string;
|
|
128
131
|
}>;
|
|
129
|
-
processCardPayment(checkoutSessionId: string, cardData: CardData
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
processCardPayment(checkoutSessionId: string, cardData: CardData, options?: {
|
|
133
|
+
shippingRateId?: string;
|
|
134
|
+
}): Promise<PaymentResult>;
|
|
135
|
+
processApplePayPayment(checkoutSessionId: string, applePayToken: ApplePayToken, options?: {
|
|
136
|
+
shippingRateId?: string;
|
|
137
|
+
}): Promise<PaymentResult>;
|
|
138
|
+
processGooglePayPayment(checkoutSessionId: string, googlePayToken: GooglePayToken, options?: {
|
|
139
|
+
shippingRateId?: string;
|
|
140
|
+
}): Promise<PaymentResult>;
|
|
141
|
+
processPaymentWithInstrument(checkoutSessionId: string, paymentInstrumentId: string, options?: {
|
|
142
|
+
shippingRateId?: string;
|
|
143
|
+
}): Promise<PaymentResult>;
|
|
144
|
+
processApmPayment(checkoutSessionId: string, apmData: ApmData, options?: {
|
|
145
|
+
shippingRateId?: string;
|
|
146
|
+
}): Promise<PaymentResult>;
|
|
134
147
|
}
|
|
@@ -212,6 +212,7 @@ export class PaymentService {
|
|
|
212
212
|
paymentFlowId,
|
|
213
213
|
processorId: extra?.processorId,
|
|
214
214
|
paymentMethod: extra?.paymentMethod,
|
|
215
|
+
shippingRateId: extra?.shippingRateId,
|
|
215
216
|
});
|
|
216
217
|
console.log('[PaymentService] Payment response:', {
|
|
217
218
|
paymentId: response.payment?.id,
|
|
@@ -301,6 +302,9 @@ export class PaymentService {
|
|
|
301
302
|
const redirectUrl = actionData.metadata?.redirect?.redirectUrl || actionData.redirectUrl || actionData.url;
|
|
302
303
|
if (redirectUrl) {
|
|
303
304
|
console.log('[PaymentService] Redirecting:', redirectUrl);
|
|
305
|
+
if (this.callbacks.onBeforeRedirect) {
|
|
306
|
+
await this.callbacks.onBeforeRedirect(payment, redirectUrl);
|
|
307
|
+
}
|
|
304
308
|
window.location.href = redirectUrl;
|
|
305
309
|
}
|
|
306
310
|
else if (payment.status === 'succeeded') {
|
|
@@ -343,6 +347,9 @@ export class PaymentService {
|
|
|
343
347
|
case 'mastercard_auth':
|
|
344
348
|
await this.handleMasterCardAuth(payment, actionData);
|
|
345
349
|
break;
|
|
350
|
+
case 'ngenius_3ds':
|
|
351
|
+
await this.handleNgeniusThreeds(payment, actionData);
|
|
352
|
+
break;
|
|
346
353
|
default: {
|
|
347
354
|
console.log('[PaymentService] Unhandled action, starting polling:', actionData.type);
|
|
348
355
|
this.startPolling(payment.id, {
|
|
@@ -501,6 +508,51 @@ export class PaymentService {
|
|
|
501
508
|
}
|
|
502
509
|
}
|
|
503
510
|
// --------------------------------------------------------------------------
|
|
511
|
+
// N-Genius 3DS (WebSDK)
|
|
512
|
+
// --------------------------------------------------------------------------
|
|
513
|
+
async handleNgeniusThreeds(payment, actionData) {
|
|
514
|
+
const sdk = actionData.metadata?.sdk;
|
|
515
|
+
if (!sdk?.paymentResponse || !sdk.orderReference || !sdk.paymentReference) {
|
|
516
|
+
this.callbacks.onError?.('N-Genius 3DS: missing SDK metadata');
|
|
517
|
+
this.callbacks.onProcessing?.(false);
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
try {
|
|
521
|
+
const sdkUrl = sdk.isSandboxed
|
|
522
|
+
? 'https://paypage.sandbox.ngenius-payments.com/hosted-sessions/sdk.js'
|
|
523
|
+
: 'https://paypage.ngenius-payments.com/hosted-sessions/sdk.js';
|
|
524
|
+
if (!document.getElementById('ngenius-websdk')) {
|
|
525
|
+
await new Promise((resolve, reject) => {
|
|
526
|
+
const script = document.createElement('script');
|
|
527
|
+
script.id = 'ngenius-websdk';
|
|
528
|
+
script.src = sdkUrl;
|
|
529
|
+
script.onload = () => resolve();
|
|
530
|
+
script.onerror = () => reject(new Error('Failed to load N-Genius WebSDK'));
|
|
531
|
+
document.head.appendChild(script);
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
const NI = window.NI;
|
|
535
|
+
if (!NI?.handlePaymentResponse) {
|
|
536
|
+
throw new Error('N-Genius WebSDK did not expose window.NI.handlePaymentResponse');
|
|
537
|
+
}
|
|
538
|
+
console.log('[N-Genius 3DS] Starting WebSDK challenge');
|
|
539
|
+
const outcome = await NI.handlePaymentResponse(sdk.paymentResponse, { mountId: 'ngenius-3ds-container', style: { width: '100%', height: 500 } });
|
|
540
|
+
console.log('[N-Genius 3DS] WebSDK outcome:', outcome.status);
|
|
541
|
+
const completedPayment = await this.paymentsResource.ngeniusThreedsComplete({
|
|
542
|
+
paymentId: payment.id,
|
|
543
|
+
orderReference: sdk.orderReference,
|
|
544
|
+
paymentReference: sdk.paymentReference,
|
|
545
|
+
});
|
|
546
|
+
await this.handleResumedPayment(completedPayment);
|
|
547
|
+
}
|
|
548
|
+
catch (error) {
|
|
549
|
+
const msg = error instanceof Error ? error.message : 'N-Genius 3DS failed';
|
|
550
|
+
console.error('[N-Genius 3DS] Error:', error);
|
|
551
|
+
this.callbacks.onError?.(msg);
|
|
552
|
+
this.callbacks.onProcessing?.(false);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
// --------------------------------------------------------------------------
|
|
504
556
|
// Airwallex Radar
|
|
505
557
|
// --------------------------------------------------------------------------
|
|
506
558
|
async handleAirwallexRadar(payment, actionData) {
|
|
@@ -835,7 +887,7 @@ export class PaymentService {
|
|
|
835
887
|
// ==========================================================================
|
|
836
888
|
// PAYMENT PROCESSING (all methods)
|
|
837
889
|
// ==========================================================================
|
|
838
|
-
async processCardPayment(checkoutSessionId, cardData) {
|
|
890
|
+
async processCardPayment(checkoutSessionId, cardData, options) {
|
|
839
891
|
this.callbacks.onProcessing?.(true);
|
|
840
892
|
this.callbacks.onError?.(null);
|
|
841
893
|
try {
|
|
@@ -858,7 +910,7 @@ export class PaymentService {
|
|
|
858
910
|
// Continue without 3DS
|
|
859
911
|
}
|
|
860
912
|
}
|
|
861
|
-
return await this.processAndHandle(checkoutSessionId, instrument.id, threedsSessionId);
|
|
913
|
+
return await this.processAndHandle(checkoutSessionId, instrument.id, threedsSessionId, { shippingRateId: options?.shippingRateId });
|
|
862
914
|
}
|
|
863
915
|
catch (error) {
|
|
864
916
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -867,12 +919,12 @@ export class PaymentService {
|
|
|
867
919
|
return { success: false, error: msg };
|
|
868
920
|
}
|
|
869
921
|
}
|
|
870
|
-
async processApplePayPayment(checkoutSessionId, applePayToken) {
|
|
922
|
+
async processApplePayPayment(checkoutSessionId, applePayToken, options) {
|
|
871
923
|
this.callbacks.onProcessing?.(true);
|
|
872
924
|
this.callbacks.onError?.(null);
|
|
873
925
|
try {
|
|
874
926
|
const instrument = await this.createApplePayPaymentInstrument(applePayToken);
|
|
875
|
-
return await this.processAndHandle(checkoutSessionId, instrument.id);
|
|
927
|
+
return await this.processAndHandle(checkoutSessionId, instrument.id, undefined, { shippingRateId: options?.shippingRateId });
|
|
876
928
|
}
|
|
877
929
|
catch (error) {
|
|
878
930
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -881,12 +933,12 @@ export class PaymentService {
|
|
|
881
933
|
return { success: false, error: msg };
|
|
882
934
|
}
|
|
883
935
|
}
|
|
884
|
-
async processGooglePayPayment(checkoutSessionId, googlePayToken) {
|
|
936
|
+
async processGooglePayPayment(checkoutSessionId, googlePayToken, options) {
|
|
885
937
|
this.callbacks.onProcessing?.(true);
|
|
886
938
|
this.callbacks.onError?.(null);
|
|
887
939
|
try {
|
|
888
940
|
const instrument = await this.createGooglePayPaymentInstrument(googlePayToken);
|
|
889
|
-
return await this.processAndHandle(checkoutSessionId, instrument.id);
|
|
941
|
+
return await this.processAndHandle(checkoutSessionId, instrument.id, undefined, { shippingRateId: options?.shippingRateId });
|
|
890
942
|
}
|
|
891
943
|
catch (error) {
|
|
892
944
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -895,11 +947,11 @@ export class PaymentService {
|
|
|
895
947
|
return { success: false, error: msg };
|
|
896
948
|
}
|
|
897
949
|
}
|
|
898
|
-
async processPaymentWithInstrument(checkoutSessionId, paymentInstrumentId) {
|
|
950
|
+
async processPaymentWithInstrument(checkoutSessionId, paymentInstrumentId, options) {
|
|
899
951
|
this.callbacks.onProcessing?.(true);
|
|
900
952
|
this.callbacks.onError?.(null);
|
|
901
953
|
try {
|
|
902
|
-
return await this.processAndHandle(checkoutSessionId, paymentInstrumentId);
|
|
954
|
+
return await this.processAndHandle(checkoutSessionId, paymentInstrumentId, undefined, { shippingRateId: options?.shippingRateId });
|
|
903
955
|
}
|
|
904
956
|
catch (error) {
|
|
905
957
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -908,7 +960,7 @@ export class PaymentService {
|
|
|
908
960
|
return { success: false, error: msg };
|
|
909
961
|
}
|
|
910
962
|
}
|
|
911
|
-
async processApmPayment(checkoutSessionId, apmData) {
|
|
963
|
+
async processApmPayment(checkoutSessionId, apmData, options) {
|
|
912
964
|
this.callbacks.onProcessing?.(true);
|
|
913
965
|
this.callbacks.onError?.(null);
|
|
914
966
|
try {
|
|
@@ -917,6 +969,7 @@ export class PaymentService {
|
|
|
917
969
|
paymentMethod: apmData.paymentMethod,
|
|
918
970
|
initiatedBy: apmData.initiatedBy,
|
|
919
971
|
source: apmData.source,
|
|
972
|
+
shippingRateId: options?.shippingRateId,
|
|
920
973
|
});
|
|
921
974
|
}
|
|
922
975
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,114 +1,115 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tagadapay/plugin-sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Modern React SDK for building Tagada Pay plugins",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"sideEffects": false,
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js",
|
|
12
|
-
"require": "./dist/index.js"
|
|
13
|
-
},
|
|
14
|
-
"./react": {
|
|
15
|
-
"types": "./dist/react/index.d.ts",
|
|
16
|
-
"import": "./dist/react/index.js",
|
|
17
|
-
"require": "./dist/react/index.js"
|
|
18
|
-
},
|
|
19
|
-
"./v2": {
|
|
20
|
-
"types": "./dist/v2/index.d.ts",
|
|
21
|
-
"import": "./dist/v2/index.js",
|
|
22
|
-
"require": "./dist/v2/index.js"
|
|
23
|
-
},
|
|
24
|
-
"./v2/standalone": {
|
|
25
|
-
"types": "./dist/v2/standalone/index.d.ts",
|
|
26
|
-
"import": "./dist/v2/standalone/index.js",
|
|
27
|
-
"require": "./dist/v2/standalone/index.js"
|
|
28
|
-
},
|
|
29
|
-
"./external-tracker": {
|
|
30
|
-
"browser": "./dist/external-tracker.min.js",
|
|
31
|
-
"default": "./dist/external-tracker.min.js"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"scripts": {
|
|
35
|
-
"build": "tsc && npm run build:cdn",
|
|
36
|
-
"build:cdn": "node build-cdn.js",
|
|
37
|
-
"build:ts": "tsc",
|
|
38
|
-
"clean": "rm -rf dist",
|
|
39
|
-
"lint": "echo \"No linting configured\"",
|
|
40
|
-
"test": "jest --no-watchman",
|
|
41
|
-
"test:watch": "jest --watch --no-watchman",
|
|
42
|
-
"test:coverage": "jest --coverage --no-watchman",
|
|
43
|
-
"dev": "tsc --watch",
|
|
44
|
-
"prepublishOnly": "npm run clean && npm run build",
|
|
45
|
-
"publish:patch": "npm version patch && npm publish",
|
|
46
|
-
"publish:minor": "npm version minor && npm publish",
|
|
47
|
-
"publish:major": "npm version major && npm publish",
|
|
48
|
-
"publish:beta": "npm version prerelease --preid=beta && npm publish --tag beta",
|
|
49
|
-
"publish:alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha",
|
|
50
|
-
"version:patch": "npm version patch",
|
|
51
|
-
"version:minor": "npm version minor",
|
|
52
|
-
"version:major": "npm version major",
|
|
53
|
-
"version:beta": "npm version prerelease --preid=beta",
|
|
54
|
-
"version:alpha": "npm version prerelease --preid=alpha",
|
|
55
|
-
"version:check": "node version-sync.js check",
|
|
56
|
-
"version:sync": "node version-sync.js sync",
|
|
57
|
-
"version:list": "node version-sync.js list",
|
|
58
|
-
"version:next": "node version-sync.js next",
|
|
59
|
-
"postversion": "echo \"✅ Version updated to $(node -p 'require(\"./package.json\").version')\" && (git push && git push --tags || echo \"⚠️ Git push failed - you may need to pull and push manually\")"
|
|
60
|
-
},
|
|
61
|
-
"keywords": [
|
|
62
|
-
"tagadapay",
|
|
63
|
-
"cms",
|
|
64
|
-
"plugin",
|
|
65
|
-
"sdk",
|
|
66
|
-
"react",
|
|
67
|
-
"typescript"
|
|
68
|
-
],
|
|
69
|
-
"author": "Tagada Pay",
|
|
70
|
-
"license": "MIT",
|
|
71
|
-
"dependencies": {
|
|
72
|
-
"@basis-theory/apple-pay-js": "^2.0.2",
|
|
73
|
-
"@basis-theory/basis-theory-js": "^4.30.0",
|
|
74
|
-
"@basis-theory/basis-theory-react": "^1.32.5",
|
|
75
|
-
"@basis-theory/web-threeds": "^1.0.1",
|
|
76
|
-
"@google-pay/button-react": "^3.0.10",
|
|
77
|
-
"@stripe/react-stripe-js": "^5.6.1",
|
|
78
|
-
"@stripe/stripe-js": "^8.11.0",
|
|
79
|
-
"@tagadapay/
|
|
80
|
-
"@
|
|
81
|
-
"@
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"@types/
|
|
90
|
-
"@types/
|
|
91
|
-
"@types/react
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"react
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@tagadapay/plugin-sdk",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Modern React SDK for building Tagada Pay plugins",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./react": {
|
|
15
|
+
"types": "./dist/react/index.d.ts",
|
|
16
|
+
"import": "./dist/react/index.js",
|
|
17
|
+
"require": "./dist/react/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./v2": {
|
|
20
|
+
"types": "./dist/v2/index.d.ts",
|
|
21
|
+
"import": "./dist/v2/index.js",
|
|
22
|
+
"require": "./dist/v2/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./v2/standalone": {
|
|
25
|
+
"types": "./dist/v2/standalone/index.d.ts",
|
|
26
|
+
"import": "./dist/v2/standalone/index.js",
|
|
27
|
+
"require": "./dist/v2/standalone/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./external-tracker": {
|
|
30
|
+
"browser": "./dist/external-tracker.min.js",
|
|
31
|
+
"default": "./dist/external-tracker.min.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc && npm run build:cdn",
|
|
36
|
+
"build:cdn": "node build-cdn.js",
|
|
37
|
+
"build:ts": "tsc",
|
|
38
|
+
"clean": "rm -rf dist",
|
|
39
|
+
"lint": "echo \"No linting configured\"",
|
|
40
|
+
"test": "jest --no-watchman",
|
|
41
|
+
"test:watch": "jest --watch --no-watchman",
|
|
42
|
+
"test:coverage": "jest --coverage --no-watchman",
|
|
43
|
+
"dev": "tsc --watch",
|
|
44
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
45
|
+
"publish:patch": "npm version patch && npm publish",
|
|
46
|
+
"publish:minor": "npm version minor && npm publish",
|
|
47
|
+
"publish:major": "npm version major && npm publish",
|
|
48
|
+
"publish:beta": "npm version prerelease --preid=beta && npm publish --tag beta",
|
|
49
|
+
"publish:alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha",
|
|
50
|
+
"version:patch": "npm version patch",
|
|
51
|
+
"version:minor": "npm version minor",
|
|
52
|
+
"version:major": "npm version major",
|
|
53
|
+
"version:beta": "npm version prerelease --preid=beta",
|
|
54
|
+
"version:alpha": "npm version prerelease --preid=alpha",
|
|
55
|
+
"version:check": "node version-sync.js check",
|
|
56
|
+
"version:sync": "node version-sync.js sync",
|
|
57
|
+
"version:list": "node version-sync.js list",
|
|
58
|
+
"version:next": "node version-sync.js next",
|
|
59
|
+
"postversion": "echo \"✅ Version updated to $(node -p 'require(\"./package.json\").version')\" && (git push && git push --tags || echo \"⚠️ Git push failed - you may need to pull and push manually\")"
|
|
60
|
+
},
|
|
61
|
+
"keywords": [
|
|
62
|
+
"tagadapay",
|
|
63
|
+
"cms",
|
|
64
|
+
"plugin",
|
|
65
|
+
"sdk",
|
|
66
|
+
"react",
|
|
67
|
+
"typescript"
|
|
68
|
+
],
|
|
69
|
+
"author": "Tagada Pay",
|
|
70
|
+
"license": "MIT",
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@basis-theory/apple-pay-js": "^2.0.2",
|
|
73
|
+
"@basis-theory/basis-theory-js": "^4.30.0",
|
|
74
|
+
"@basis-theory/basis-theory-react": "^1.32.5",
|
|
75
|
+
"@basis-theory/web-threeds": "^1.0.1",
|
|
76
|
+
"@google-pay/button-react": "^3.0.10",
|
|
77
|
+
"@stripe/react-stripe-js": "^5.6.1",
|
|
78
|
+
"@stripe/stripe-js": "^8.11.0",
|
|
79
|
+
"@tagadapay/core-js": "workspace:*",
|
|
80
|
+
"@tagadapay/plugin-sdk": "link:",
|
|
81
|
+
"@tanstack/react-query": "^5.90.2",
|
|
82
|
+
"@whop/checkout": "^0.0.40",
|
|
83
|
+
"axios": "^1.10.0",
|
|
84
|
+
"path-to-regexp": "^8.2.0",
|
|
85
|
+
"react-intl": "^7.1.11",
|
|
86
|
+
"swr": "^2.3.6"
|
|
87
|
+
},
|
|
88
|
+
"devDependencies": {
|
|
89
|
+
"@types/jest": "^29.5.0",
|
|
90
|
+
"@types/node": "^18.19.130",
|
|
91
|
+
"@types/react": "^19",
|
|
92
|
+
"@types/react-dom": "^19",
|
|
93
|
+
"esbuild": "^0.24.2",
|
|
94
|
+
"jest": "^29.5.0",
|
|
95
|
+
"ts-jest": "^29.1.0",
|
|
96
|
+
"typescript": "^5.0.0"
|
|
97
|
+
},
|
|
98
|
+
"peerDependencies": {
|
|
99
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
100
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
101
|
+
},
|
|
102
|
+
"files": [
|
|
103
|
+
"dist/**/*",
|
|
104
|
+
"README.md",
|
|
105
|
+
"build-cdn.js"
|
|
106
|
+
],
|
|
107
|
+
"repository": {
|
|
108
|
+
"type": "git",
|
|
109
|
+
"url": "git+https://github.com/tagadapay/plugin-sdk.git"
|
|
110
|
+
},
|
|
111
|
+
"bugs": {
|
|
112
|
+
"url": "https://github.com/tagadapay/plugin-sdk/issues"
|
|
113
|
+
},
|
|
114
|
+
"homepage": "https://github.com/tagadapay/plugin-sdk#readme"
|
|
115
|
+
}
|