@solidgate/vue-sdk 1.33.0 → 1.35.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
@@ -110,6 +110,52 @@ To render <a href="https://docs.solidgate.com/payments/integrate/payment-form/go
110
110
  </script>
111
111
  ```
112
112
 
113
+ #### Wallet card type
114
+
115
+ Apple Pay and Google Pay report the payer's card funding type before the charge. Handle
116
+ `walletCardType` to inspect it and, optionally, pause the wallet flow with `pauseUntil`
117
+ while you call an update intent method (`update`, `updateCheckout`). The side effect has
118
+ a 25 s budget, measured from the moment the event fired.
119
+
120
+ ```vue
121
+ <template>
122
+ <Payment
123
+ :merchant-data="merchantData"
124
+ :google-pay-button-params="googlePayButtonParams"
125
+ :on-wallet-card-type="onWalletCardType"
126
+ @ready-payment-instance="form = $event"
127
+ />
128
+ </template>
129
+
130
+ <script lang="ts" setup>
131
+ import { ref } from 'vue'
132
+ import Payment, {
133
+ ClientSdkInstance,
134
+ InitConfig,
135
+ WalletCardTypeCallback
136
+ } from '@solidgate/vue-sdk'
137
+
138
+ const form = ref<ClientSdkInstance>()
139
+
140
+ // required when you update the intent inside the event
141
+ const googlePayButtonParams: InitConfig['googlePayButtonParams'] = {
142
+ totalPriceStatus: 'TOTAL_PRICE_STATUS_ESTIMATED'
143
+ }
144
+
145
+ const onWalletCardType: WalletCardTypeCallback = (data, pauseUntil) => {
146
+ if (data.card.type === 'unknown') {
147
+ return // no intent update - the wallet continues immediately
148
+ }
149
+
150
+ pauseUntil(async () => {
151
+ await form.value?.update({ partialIntent: intentFor(data.card.type) })
152
+ })
153
+ }
154
+ </script>
155
+ ```
156
+
157
+ `@wallet-card-type="onWalletCardType"` binds the same prop, so either style works.
158
+
113
159
  ### Resign form
114
160
 
115
161
  Render a <a href="https://docs.solidgate.com/payments/integrate/payment-form/resign-payment-form/" target="_blank">resign payment form</a> component in your Vue3 project.
@@ -1,5 +1,6 @@
1
1
  /** __vue_virtual_code_placeholder */
2
2
  import { CustomStylesAppendedMessage, PaymentDetailsMessage, OrderStatusMessage, InteractionMessage, RedirectMessage, MountedMessage, SuccessMessage, ResizeMessage, VerifyMessage, SubmitMessage, ErrorMessage, FailMessage, CardMessage, ClientSdkInstance } from '@solidgate/client-sdk-loader';
3
+ import { WalletCardTypeCallback } from './types/ClientSdkEventsProvider';
3
4
  import './boot';
4
5
  declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
5
6
  merchantData: {
@@ -45,6 +46,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
45
46
  containerId: string;
46
47
  color: string;
47
48
  type: string;
49
+ totalPriceStatus: "TOTAL_PRICE_STATUS_FINAL" | "TOTAL_PRICE_STATUS_ESTIMATED";
48
50
  }> | undefined, "containerId"> | undefined;
49
51
  applePayButtonParams?: Omit<Partial<{
50
52
  enabled: boolean;
@@ -118,6 +120,12 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
118
120
  resetEnabled?: boolean | undefined;
119
121
  } | undefined, "containerId"> | undefined;
120
122
  pixAutomaticoContainerRef?: HTMLDivElement | undefined;
123
+ clickToPayButtonParams?: {
124
+ enabled?: boolean | undefined;
125
+ height?: number | undefined;
126
+ saveRecognitionToken?: boolean | undefined;
127
+ supportedCardNetworks?: ("visa" | "mastercard" | "discover" | "amex")[] | undefined;
128
+ } | undefined;
121
129
  onReadyPaymentInstance?: ((paymentInstance: ClientSdkInstance) => void) | undefined;
122
130
  onPaymentDetails?: ((e: PaymentDetailsMessage) => void) | undefined;
123
131
  onMounted?: ((e: MountedMessage) => void) | undefined;
@@ -132,6 +140,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
132
140
  onOrderStatus?: ((e: OrderStatusMessage) => void) | undefined;
133
141
  onResize?: ((e: ResizeMessage) => void) | undefined;
134
142
  onCard?: ((e: CardMessage) => void) | undefined;
143
+ onWalletCardType?: WalletCardTypeCallback | undefined;
135
144
  }>, {
136
145
  onMounted: () => void;
137
146
  onError: () => void;
@@ -146,6 +155,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
146
155
  onOrderStatus: () => void;
147
156
  onResize: () => void;
148
157
  onCard: () => void;
158
+ onWalletCardType: () => void;
149
159
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
150
160
  mounted: (event: MountedMessage) => void;
151
161
  error: (payload: ErrorMessage) => void;
@@ -205,6 +215,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
205
215
  containerId: string;
206
216
  color: string;
207
217
  type: string;
218
+ totalPriceStatus: "TOTAL_PRICE_STATUS_FINAL" | "TOTAL_PRICE_STATUS_ESTIMATED";
208
219
  }> | undefined, "containerId"> | undefined;
209
220
  applePayButtonParams?: Omit<Partial<{
210
221
  enabled: boolean;
@@ -278,6 +289,12 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
278
289
  resetEnabled?: boolean | undefined;
279
290
  } | undefined, "containerId"> | undefined;
280
291
  pixAutomaticoContainerRef?: HTMLDivElement | undefined;
292
+ clickToPayButtonParams?: {
293
+ enabled?: boolean | undefined;
294
+ height?: number | undefined;
295
+ saveRecognitionToken?: boolean | undefined;
296
+ supportedCardNetworks?: ("visa" | "mastercard" | "discover" | "amex")[] | undefined;
297
+ } | undefined;
281
298
  onReadyPaymentInstance?: ((paymentInstance: ClientSdkInstance) => void) | undefined;
282
299
  onPaymentDetails?: ((e: PaymentDetailsMessage) => void) | undefined;
283
300
  onMounted?: ((e: MountedMessage) => void) | undefined;
@@ -292,6 +309,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
292
309
  onOrderStatus?: ((e: OrderStatusMessage) => void) | undefined;
293
310
  onResize?: ((e: ResizeMessage) => void) | undefined;
294
311
  onCard?: ((e: CardMessage) => void) | undefined;
312
+ onWalletCardType?: WalletCardTypeCallback | undefined;
295
313
  }>, {
296
314
  onMounted: () => void;
297
315
  onError: () => void;
@@ -306,6 +324,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
306
324
  onOrderStatus: () => void;
307
325
  onResize: () => void;
308
326
  onCard: () => void;
327
+ onWalletCardType: () => void;
309
328
  }>>> & {
310
329
  onError?: ((payload: ErrorMessage) => any) | undefined;
311
330
  onSubmit?: ((payload: SubmitMessage) => any) | undefined;
@@ -335,6 +354,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
335
354
  onCustomStylesAppended: (e: CustomStylesAppendedMessage) => void;
336
355
  onCard: (e: CardMessage) => void;
337
356
  onPaymentDetails: (e: PaymentDetailsMessage) => void;
357
+ onWalletCardType: WalletCardTypeCallback;
338
358
  }, {}>;
339
359
  export default _default;
340
360
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- .payment-form-container[data-v-cb1259ac] iframe,.payment-form-container[data-v-77b30339] iframe{border:none}
1
+ .payment-form-container[data-v-4eef598f] iframe,.payment-form-container[data-v-77b30339] iframe{border:none}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import Payment from './Payment.vue';
2
2
  export * from '@solidgate/client-sdk-loader';
3
+ export type { WalletCardTypeCallback } from './types/ClientSdkEventsProvider';
3
4
  export default Payment;
4
5
  export { default as Resign } from './Resign.vue';
package/dist/index.es.js CHANGED
@@ -97,6 +97,7 @@ var PayableEntity;
97
97
  PayableEntity2["Mbway"] = "mbway";
98
98
  PayableEntity2["CashApp"] = "cashapp";
99
99
  PayableEntity2["PixAutomatico"] = "pix-automatico";
100
+ PayableEntity2["ClickToPay"] = "clicktopay";
100
101
  })(PayableEntity || (PayableEntity = {}));
101
102
  var PayableEntity$1 = PayableEntity;
102
103
  var InteractionType;
@@ -310,7 +311,8 @@ const initPaymentForm = async (props) => {
310
311
  mbwayContainerRef,
311
312
  pixQrContainerRef,
312
313
  cashAppContainerRef,
313
- pixAutomaticoContainerRef
314
+ pixAutomaticoContainerRef,
315
+ clickToPayButtonParams
314
316
  } = props;
315
317
  if (!merchantData) {
316
318
  throw new Error("Attribute 'merchantData' is required");
@@ -326,7 +328,8 @@ const initPaymentForm = async (props) => {
326
328
  ...width && { width }
327
329
  },
328
330
  ...formParams && { formParams },
329
- ...styles && { styles }
331
+ ...styles && { styles },
332
+ ...clickToPayButtonParams && { clickToPayButtonParams }
330
333
  };
331
334
  const googleButtonParams = getPayButtonParams(
332
335
  props,
@@ -418,6 +421,7 @@ const initPaymentForm = async (props) => {
418
421
  }
419
422
  return clientSdk.init(initConfig);
420
423
  };
424
+ const WALLET_CARD_TYPE_EVENT = "walletCardType";
421
425
  const onSubscribe = (sdkInstanceValue, callbacks) => {
422
426
  const {
423
427
  onMounted: onMounted2 = () => {
@@ -445,6 +449,8 @@ const onSubscribe = (sdkInstanceValue, callbacks) => {
445
449
  onResize = () => {
446
450
  },
447
451
  onCard = () => {
452
+ },
453
+ onWalletCardType = () => {
448
454
  }
449
455
  } = callbacks;
450
456
  sdkInstanceValue.on(MessageType$1.Mounted, (e) => onMounted2(e.data));
@@ -466,6 +472,10 @@ const onSubscribe = (sdkInstanceValue, callbacks) => {
466
472
  sdkInstanceValue.on(MessageType$1.OrderStatus, (e) => onOrderStatus(e.data));
467
473
  sdkInstanceValue.on(MessageType$1.Resize, (e) => onResize(e.data));
468
474
  sdkInstanceValue.on(MessageType$1.Card, (e) => onCard(e.data));
475
+ sdkInstanceValue.on(
476
+ WALLET_CARD_TYPE_EVENT,
477
+ (event, pauseUntil) => onWalletCardType(event.data, pauseUntil)
478
+ );
469
479
  };
470
480
  const sdkInitType = "vue";
471
481
  window.__SOLIDGATE_PRIVATE__SDK_INIT_TYPE = sdkInitType;
@@ -507,6 +517,7 @@ const _sfc_main$1 = defineComponent({
507
517
  cashAppContainerRef: {},
508
518
  pixAutomaticoButtonParams: {},
509
519
  pixAutomaticoContainerRef: {},
520
+ clickToPayButtonParams: {},
510
521
  onReadyPaymentInstance: {},
511
522
  onPaymentDetails: { type: Function, default: () => {
512
523
  } },
@@ -533,6 +544,8 @@ const _sfc_main$1 = defineComponent({
533
544
  onResize: { type: Function, default: () => {
534
545
  } },
535
546
  onCard: { type: Function, default: () => {
547
+ } },
548
+ onWalletCardType: { default: () => {
536
549
  } }
537
550
  },
538
551
  emits: ["mounted", "error", "success", "fail", "submit", "verify", "customStylesAppended", "paymentDetails", "formRedirect", "interaction", "orderStatus", "resize", "card", "readyPaymentInstance"],
@@ -555,6 +568,7 @@ const _sfc_main$1 = defineComponent({
555
568
  pixQrButtonParams: props.pixQrButtonParams,
556
569
  cashAppButtonParams: props.cashAppButtonParams,
557
570
  pixAutomaticoButtonParams: props.pixAutomaticoButtonParams,
571
+ clickToPayButtonParams: props.clickToPayButtonParams,
558
572
  googlePayContainerRef: props.googlePayContainerRef,
559
573
  applePayContainerRef: props.applePayContainerRef,
560
574
  paypalContainerRef: props.paypalContainerRef,
@@ -580,7 +594,8 @@ const _sfc_main$1 = defineComponent({
580
594
  onInteraction: (e) => props.onInteraction && props.onInteraction(e),
581
595
  onOrderStatus: (e) => props.onOrderStatus && props.onOrderStatus(e),
582
596
  onResize: (e) => props.onResize && props.onResize(e),
583
- onCard: (e) => props.onCard && props.onCard(e)
597
+ onCard: (e) => props.onCard && props.onCard(e),
598
+ onWalletCardType: (data, pauseUntil) => props.onWalletCardType && props.onWalletCardType(data, pauseUntil)
584
599
  };
585
600
  onMounted(async () => {
586
601
  var _a2;
@@ -610,7 +625,7 @@ const _sfc_main$1 = defineComponent({
610
625
  };
611
626
  }
612
627
  });
613
- var Payment = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-cb1259ac"]]);
628
+ var Payment = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-4eef598f"]]);
614
629
  const initResignForm = async (config) => {
615
630
  if (!config.resignRequest) {
616
631
  throw new Error("Attribute 'resignRequest' is required");
@@ -1,5 +1,5 @@
1
1
  import { ClientSdkInstance, InitConfig } from '@solidgate/client-sdk-loader';
2
- import ClientSdkEventsProvider from '../types/ClientSdkEventsProvider';
2
+ import ClientSdkEventsProvider, { WalletCardTypeCallback } from '../types/ClientSdkEventsProvider';
3
3
  interface PaymentProps extends Partial<ClientSdkEventsProvider> {
4
4
  merchantData: InitConfig['merchantData'];
5
5
  width?: string;
@@ -16,6 +16,7 @@ interface PaymentProps extends Partial<ClientSdkEventsProvider> {
16
16
  pixQrButtonParams?: Omit<InitConfig['pixQrButtonParams'], 'containerId'>;
17
17
  cashAppButtonParams?: Omit<InitConfig['cashAppButtonParams'], 'containerId'>;
18
18
  pixAutomaticoButtonParams?: Omit<InitConfig['pixAutomaticoButtonParams'], 'containerId'>;
19
+ clickToPayButtonParams?: InitConfig['clickToPayButtonParams'];
19
20
  googlePayContainerRef?: HTMLDivElement;
20
21
  applePayContainerRef?: HTMLDivElement;
21
22
  paypalContainerRef?: HTMLDivElement;
@@ -27,6 +28,7 @@ interface PaymentProps extends Partial<ClientSdkEventsProvider> {
27
28
  pixQrContainerRef?: HTMLDivElement;
28
29
  cashAppContainerRef?: HTMLDivElement;
29
30
  pixAutomaticoContainerRef?: HTMLDivElement;
31
+ onWalletCardType?: WalletCardTypeCallback;
30
32
  onReadyPaymentInstance?: (paymentInstance: ClientSdkInstance) => void;
31
33
  }
32
34
  export default PaymentProps;
@@ -1,5 +1,6 @@
1
- import { SdkMessage } from '@solidgate/client-sdk-loader';
1
+ import { SdkMessage, WalletCardTypeEventData, WalletCardTypeSideEffect } from '@solidgate/client-sdk-loader';
2
2
  type ClientSdkEventsProvider = {
3
3
  [key in keyof SdkMessage as `on${Capitalize<key>}`]: (e: SdkMessage[key]) => void;
4
4
  };
5
+ export type WalletCardTypeCallback = (data: WalletCardTypeEventData, pauseUntil: (sideEffect: WalletCardTypeSideEffect) => void) => void;
5
6
  export default ClientSdkEventsProvider;
@@ -1,4 +1,7 @@
1
1
  import { ClientSdkInstance } from '@solidgate/client-sdk-loader';
2
- import ClientSdkEventsProvider from '../types/ClientSdkEventsProvider';
3
- declare const onSubscribe: (sdkInstanceValue: ClientSdkInstance, callbacks: Partial<ClientSdkEventsProvider>) => void;
2
+ import ClientSdkEventsProvider, { WalletCardTypeCallback } from '../types/ClientSdkEventsProvider';
3
+ export declare const WALLET_CARD_TYPE_EVENT = "walletCardType";
4
+ declare const onSubscribe: (sdkInstanceValue: ClientSdkInstance, callbacks: Partial<ClientSdkEventsProvider> & {
5
+ onWalletCardType?: WalletCardTypeCallback;
6
+ }) => void;
4
7
  export default onSubscribe;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidgate/vue-sdk",
3
- "version": "1.33.0",
3
+ "version": "1.35.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.33.0"
31
+ "@solidgate/client-sdk-loader": "^1.35.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/types": "^7.24.5",