paygate-checkout-sdk 0.0.0 → 0.0.2

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/index.d.ts CHANGED
@@ -1,45 +1 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- type MerchantDataProps = {
4
- clientId?: string;
5
- firstName: string;
6
- lastName: string;
7
- email: string;
8
- phoneNumber: string;
9
- countryCode: string;
10
- currencyCode: string;
11
- transactionCurrency?: string;
12
- merchantName?: string;
13
- amount: number;
14
- merchantReference?: string;
15
- customerAddress?: string;
16
- customerCity?: string;
17
- customerState?: string;
18
- customerCountry?: string;
19
- customerPostalCode?: string;
20
- webhookUrl?: string;
21
- deviceSignature?: string;
22
- ipAddress?: string;
23
- metadataOrderId?: string;
24
- metadataProductInfo?: string;
25
- redirectUrl?: string;
26
- merchantPublicKey?: string;
27
- merchantSecretKey?: string;
28
- merchantAPIKey?: string;
29
- merchantSiteUrl: string;
30
- };
31
- type PaygateCheckoutSdkProps = {
32
- userData: MerchantDataProps;
33
- config?: {
34
- theme?: "light" | "dark";
35
- environment?: "test" | "live";
36
- [key: string]: any;
37
- };
38
- onSuccess?: (response: any) => void;
39
- onError?: (error: any) => void;
40
- };
41
-
42
- declare const PaygateCheckoutSdk: ({ userData }: PaygateCheckoutSdkProps) => react_jsx_runtime.JSX.Element;
43
-
44
- export { PaygateCheckoutSdk };
45
- export type { PaygateCheckoutSdkProps, MerchantDataProps as UserBasicDataType };
1
+ import './index.css';
@@ -0,0 +1,48 @@
1
+ type MerchantDataProps = {
2
+ clientId?: string;
3
+ firstName: string;
4
+ lastName: string;
5
+ email: string;
6
+ phoneNumber: string;
7
+ countryCode: string;
8
+ currencyCode: string;
9
+ transactionCurrency?: string;
10
+ merchantName?: string;
11
+ amount: number;
12
+ merchantReference?: string;
13
+ customerAddress?: string;
14
+ customerCity?: string;
15
+ customerState?: string;
16
+ customerCountry?: string;
17
+ customerPostalCode?: string;
18
+ webhookUrl?: string;
19
+ deviceSignature?: string;
20
+ ipAddress?: string;
21
+ metadataOrderId?: string;
22
+ metadataProductInfo?: string;
23
+ redirectUrl?: string;
24
+ merchantPublicKey?: string;
25
+ merchantSecretKey?: string;
26
+ merchantAPIKey?: string;
27
+ merchantSiteUrl: string;
28
+ };
29
+ type PaygateCheckoutSdkProps = {
30
+ userData: MerchantDataProps;
31
+ config?: {
32
+ theme?: "light" | "dark";
33
+ environment?: "test" | "live";
34
+ [key: string]: any;
35
+ };
36
+ onSuccess?: (response: any) => void;
37
+ onError?: (error: any) => void;
38
+ };
39
+
40
+ declare const PaygateSdk: {
41
+ setup: (config: {
42
+ targetId: string;
43
+ props: PaygateCheckoutSdkProps;
44
+ }) => void;
45
+ };
46
+
47
+ export { PaygateSdk };
48
+ export type { MerchantDataProps, PaygateCheckoutSdkProps };
@@ -1,4 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { createRoot } from 'react-dom/client';
2
3
  import * as React from 'react';
3
4
  import React__default, { useState, useCallback, useRef, useEffect } from 'react';
4
5
  import styled, { keyframes, css as css$1 } from 'styled-components';
@@ -7269,5 +7270,24 @@ const PaygateCheckoutSdk = ({ userData }) => {
7269
7270
  }, style: { marginTop: 24 } }, { children: "Try Again" }))] })))] }))] })] }), jsxs(AcceptedCardsBox, { children: [jsx("span", Object.assign({ style: { fontWeight: 600, color: "rgb(40, 17, 156)" } }, { children: "We accept:" })), jsxs(AcceptedCardsInnerBox, { children: [jsx(VisaIcon, { width: "40", height: "30" }), jsx(MasterCardIcon, { width: "40", height: "30" }), jsx(VerveIcon, { width: "40", height: "30" }), jsx(AmexIcon, { width: "40", height: "30" }), jsx(DiscoverIcon, { width: "40", height: "30" })] })] }), jsxs(SecureBox, { children: [jsx(FaLockIcon, {}), jsxs(DivBox, { children: [jsx("span", Object.assign({ style: { fontWeight: 400, margin: "0px 5px", color: "#000" } }, { children: "secured by" })), jsx("span", Object.assign({ style: { color: "#28119C" } }, { children: "Blusalt" }))] })] }), isDrawerOpen && jsx(Overlay, { onClick: () => setIsDrawerOpen(false) })] })), isPaymanetSuccessful && (jsx(PaymentSuccessView, { reason: intiateCardPaymentResponse === null || intiateCardPaymentResponse === void 0 ? void 0 : intiateCardPaymentResponse.message, merchantSiteUrl: userData === null || userData === void 0 ? void 0 : userData.merchantSiteUrl })), isPaymanetFailed && (jsx(PaymentFailedView, { reason: intiateCardPaymentResponse === null || intiateCardPaymentResponse === void 0 ? void 0 : intiateCardPaymentResponse.message, merchantSiteUrl: userData === null || userData === void 0 ? void 0 : userData.merchantSiteUrl, handleReset: resetState, handleSelectedMethod: handleSelectedMethod })), show3DSIframe && redirect3DSUrl && (jsxs(Container, { children: [jsx("h2", { children: "3DS Authentication" }), jsx(Iframe, { ref: iframeRef, src: redirect3DSUrl, allow: "fullscreen" })] })), SnackbarUI()] }));
7270
7271
  };
7271
7272
 
7272
- export { PaygateCheckoutSdk };
7273
- //# sourceMappingURL=index.esm.js.map
7273
+ /**
7274
+ * Sets up and renders the Paygate Checkout SDK component into a specified DOM element.
7275
+ * @param config - Configuration object containing the targetId and props for the SDK.
7276
+ */
7277
+ const setup = (config) => {
7278
+ const { targetId, props } = config;
7279
+ const container = document.getElementById(targetId);
7280
+ if (container) {
7281
+ const root = createRoot(container);
7282
+ root.render(jsx(PaygateCheckoutSdk, Object.assign({}, props)));
7283
+ }
7284
+ else {
7285
+ console.error(`Paygate SDK: Element with id "${targetId}" not found.`);
7286
+ }
7287
+ };
7288
+ const PaygateSdk = {
7289
+ setup,
7290
+ };
7291
+
7292
+ export { PaygateSdk };
7293
+ //# sourceMappingURL=index.esm.jsx.map