@solidgate/vue-sdk 1.10.0 → 1.11.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 CHANGED
@@ -35,16 +35,18 @@ const merchantData: InitConfig['merchantData'] = {
35
35
  </script>
36
36
  ```
37
37
 
38
- In order to render google/apple button in custom container define Payment as async component and pass link to container element
38
+ In order to render google/apple/paypal button in custom container define Payment as async component and pass link to container element
39
39
  ```vue
40
40
  <template>
41
41
  <Payment
42
42
  :merchan-data="merchantData"
43
43
  :google-pay-container-ref="googleButton"
44
44
  :apple-pay-container-ref="appleButton"
45
+ :paypal-container-ref="paypalButton"
45
46
  />
46
47
  <div ref="googleButton" />
47
48
  <div ref="appleButton" />
49
+ <div ref="paypalButton" />
48
50
  </template>
49
51
 
50
52
  <script lang="ts" setup>
@@ -54,6 +56,7 @@ const Payment = defineAsyncComponent(() => import('@solidgate/vue-sdk'))
54
56
 
55
57
  const googleButton = ref<HTMLDivElement>()
56
58
  const appleButton = ref<HTMLDivElement>()
59
+ const paypalButton = ref<HTMLDivElement>()
57
60
 
58
61
  const merchantData: InitConfig['merchantData'] = {
59
62
  merchant: '<<--YOUR MERCHANT ID-->>',
@@ -50,8 +50,17 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
50
50
  color: string;
51
51
  type: string;
52
52
  }> | undefined, "containerId"> | undefined;
53
+ paypalButtonParams?: Omit<{
54
+ enabled?: boolean | undefined;
55
+ containerId?: string | undefined;
56
+ color?: "black" | "blue" | "gold" | "silver" | undefined;
57
+ shape?: "rect" | "pill" | "sharp" | undefined;
58
+ label?: "paypal" | "checkout" | "buynow" | "pay" | "installment" | undefined;
59
+ height?: number | undefined;
60
+ } | undefined, "containerId"> | undefined;
53
61
  googlePayContainerRef?: HTMLDivElement | undefined;
54
62
  applePayContainerRef?: HTMLDivElement | undefined;
63
+ paypalContainerRef?: HTMLDivElement | undefined;
55
64
  onReadyPaymentInstance?: ((paymentInstance: ClientSdkInstance) => void) | undefined;
56
65
  onMounted?: ((e: MountedMessage) => void) | undefined;
57
66
  onError?: ((e: ErrorMessage) => void) | undefined;
@@ -141,8 +150,17 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
141
150
  color: string;
142
151
  type: string;
143
152
  }> | undefined, "containerId"> | undefined;
153
+ paypalButtonParams?: Omit<{
154
+ enabled?: boolean | undefined;
155
+ containerId?: string | undefined;
156
+ color?: "black" | "blue" | "gold" | "silver" | undefined;
157
+ shape?: "rect" | "pill" | "sharp" | undefined;
158
+ label?: "paypal" | "checkout" | "buynow" | "pay" | "installment" | undefined;
159
+ height?: number | undefined;
160
+ } | undefined, "containerId"> | undefined;
144
161
  googlePayContainerRef?: HTMLDivElement | undefined;
145
162
  applePayContainerRef?: HTMLDivElement | undefined;
163
+ paypalContainerRef?: HTMLDivElement | undefined;
146
164
  onReadyPaymentInstance?: ((paymentInstance: ClientSdkInstance) => void) | undefined;
147
165
  onMounted?: ((e: MountedMessage) => void) | undefined;
148
166
  onError?: ((e: ErrorMessage) => void) | undefined;
@@ -1,4 +1,5 @@
1
1
  declare const IFRAME_CONTAINER_ID: string;
2
2
  declare const GOOGLE_PAY_BUTTON_CONTAINER_ID: string;
3
3
  declare const APPLE_PAY_BUTTON_CONTAINER_ID: string;
