@solidgate/vue-sdk 1.34.0 → 1.36.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 +89 -0
- package/dist/Payment.vue.d.ts +16 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +24 -4
- package/dist/interfaces/PaymentProps.d.ts +2 -1
- package/dist/interfaces/ResignProps.d.ts +1 -1
- package/dist/types/ClientSdkEventsProvider.d.ts +2 -1
- package/dist/utils/onSubscribe.d.ts +5 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -110,6 +110,95 @@ 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
|
+
|
|
159
|
+
#### Checkout updates
|
|
160
|
+
|
|
161
|
+
Change the checkout line items, discounts or subscription data after the form is mounted
|
|
162
|
+
with `updateCheckout`.
|
|
163
|
+
|
|
164
|
+
The invoice preview itself arrives through the `invoicePreview` event. It is sent by the
|
|
165
|
+
SDK during the form initialization process.
|
|
166
|
+
|
|
167
|
+
```vue
|
|
168
|
+
<template>
|
|
169
|
+
<Payment
|
|
170
|
+
:merchant-data="merchantData"
|
|
171
|
+
@invoice-preview="onInvoicePreview"
|
|
172
|
+
@ready-payment-instance="form = $event"
|
|
173
|
+
/>
|
|
174
|
+
</template>
|
|
175
|
+
|
|
176
|
+
<script lang="ts" setup>
|
|
177
|
+
import { ref } from 'vue'
|
|
178
|
+
import Payment, {
|
|
179
|
+
ClientSdkInstance,
|
|
180
|
+
InvoicePreviewMessage,
|
|
181
|
+
UpdateCheckoutConfig
|
|
182
|
+
} from '@solidgate/vue-sdk'
|
|
183
|
+
|
|
184
|
+
const form = ref<ClientSdkInstance>()
|
|
185
|
+
|
|
186
|
+
const onInvoicePreview = (e: InvoicePreviewMessage) => {
|
|
187
|
+
console.log(e.invoicePreview.total, e.invoicePreview.currency)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const changeQuantity = async (quantity: number) => {
|
|
191
|
+
const config: UpdateCheckoutConfig = {
|
|
192
|
+
lineItems: [{ productPriceId: 'price_id', quantity }]
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
await form.value!.updateCheckout(config)
|
|
196
|
+
}
|
|
197
|
+
</script>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`:on-invoice-preview="onInvoicePreview"` binds the same prop, so either style works.
|
|
201
|
+
|
|
113
202
|
### Resign form
|
|
114
203
|
|
|
115
204
|
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.
|
package/dist/Payment.vue.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** __vue_virtual_code_placeholder */
|
|
2
|
-
import { CustomStylesAppendedMessage, PaymentDetailsMessage, OrderStatusMessage, InteractionMessage, RedirectMessage, MountedMessage, SuccessMessage, ResizeMessage, VerifyMessage, SubmitMessage, ErrorMessage, FailMessage, CardMessage, ClientSdkInstance } from '@solidgate/client-sdk-loader';
|
|
2
|
+
import { CustomStylesAppendedMessage, PaymentDetailsMessage, OrderStatusMessage, InteractionMessage, RedirectMessage, MountedMessage, SuccessMessage, ResizeMessage, VerifyMessage, SubmitMessage, ErrorMessage, FailMessage, CardMessage, InvoicePreviewMessage, 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;
|
|
@@ -138,6 +140,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
138
140
|
onOrderStatus?: ((e: OrderStatusMessage) => void) | undefined;
|
|
139
141
|
onResize?: ((e: ResizeMessage) => void) | undefined;
|
|
140
142
|
onCard?: ((e: CardMessage) => void) | undefined;
|
|
143
|
+
onInvoicePreview?: ((e: InvoicePreviewMessage) => void) | undefined;
|
|
144
|
+
onWalletCardType?: WalletCardTypeCallback | undefined;
|
|
141
145
|
}>, {
|
|
142
146
|
onMounted: () => void;
|
|
143
147
|
onError: () => void;
|
|
@@ -152,6 +156,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
152
156
|
onOrderStatus: () => void;
|
|
153
157
|
onResize: () => void;
|
|
154
158
|
onCard: () => void;
|
|
159
|
+
onInvoicePreview: () => void;
|
|
160
|
+
onWalletCardType: () => void;
|
|
155
161
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
156
162
|
mounted: (event: MountedMessage) => void;
|
|
157
163
|
error: (payload: ErrorMessage) => void;
|
|
@@ -166,6 +172,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
166
172
|
orderStatus: (payload: OrderStatusMessage) => void;
|
|
167
173
|
resize: (payload: ResizeMessage) => void;
|
|
168
174
|
card: (payload: CardMessage) => void;
|
|
175
|
+
invoicePreview: (payload: InvoicePreviewMessage) => void;
|
|
169
176
|
readyPaymentInstance: (payload: ClientSdkInstance) => void;
|
|
170
177
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
171
178
|
merchantData: {
|
|
@@ -211,6 +218,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
211
218
|
containerId: string;
|
|
212
219
|
color: string;
|
|
213
220
|
type: string;
|
|
221
|
+
totalPriceStatus: "TOTAL_PRICE_STATUS_FINAL" | "TOTAL_PRICE_STATUS_ESTIMATED";
|
|
214
222
|
}> | undefined, "containerId"> | undefined;
|
|
215
223
|
applePayButtonParams?: Omit<Partial<{
|
|
216
224
|
enabled: boolean;
|
|
@@ -304,6 +312,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
304
312
|
onOrderStatus?: ((e: OrderStatusMessage) => void) | undefined;
|
|
305
313
|
onResize?: ((e: ResizeMessage) => void) | undefined;
|
|
306
314
|
onCard?: ((e: CardMessage) => void) | undefined;
|
|
315
|
+
onInvoicePreview?: ((e: InvoicePreviewMessage) => void) | undefined;
|
|
316
|
+
onWalletCardType?: WalletCardTypeCallback | undefined;
|
|
307
317
|
}>, {
|
|
308
318
|
onMounted: () => void;
|
|
309
319
|
onError: () => void;
|
|
@@ -318,6 +328,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
318
328
|
onOrderStatus: () => void;
|
|
319
329
|
onResize: () => void;
|
|
320
330
|
onCard: () => void;
|
|
331
|
+
onInvoicePreview: () => void;
|
|
332
|
+
onWalletCardType: () => void;
|
|
321
333
|
}>>> & {
|
|
322
334
|
onError?: ((payload: ErrorMessage) => any) | undefined;
|
|
323
335
|
onSubmit?: ((payload: SubmitMessage) => any) | undefined;
|
|
@@ -332,6 +344,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
332
344
|
onCustomStylesAppended?: ((payload: CustomStylesAppendedMessage) => any) | undefined;
|
|
333
345
|
onCard?: ((payload: CardMessage) => any) | undefined;
|
|
334
346
|
onPaymentDetails?: ((payload: PaymentDetailsMessage) => any) | undefined;
|
|
347
|
+
onInvoicePreview?: ((payload: InvoicePreviewMessage) => any) | undefined;
|
|
335
348
|
onReadyPaymentInstance?: ((payload: ClientSdkInstance) => any) | undefined;
|
|
336
349
|
}, {
|
|
337
350
|
onError: (e: ErrorMessage) => void;
|
|
@@ -347,6 +360,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
347
360
|
onCustomStylesAppended: (e: CustomStylesAppendedMessage) => void;
|
|
348
361
|
onCard: (e: CardMessage) => void;
|
|
349
362
|
onPaymentDetails: (e: PaymentDetailsMessage) => void;
|
|
363
|
+
onInvoicePreview: (e: InvoicePreviewMessage) => void;
|
|
364
|
+
onWalletCardType: WalletCardTypeCallback;
|
|
350
365
|
}, {}>;
|
|
351
366
|
export default _default;
|
|
352
367
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.payment-form-container[data-v-
|
|
1
|
+
.payment-form-container[data-v-0ee8f352] iframe,.payment-form-container[data-v-0726288b] iframe{border:none}
|
package/dist/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -26,6 +26,7 @@ var MessageType;
|
|
|
26
26
|
MessageType2["CustomStylesAppended"] = "customStylesAppended";
|
|
27
27
|
MessageType2["Card"] = "card";
|
|
28
28
|
MessageType2["PaymentDetails"] = "paymentDetails";
|
|
29
|
+
MessageType2["InvoicePreview"] = "invoicePreview";
|
|
29
30
|
})(MessageType || (MessageType = {}));
|
|
30
31
|
var MessageType$1 = MessageType;
|
|
31
32
|
var FieldName;
|
|
@@ -421,6 +422,7 @@ const initPaymentForm = async (props) => {
|
|
|
421
422
|
}
|
|
422
423
|
return clientSdk.init(initConfig);
|
|
423
424
|
};
|
|
425
|
+
const WALLET_CARD_TYPE_EVENT = "walletCardType";
|
|
424
426
|
const onSubscribe = (sdkInstanceValue, callbacks) => {
|
|
425
427
|
const {
|
|
426
428
|
onMounted: onMounted2 = () => {
|
|
@@ -448,6 +450,10 @@ const onSubscribe = (sdkInstanceValue, callbacks) => {
|
|
|
448
450
|
onResize = () => {
|
|
449
451
|
},
|
|
450
452
|
onCard = () => {
|
|
453
|
+
},
|
|
454
|
+
onInvoicePreview = () => {
|
|
455
|
+
},
|
|
456
|
+
onWalletCardType = () => {
|
|
451
457
|
}
|
|
452
458
|
} = callbacks;
|
|
453
459
|
sdkInstanceValue.on(MessageType$1.Mounted, (e) => onMounted2(e.data));
|
|
@@ -469,6 +475,14 @@ const onSubscribe = (sdkInstanceValue, callbacks) => {
|
|
|
469
475
|
sdkInstanceValue.on(MessageType$1.OrderStatus, (e) => onOrderStatus(e.data));
|
|
470
476
|
sdkInstanceValue.on(MessageType$1.Resize, (e) => onResize(e.data));
|
|
471
477
|
sdkInstanceValue.on(MessageType$1.Card, (e) => onCard(e.data));
|
|
478
|
+
sdkInstanceValue.on(
|
|
479
|
+
MessageType$1.InvoicePreview,
|
|
480
|
+
(e) => onInvoicePreview(e.data)
|
|
481
|
+
);
|
|
482
|
+
sdkInstanceValue.on(
|
|
483
|
+
WALLET_CARD_TYPE_EVENT,
|
|
484
|
+
(event, pauseUntil) => onWalletCardType(event.data, pauseUntil)
|
|
485
|
+
);
|
|
472
486
|
};
|
|
473
487
|
const sdkInitType = "vue";
|
|
474
488
|
window.__SOLIDGATE_PRIVATE__SDK_INIT_TYPE = sdkInitType;
|
|
@@ -537,9 +551,13 @@ const _sfc_main$1 = defineComponent({
|
|
|
537
551
|
onResize: { type: Function, default: () => {
|
|
538
552
|
} },
|
|
539
553
|
onCard: { type: Function, default: () => {
|
|
554
|
+
} },
|
|
555
|
+
onInvoicePreview: { type: Function, default: () => {
|
|
556
|
+
} },
|
|
557
|
+
onWalletCardType: { default: () => {
|
|
540
558
|
} }
|
|
541
559
|
},
|
|
542
|
-
emits: ["mounted", "error", "success", "fail", "submit", "verify", "customStylesAppended", "paymentDetails", "formRedirect", "interaction", "orderStatus", "resize", "card", "readyPaymentInstance"],
|
|
560
|
+
emits: ["mounted", "error", "success", "fail", "submit", "verify", "customStylesAppended", "paymentDetails", "formRedirect", "interaction", "orderStatus", "resize", "card", "invoicePreview", "readyPaymentInstance"],
|
|
543
561
|
setup(__props, { emit }) {
|
|
544
562
|
const props = __props;
|
|
545
563
|
const sdkInstance = ref();
|
|
@@ -585,7 +603,9 @@ const _sfc_main$1 = defineComponent({
|
|
|
585
603
|
onInteraction: (e) => props.onInteraction && props.onInteraction(e),
|
|
586
604
|
onOrderStatus: (e) => props.onOrderStatus && props.onOrderStatus(e),
|
|
587
605
|
onResize: (e) => props.onResize && props.onResize(e),
|
|
588
|
-
onCard: (e) => props.onCard && props.onCard(e)
|
|
606
|
+
onCard: (e) => props.onCard && props.onCard(e),
|
|
607
|
+
onInvoicePreview: (e) => props.onInvoicePreview && props.onInvoicePreview(e),
|
|
608
|
+
onWalletCardType: (data, pauseUntil) => props.onWalletCardType && props.onWalletCardType(data, pauseUntil)
|
|
589
609
|
};
|
|
590
610
|
onMounted(async () => {
|
|
591
611
|
var _a2;
|
|
@@ -615,7 +635,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
615
635
|
};
|
|
616
636
|
}
|
|
617
637
|
});
|
|
618
|
-
var Payment = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
638
|
+
var Payment = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-0ee8f352"]]);
|
|
619
639
|
const initResignForm = async (config) => {
|
|
620
640
|
if (!config.resignRequest) {
|
|
621
641
|
throw new Error("Attribute 'resignRequest' is required");
|
|
@@ -736,5 +756,5 @@ const _sfc_main = defineComponent({
|
|
|
736
756
|
};
|
|
737
757
|
}
|
|
738
758
|
});
|
|
739
|
-
var Resign = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
759
|
+
var Resign = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0726288b"]]);
|
|
740
760
|
export { AdditionalFieldName$1 as AdditionalFieldName, CardBrand$1 as CardBrand, CardBrandIconStyle$1 as CardBrandIconStyle, FieldName$1 as FieldName, FormButtonType$1 as FormButtonType, FormType$1 as FormType, InteractionTargetType$1 as InteractionTargetType, InteractionType$1 as InteractionType, MessageType$1 as MessageType, PayableEntity$1 as PayableEntity, Resign, SdkLoader, SecureBrand$1 as SecureBrand, Payment as default };
|
|
@@ -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;
|
|
@@ -28,6 +28,7 @@ interface PaymentProps extends Partial<ClientSdkEventsProvider> {
|
|
|
28
28
|
pixQrContainerRef?: HTMLDivElement;
|
|
29
29
|
cashAppContainerRef?: HTMLDivElement;
|
|
30
30
|
pixAutomaticoContainerRef?: HTMLDivElement;
|
|
31
|
+
onWalletCardType?: WalletCardTypeCallback;
|
|
31
32
|
onReadyPaymentInstance?: (paymentInstance: ClientSdkInstance) => void;
|
|
32
33
|
}
|
|
33
34
|
export default PaymentProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientSdkInstance, ResignFormConfig, ResignRequest } from '@solidgate/client-sdk-loader';
|
|
2
2
|
import ClientSdkEventsProvider from '../types/ClientSdkEventsProvider';
|
|
3
|
-
interface ResignProps extends Partial<Omit<ClientSdkEventsProvider, 'onCard'>> {
|
|
3
|
+
interface ResignProps extends Partial<Omit<ClientSdkEventsProvider, 'onCard' | 'onInvoicePreview'>> {
|
|
4
4
|
resignRequest: ResignRequest;
|
|
5
5
|
container?: ResignFormConfig['container'];
|
|
6
6
|
appearance?: ResignFormConfig['appearance'];
|
|
@@ -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
|
|
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.
|
|
3
|
+
"version": "1.36.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.
|
|
31
|
+
"@solidgate/client-sdk-loader": "^1.36.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/types": "^7.24.5",
|