@solidgate/vue-sdk 1.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 ADDED
@@ -0,0 +1,75 @@
1
+ # Solidgate Vue3 SDK
2
+
3
+ This is a wrapper for Solidgate Client SDK
4
+
5
+ ## Installation
6
+
7
+ Run inside Vue3 project
8
+
9
+ ```
10
+ npm i @solidagate/vue-sdk
11
+ ```
12
+
13
+ ## Usage
14
+ Render a payment component in your vue3 project
15
+
16
+ Component inputs and outputs are similar to described in the docs https://dev.solidgate.cm/developers/d
17
+ ```vue
18
+ <template>
19
+ <Payment :merchant-data="merchantData" />
20
+ </template>
21
+
22
+ <script lang="ts" setup>
23
+ import Payment, { InitConfig } from '@solidgate/vue-sdk'
24
+
25
+ const merchantData: InitConfig['merchantData'] = {
26
+ merchant: '<<--YOUR MERCHANT ID-->>',
27
+ signature: '<<--YOUR SIGNATURE OF THE REQUEST-->>',
28
+ paymentIntent: '<<--YOUR PAYMENT INTENT-->>'
29
+ }
30
+ </script>
31
+ ```
32
+
33
+ In order to render google/apple button in custom container define Payment as async component and pass l
34
+ ```vue
35
+ <template>
36
+ <Payment
37
+ :merchan-data="merchantData"
38
+ :google-pay-container-ref="googleButton"
39
+ :apple-pay-container-ref="appleButton"
40
+ />
41
+ <div ref="googleButton" />
42
+ <div ref="appleButton" />
43
+ </template>
44
+
45
+ <script lang="ts" setup>
46
+ import { ref, defineAsyncComponent } from 'vue'
47
+ import { InitConfig } from '@solidgate/vue-sdk'
48
+ const Payment = defineAsyncComponent(() => import('@solidgate/vue-sdk'))
49
+
50
+ const googleButton = ref<HTMLDivElement>()
51
+ const appleButton = ref<HTMLDivElement>()
52
+
53
+ const merchantData: InitConfig['merchantData'] = {
54
+ merchant: '<<--YOUR MERCHANT ID-->>',
55
+ signature: '<<--YOUR SIGNATURE OF THE REQUEST-->>',
56
+ paymentIntent: '<<--YOUR PAYMENT INTENT-->>'
57
+ }
58
+ </script>
59
+ ```
60
+
61
+ ## Development server (Vue3 + Typescript + Vite)
62
+
63
+ 1. cd vue-sdk
64
+ 2. npm i
65
+ 3. npm run start
66
+ 4. Navigate to `http://localhost:3000/`. The app will automatically reload if you change any of the
67
+
68
+ ## Build
69
+
70
+ 1. cd vue-sdk
71
+ 2. npm run build
72
+ 3. cd dist
73
+ 4. solid-payment.es.js is a js bundle.
74
+
75
+
Binary file
@@ -0,0 +1,239 @@
1
+ import { OrderStatusMessage, InteractionMessage, MountedMessage, SuccessMessage, ResizeMessage, SubmitMessage, ErrorMessage, FailMessage, SdkMessage, MessageType } from '@solidgate/client-sdk-loader';
2
+ declare const _default: import("vue").DefineComponent<{
3
+ merchantData: {
4
+ type: import("vue").PropType<{
5
+ merchant: string;
6
+ signature: string;
7
+ paymentIntent: string;
8
+ version?: string | undefined;
9
+ }>;
10
+ required: true;
11
+ };
12
+ width: {
13
+ type: import("vue").PropType<string>;
14
+ };
15
+ styles: {
16
+ type: import("vue").PropType<Record<string, unknown>>;
17
+ };
18
+ formParams: {
19
+ type: import("vue").PropType<Partial<{
20
+ enabled: false;
21
+ submitButtonText: string;
22
+ isCardHolderVisible: boolean;
23
+ headerText: string;
24
+ titleText: string;
25
+ formTypeClass: import("@solidgate/client-sdk-loader/dist/enums/FormType").default;
26
+ isSolidLogoVisible: boolean;
27
+ cardBrands: import("@solidgate/client-sdk-loader").CardBrand[];
28
+ secureBrands: import("@solidgate/client-sdk-loader/dist/enums/SecureBrand").default[];
29
+ allowSubmit: boolean;
30
+ allowedAdditionalFields: import("@solidgate/client-sdk-loader/dist/enums/AdditionalField").default[];
31
+ googleFontLink: string;
32
+ }>>;
33
+ };
34
+ googlePayButtonParams: {
35
+ type: import("vue").PropType<Omit<Partial<{
36
+ enabled: false;
37
+ containerId: string;
38
+ color: string;
39
+ type: string;
40
+ }> | undefined, "containerId">>;
41
+ };
42
+ applePayButtonParams: {
43
+ type: import("vue").PropType<Omit<Partial<{
44
+ enabled: false;
45
+ containerId: string;
46
+ color: string;
47
+ type: string;
48
+ }> | undefined, "containerId">>;
49
+ };
50
+ googlePayContainerRef: {
51
+ type: import("vue").PropType<HTMLDivElement>;
52
+ };
53
+ applePayContainerRef: {
54
+ type: import("vue").PropType<HTMLDivElement>;
55
+ };
56
+ onReadyPaymentInstance: {
57
+ type: import("vue").PropType<(paymentInstance: import("@solidgate/client-sdk-loader").ClientSdkInstance) => void>;
58
+ };
59
+ onMounted: {
60
+ type: import("vue").PropType<(e: MountedMessage) => void>;
61
+ } & {
62
+ default: () => void;
63
+ };
64
+ onError: {
65
+ type: import("vue").PropType<(e: ErrorMessage) => void>;
66
+ } & {
67
+ default: () => void;
68
+ };
69
+ onSuccess: {
70
+ type: import("vue").PropType<(e: SuccessMessage) => void>;
71
+ } & {
72
+ default: () => void;
73
+ };
74
+ onFail: {
75
+ type: import("vue").PropType<(e: FailMessage) => void>;
76
+ } & {
77
+ default: () => void;
78
+ };
79
+ onSubmit: {
80
+ type: import("vue").PropType<(e: SubmitMessage) => void>;
81
+ } & {
82
+ default: () => void;
83
+ };
84
+ onVerify: {
85
+ type: import("vue").PropType<(e: SdkMessage[MessageType.Verify]) => void>;
86
+ } & {
87
+ default: () => void;
88
+ };
89
+ onCustomStylesAppended: {
90
+ type: import("vue").PropType<(e: SdkMessage[MessageType.CustomStylesAppended]) => void>;
91
+ } & {
92
+ default: () => void;
93
+ };
94
+ onFormRedirect: {
95
+ type: import("vue").PropType<(e: SdkMessage[MessageType.Redirect]) => void>;
96
+ } & {
97
+ default: () => void;
98
+ };
99
+ onInteraction: {
100
+ type: import("vue").PropType<(e: InteractionMessage) => void>;
101
+ } & {
102
+ default: () => void;
103
+ };
104
+ onOrderStatus: {
105
+ type: import("vue").PropType<(e: OrderStatusMessage) => void>;
106
+ } & {
107
+ default: () => void;
108
+ };
109
+ onResize: {
110
+ type: import("vue").PropType<(e: ResizeMessage) => void>;
111
+ } & {
112
+ default: () => void;
113
+ };
114
+ }, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
115
+ merchantData: {
116
+ type: import("vue").PropType<{
117
+ merchant: string;
118
+ signature: string;
119
+ paymentIntent: string;
120
+ version?: string | undefined;
121
+ }>;
122
+ required: true;
123
+ };
124
+ width: {
125
+ type: import("vue").PropType<string>;
126
+ };
127
+ styles: {
128
+ type: import("vue").PropType<Record<string, unknown>>;
129
+ };
130
+ formParams: {
131
+ type: import("vue").PropType<Partial<{
132
+ enabled: false;
133
+ submitButtonText: string;
134
+ isCardHolderVisible: boolean;
135
+ headerText: string;
136
+ titleText: string;
137
+ formTypeClass: import("@solidgate/client-sdk-loader/dist/enums/FormType").default;
138
+ isSolidLogoVisible: boolean;
139
+ cardBrands: import("@solidgate/client-sdk-loader").CardBrand[];
140
+ secureBrands: import("@solidgate/client-sdk-loader/dist/enums/SecureBrand").default[];
141
+ allowSubmit: boolean;
142
+ allowedAdditionalFields: import("@solidgate/client-sdk-loader/dist/enums/AdditionalField").default[];
143
+ googleFontLink: string;
144
+ }>>;
145
+ };
146
+ googlePayButtonParams: {
147
+ type: import("vue").PropType<Omit<Partial<{
148
+ enabled: false;
149
+ containerId: string;
150
+ color: string;
151
+ type: string;
152
+ }> | undefined, "containerId">>;
153
+ };
154
+ applePayButtonParams: {
155
+ type: import("vue").PropType<Omit<Partial<{
156
+ enabled: false;
157
+ containerId: string;
158
+ color: string;
159
+ type: string;
160
+ }> | undefined, "containerId">>;
161
+ };
162
+ googlePayContainerRef: {
163
+ type: import("vue").PropType<HTMLDivElement>;
164
+ };
165
+ applePayContainerRef: {
166
+ type: import("vue").PropType<HTMLDivElement>;
167
+ };
168
+ onReadyPaymentInstance: {
169
+ type: import("vue").PropType<(paymentInstance: import("@solidgate/client-sdk-loader").ClientSdkInstance) => void>;
170
+ };
171
+ onMounted: {
172
+ type: import("vue").PropType<(e: MountedMessage) => void>;
173
+ } & {
174
+ default: () => void;
175
+ };
176
+ onError: {
177
+ type: import("vue").PropType<(e: ErrorMessage) => void>;
178
+ } & {
179
+ default: () => void;
180
+ };
181
+ onSuccess: {
182
+ type: import("vue").PropType<(e: SuccessMessage) => void>;
183
+ } & {
184
+ default: () => void;
185
+ };
186
+ onFail: {
187
+ type: import("vue").PropType<(e: FailMessage) => void>;
188
+ } & {
189
+ default: () => void;
190
+ };
191
+ onSubmit: {
192
+ type: import("vue").PropType<(e: SubmitMessage) => void>;
193
+ } & {
194
+ default: () => void;
195
+ };
196
+ onVerify: {
197
+ type: import("vue").PropType<(e: SdkMessage[MessageType.Verify]) => void>;
198
+ } & {
199
+ default: () => void;
200
+ };
201
+ onCustomStylesAppended: {
202
+ type: import("vue").PropType<(e: SdkMessage[MessageType.CustomStylesAppended]) => void>;
203
+ } & {
204
+ default: () => void;
205
+ };
206
+ onFormRedirect: {
207
+ type: import("vue").PropType<(e: SdkMessage[MessageType.Redirect]) => void>;
208
+ } & {
209
+ default: () => void;
210
+ };
211
+ onInteraction: {
212
+ type: import("vue").PropType<(e: InteractionMessage) => void>;
213
+ } & {
214
+ default: () => void;
215
+ };
216
+ onOrderStatus: {
217
+ type: import("vue").PropType<(e: OrderStatusMessage) => void>;
218
+ } & {
219
+ default: () => void;
220
+ };
221
+ onResize: {
222
+ type: import("vue").PropType<(e: ResizeMessage) => void>;
223
+ } & {
224
+ default: () => void;
225
+ };
226
+ }>>, {
227
+ onError: (e: ErrorMessage) => void;
228
+ onSubmit: (e: SubmitMessage) => void;
229
+ onFail: (e: FailMessage) => void;
230
+ onMounted: (e: MountedMessage) => void;
231
+ onOrderStatus: (e: OrderStatusMessage) => void;
232
+ onResize: (e: ResizeMessage) => void;
233
+ onSuccess: (e: SuccessMessage) => void;
234
+ onInteraction: (e: InteractionMessage) => void;
235
+ onVerify: (e: SdkMessage[MessageType.Verify]) => void;
236
+ onFormRedirect: (e: SdkMessage[MessageType.Redirect]) => void;
237
+ onCustomStylesAppended: (e: SdkMessage[MessageType.CustomStylesAppended]) => void;
238
+ }>;
239
+ export default _default;
@@ -0,0 +1,4 @@
1
+ declare const IFRAME_CONTAINER_ID: string;
2
+ declare const GOOGLE_PAY_BUTTON_CONTAINER_ID: string;
3
+ declare const APPLE_PAY_BUTTON_CONTAINER_ID: string;
4
+ export { IFRAME_CONTAINER_ID, GOOGLE_PAY_BUTTON_CONTAINER_ID, APPLE_PAY_BUTTON_CONTAINER_ID };
@@ -0,0 +1,3 @@
1
+ import Payment from './Payment.vue';
2
+ export * from '@solidgate/client-sdk-loader';
3
+ export default Payment;
@@ -0,0 +1,14 @@
1
+ import { ClientSdkInstance, InitConfig } from '@solidgate/client-sdk-loader';
2
+ import ClientSdkEventsProvider from '../types/ClientSdkEventsProvider';
3
+ interface PaymentProps extends Partial<ClientSdkEventsProvider> {
4
+ merchantData: InitConfig['merchantData'];
5
+ width?: string;
6
+ styles?: InitConfig['styles'];
7
+ formParams?: InitConfig['formParams'];
8
+ googlePayButtonParams?: Omit<InitConfig['googlePayButtonParams'], 'containerId'>;
9
+ applePayButtonParams?: Omit<InitConfig['applePayButtonParams'], 'containerId'>;
10
+ googlePayContainerRef?: HTMLDivElement;
11
+ applePayContainerRef?: HTMLDivElement;
12
+ onReadyPaymentInstance?: (paymentInstance: ClientSdkInstance) => void;
13
+ }
14
+ export default PaymentProps;
@@ -0,0 +1,5 @@
1
+ import { SdkMessage } from '@solidgate/client-sdk-loader';
2
+ declare type ClientSdkEventsProvider = {
3
+ [key in keyof SdkMessage as `on${Capitalize<key>}`]: (e: SdkMessage[key]) => void;
4
+ };
5
+ export default ClientSdkEventsProvider;
@@ -0,0 +1,3 @@
1
+ import { InitConfig } from '@solidgate/client-sdk-loader';
2
+ declare function getPayButtonParams<T extends 'googlePayButtonParams' | 'applePayButtonParams'>(config: InitConfig, key: T, container: HTMLElement | undefined): NonNullable<InitConfig[T]> | undefined;
3
+ export default getPayButtonParams;
@@ -0,0 +1,4 @@
1
+ import { ClientSdkInstance } from '@solidgate/client-sdk-loader';
2
+ import PaymentProps from '../interfaces/PaymentProps';
3
+ declare const initClientSdk: (props: PaymentProps) => Promise<ClientSdkInstance>;
4
+ export default initClientSdk;
@@ -0,0 +1,4 @@
1
+ import { ClientSdkInstance } from '@solidgate/client-sdk-loader';
2
+ import ClientSdkEventsProvider from '../types/ClientSdkEventsProvider';
3
+ declare const onSubscribe: (sdkInstanceValue: ClientSdkInstance, props: ClientSdkEventsProvider) => void;
4
+ export default onSubscribe;