4
- export { IFRAME_CONTAINER_ID, GOOGLE_PAY_BUTTON_CONTAINER_ID, APPLE_PAY_BUTTON_CONTAINER_ID };
4
+ declare const PAYPAL_BUTTON_CONTAINER_ID: string;
5
+ export { IFRAME_CONTAINER_ID, GOOGLE_PAY_BUTTON_CONTAINER_ID, APPLE_PAY_BUTTON_CONTAINER_ID, PAYPAL_BUTTON_CONTAINER_ID };
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- .payment-form-container[data-v-1bdf8589] iframe,.payment-form-container[data-v-88c87bb0] iframe{border:none}
1
+ .payment-form-container[data-v-068d34c2] iframe,.payment-form-container[data-v-88c87bb0] iframe{border:none}
package/dist/index.es.js CHANGED
@@ -2,6 +2,7 @@ import { defineComponent, ref, onMounted, onUnmounted, watch, isReactive, openBl
2
2
  import './index.css';const IFRAME_CONTAINER_ID = `solid-payment-form-container_#${Math.random() * 1e4}`;
3
3
  const GOOGLE_PAY_BUTTON_CONTAINER_ID = `google-pay-button-container_#${Math.random() * 1e4}`;
4
4
  const APPLE_PAY_BUTTON_CONTAINER_ID = `apple-pay-button-container_#${Math.random() * 1e4}`;
5
+ const PAYPAL_BUTTON_CONTAINER_ID = `paypal-button-container_#${Math.random() * 1e4}`;
5
6
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
6
7
  var dist = {};
7
8
  var MessageType$2 = {};
@@ -94,6 +95,7 @@ var PayableEntity$1;
94
95
  PayableEntity2["GooglePay"] = "googlebtn";
95
96
  PayableEntity2["Form"] = "form";
96
97
  PayableEntity2["Resign"] = "resign";
98
+ PayableEntity2["Paypal"] = "paypal";
97
99
  })(PayableEntity$1 || (PayableEntity$1 = {}));
98
100
  PayableEntity$2.default = PayableEntity$1;
99
101
  var InteractionType$2 = {};
@@ -185,6 +187,9 @@ var _a, _SdkLoader_CloudfrontSrc, _SdkLoader_loadAttempt;
185
187
  Object.defineProperty(SdkLoader$2, "__esModule", { value: true });
186
188
  class SdkLoader$1 {
187
189
  static load() {
190
+ if (typeof window === "undefined" || typeof document === "undefined") {
191
+ return Promise.resolve(null);
192
+ }
188
193
  if (window.PaymentFormSdk) {
189
194
  return Promise.resolve(window.PaymentFormSdk);
190
195
  }
@@ -251,6 +256,10 @@ const payButtonIds = {
251
256
  applePayButtonParams: {
252
257
  title: "ApplePay",
253
258
  id: APPLE_PAY_BUTTON_CONTAINER_ID
259
+ },
260
+ paypalButtonParams: {
261
+ title: "PayPal",
262
+ id: PAYPAL_BUTTON_CONTAINER_ID
254
263
  }
255
264
  };
256
265
  function getPayButtonParams(config, key, container) {
@@ -281,12 +290,16 @@ const initPaymentForm = async (props) => {
281
290
  styles,
282
291
  formParams,
283
292
  googlePayContainerRef,
284
- applePayContainerRef
293
+ applePayContainerRef,
294
+ paypalContainerRef
285
295
  } = props;
286
296
  if (!merchantData) {
287
297
  throw new Error("Attribute 'merchantData' is required");
288
298
  }
289
299
  const clientSdk = await SdkLoader.load();
300
+ if (!clientSdk) {
301
+ return null;
302
+ }
290
303
  const initConfig = {
291
304
  merchantData,
292
305
  iframeParams: {
@@ -312,6 +325,14 @@ const initPaymentForm = async (props) => {
312
325
  if (appleButtonParams) {
313
326
  initConfig.applePayButtonParams = appleButtonParams;
314
327
  }
328
+ const paypalButtonParams = getPayButtonParams(
329
+ props,
330
+ "paypalButtonParams",
331
+ paypalContainerRef
332
+ );
333
+ if (paypalButtonParams) {
334
+ initConfig.paypalButtonParams = paypalButtonParams;
335
+ }
315
336
  return clientSdk.init(initConfig);
316
337
  };
317
338
  const onSubscribe = (sdkInstanceValue, callbacks) => {
@@ -377,8 +398,10 @@ const _sfc_main$1 = defineComponent({
377
398
  formParams: {},
378
399
  googlePayButtonParams: {},
379
400
  applePayButtonParams: {},
401
+ paypalButtonParams: {},
380
402
  googlePayContainerRef: {},
381
403
  applePayContainerRef: {},
404
+ paypalContainerRef: {},
382
405
  onReadyPaymentInstance: {},
383
406
  onMounted: { type: Function, default: () => {
384
407
  } },
@@ -416,8 +439,10 @@ const _sfc_main$1 = defineComponent({
416
439
  formParams: props.formParams,
417
440
  googlePayButtonParams: props.googlePayButtonParams,
418
441
  applePayButtonParams: props.applePayButtonParams,
442
+ paypalButtonParams: props.paypalButtonParams,
419
443
  googlePayContainerRef: props.googlePayContainerRef,
420
- applePayContainerRef: props.applePayContainerRef
444
+ applePayContainerRef: props.applePayContainerRef,
445
+ paypalContainerRef: props.paypalContainerRef
421
446
  };
422
447
  const callbacks = {
423
448
  onMounted: (e) => props.onMounted && props.onMounted(e),
@@ -461,12 +486,15 @@ const _sfc_main$1 = defineComponent({
461
486
  };
462
487
  }
463
488
  });
464
- var Payment = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-1bdf8589"]]);
489
+ var Payment = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-068d34c2"]]);
465
490
  const initResignForm = async (config) => {
466
491
  if (!config.resignRequest) {
467
492
  throw new Error("Attribute 'resignRequest' is required");
468
493
  }
469
494
  const clientSdk = await SdkLoader.load();
495
+ if (!clientSdk) {
496
+ return null;
497
+ }
470
498
  const { appearance, styles, container } = config;
471
499
  const formConfig = {
472
500
  container: {
@@ -7,8 +7,10 @@ interface PaymentProps extends Partial<ClientSdkEventsProvider> {
7
7
  formParams?: InitConfig['formParams'];
8
8
  googlePayButtonParams?: Omit<InitConfig['googlePayButtonParams'], 'containerId'>;
9
9
  applePayButtonParams?: Omit<InitConfig['applePayButtonParams'], 'containerId'>;
10
+ paypalButtonParams?: Omit<InitConfig['paypalButtonParams'], 'containerId'>;
10
11
  googlePayContainerRef?: HTMLDivElement;
11
12
  applePayContainerRef?: HTMLDivElement;
13
+ paypalContainerRef?: HTMLDivElement;
12
14
  onReadyPaymentInstance?: (paymentInstance: ClientSdkInstance) => void;
13
15
  }
14
16
  export default PaymentProps;
@@ -1,3 +1,3 @@
1
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;
2
+ declare function getPayButtonParams<T extends 'googlePayButtonParams' | 'applePayButtonParams' | 'paypalButtonParams'>(config: InitConfig, key: T, container: HTMLElement | undefined): NonNullable<InitConfig[T]> | undefined;
3
3
  export default getPayButtonParams;
@@ -1,4 +1,4 @@
1
1
  import { ClientSdkInstance } from '@solidgate/client-sdk-loader';
2
2
  import PaymentProps from '../interfaces/PaymentProps';
3
- declare const initPaymentForm: (props: PaymentProps) => Promise<ClientSdkInstance>;
3
+ declare const initPaymentForm: (props: PaymentProps) => Promise<ClientSdkInstance | null>;
4
4
  export default initPaymentForm;
@@ -4,5 +4,5 @@ declare const initResignForm: (config: {
4
4
  appearance?: ResignFormConfig['appearance'];
5
5
  container?: ResignFormConfig['container'];
6
6
  styles?: ResignFormConfig['styles'];
7
- }) => Promise<ClientSdkInstance>;
7
+ }) => Promise<ClientSdkInstance | null>;
8
8
  export default initResignForm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidgate/vue-sdk",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "repository": "https://github.com/solidgate-tech/vue-sdk",
5
5
  "files": [
6
6
  "dist"
@@ -28,7 +28,7 @@
28
28
  "vue": "^3.2.25"
29
29
  },
30
30
  "dependencies": {
31
- "@solidgate/client-sdk-loader": "^1.8.0"
31
+ "@solidgate/client-sdk-loader": "^1.10.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/types": "^7.24.5",