@solidgate/vue-sdk 1.5.2 → 1.6.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 +26 -0
- package/dist/solid-payment.es.js +154 -24
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -11,6 +11,9 @@ npm i @solidagate/vue-sdk
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
|
+
|
|
15
|
+
### Payment form
|
|
16
|
+
|
|
14
17
|
Render a payment component in your vue3 project
|
|
15
18
|
|
|
16
19
|
Component inputs and outputs are described in the docs
|
|
@@ -60,6 +63,29 @@ const merchantData: InitConfig['merchantData'] = {
|
|
|
60
63
|
</script>
|
|
61
64
|
```
|
|
62
65
|
|
|
66
|
+
### Resign form
|
|
67
|
+
|
|
68
|
+
Render a resign component in your vue3 project
|
|
69
|
+
|
|
70
|
+
Component inputs and outputs are described in the docs
|
|
71
|
+
https://docs.solidgate.com/payments/integrate/payment-form/resign-payment-form/
|
|
72
|
+
|
|
73
|
+
```vue
|
|
74
|
+
<template>
|
|
75
|
+
<Resign :resign-request="resignRequest" />
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<script lang="ts" setup>
|
|
79
|
+
import { Resign, ResignRequest } from '@solidgate/vue-sdk'
|
|
80
|
+
|
|
81
|
+
const resignRequest: ResignRequest = {
|
|
82
|
+
merchant: '<<--YOUR MERCHANT ID-->>',
|
|
83
|
+
signature: '<<--YOUR SIGNATURE OF THE REQUEST-->>',
|
|
84
|
+
resignIntent: '<<--YOUR RESIGN INTENT-->>'
|
|
85
|
+
}
|
|
86
|
+
</script>
|
|
87
|
+
```
|
|
88
|
+
|
|
63
89
|
## Development server (Vue3 + Typescript + Vite)
|
|
64
90
|
|
|
65
91
|
1. cd vue-sdk
|
package/dist/solid-payment.es.js
CHANGED
|
@@ -1976,6 +1976,7 @@ var PayableEntity$1;
|
|
|
1976
1976
|
PayableEntity2["ApplePay"] = "applebtn";
|
|
1977
1977
|
PayableEntity2["GooglePay"] = "googlebtn";
|
|
1978
1978
|
PayableEntity2["Form"] = "form";
|
|
1979
|
+
PayableEntity2["Resign"] = "resign";
|
|
1979
1980
|
})(PayableEntity$1 || (PayableEntity$1 = {}));
|
|
1980
1981
|
PayableEntity$2.default = PayableEntity$1;
|
|
1981
1982
|
var InteractionType$2 = {};
|
|
@@ -2156,7 +2157,7 @@ function getPayButtonParams(config, key, container) {
|
|
|
2156
2157
|
return payParams;
|
|
2157
2158
|
}
|
|
2158
2159
|
}
|
|
2159
|
-
const
|
|
2160
|
+
const initPaymentForm = async (props) => {
|
|
2160
2161
|
const {
|
|
2161
2162
|
merchantData,
|
|
2162
2163
|
width,
|
|
@@ -2196,32 +2197,52 @@ const initClientSdk = async (props) => {
|
|
|
2196
2197
|
}
|
|
2197
2198
|
return clientSdk.init(initConfig);
|
|
2198
2199
|
};
|
|
2199
|
-
const onSubscribe = (sdkInstanceValue,
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2200
|
+
const onSubscribe = (sdkInstanceValue, callbacks) => {
|
|
2201
|
+
const {
|
|
2202
|
+
onMounted: onMounted2 = () => {
|
|
2203
|
+
},
|
|
2204
|
+
onError = () => {
|
|
2205
|
+
},
|
|
2206
|
+
onSuccess = () => {
|
|
2207
|
+
},
|
|
2208
|
+
onFail = () => {
|
|
2209
|
+
},
|
|
2210
|
+
onSubmit = () => {
|
|
2211
|
+
},
|
|
2212
|
+
onVerify = () => {
|
|
2213
|
+
},
|
|
2214
|
+
onCustomStylesAppended = () => {
|
|
2215
|
+
},
|
|
2216
|
+
onFormRedirect = () => {
|
|
2217
|
+
},
|
|
2218
|
+
onInteraction = () => {
|
|
2219
|
+
},
|
|
2220
|
+
onOrderStatus = () => {
|
|
2221
|
+
},
|
|
2222
|
+
onResize = () => {
|
|
2223
|
+
},
|
|
2224
|
+
onCard = () => {
|
|
2225
|
+
}
|
|
2226
|
+
} = callbacks;
|
|
2227
|
+
sdkInstanceValue.on(MessageType.Mounted, (e) => onMounted2(e.data));
|
|
2228
|
+
sdkInstanceValue.on(MessageType.Success, (e) => onSuccess(e.data));
|
|
2229
|
+
sdkInstanceValue.on(MessageType.Error, (e) => onError(e.data));
|
|
2230
|
+
sdkInstanceValue.on(MessageType.Fail, (e) => onFail(e.data));
|
|
2231
|
+
sdkInstanceValue.on(MessageType.Submit, (e) => onSubmit(e.data));
|
|
2232
|
+
sdkInstanceValue.on(MessageType.Verify, (e) => onVerify(e.data));
|
|
2206
2233
|
sdkInstanceValue.on(
|
|
2207
2234
|
MessageType.CustomStylesAppended,
|
|
2208
|
-
(e) =>
|
|
2209
|
-
);
|
|
2210
|
-
sdkInstanceValue.on(MessageType.Redirect, (e) => props.onFormRedirect(e.data));
|
|
2211
|
-
sdkInstanceValue.on(
|
|
2212
|
-
MessageType.Interaction,
|
|
2213
|
-
(e) => props.onInteraction(e.data)
|
|
2235
|
+
(e) => onCustomStylesAppended(e.data)
|
|
2214
2236
|
);
|
|
2215
|
-
sdkInstanceValue.on(
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
);
|
|
2219
|
-
sdkInstanceValue.on(MessageType.
|
|
2220
|
-
sdkInstanceValue.on(MessageType.Card, (e) => props.onCard(e.data));
|
|
2237
|
+
sdkInstanceValue.on(MessageType.Redirect, (e) => onFormRedirect(e.data));
|
|
2238
|
+
sdkInstanceValue.on(MessageType.Interaction, (e) => onInteraction(e.data));
|
|
2239
|
+
sdkInstanceValue.on(MessageType.OrderStatus, (e) => onOrderStatus(e.data));
|
|
2240
|
+
sdkInstanceValue.on(MessageType.Resize, (e) => onResize(e.data));
|
|
2241
|
+
sdkInstanceValue.on(MessageType.Card, (e) => onCard(e.data));
|
|
2221
2242
|
};
|
|
2222
2243
|
const sdkInitType = "vue";
|
|
2223
2244
|
window.__SOLIDGATE_PRIVATE__SDK_INIT_TYPE = sdkInitType;
|
|
2224
|
-
const _sfc_main = defineComponent({
|
|
2245
|
+
const _sfc_main$1 = defineComponent({
|
|
2225
2246
|
__name: "Payment",
|
|
2226
2247
|
props: {
|
|
2227
2248
|
merchantData: {},
|
|
@@ -2293,7 +2314,7 @@ const _sfc_main = defineComponent({
|
|
|
2293
2314
|
};
|
|
2294
2315
|
onMounted(async () => {
|
|
2295
2316
|
var _a2;
|
|
2296
|
-
sdkInstance.value = await
|
|
2317
|
+
sdkInstance.value = await initPaymentForm(config);
|
|
2297
2318
|
if (sdkInstance.value) {
|
|
2298
2319
|
onSubscribe(sdkInstance.value, callbacks);
|
|
2299
2320
|
(_a2 = props.onReadyPaymentInstance) == null ? void 0 : _a2.call(props, sdkInstance.value);
|
|
@@ -2308,7 +2329,7 @@ const _sfc_main = defineComponent({
|
|
|
2308
2329
|
(value) => isReactive(value) ? value : () => value
|
|
2309
2330
|
),
|
|
2310
2331
|
async () => {
|
|
2311
|
-
sdkInstance.value = await
|
|
2332
|
+
sdkInstance.value = await initPaymentForm(config);
|
|
2312
2333
|
}
|
|
2313
2334
|
);
|
|
2314
2335
|
return (_ctx, _cache) => {
|
|
@@ -2321,4 +2342,113 @@ const _sfc_main = defineComponent({
|
|
|
2321
2342
|
};
|
|
2322
2343
|
}
|
|
2323
2344
|
});
|
|
2324
|
-
|
|
2345
|
+
const initResignForm = async (config) => {
|
|
2346
|
+
if (!config.resignRequest) {
|
|
2347
|
+
throw new Error("Attribute 'resignRequest' is required");
|
|
2348
|
+
}
|
|
2349
|
+
const clientSdk = await SdkLoader.load();
|
|
2350
|
+
const { appearance, styles, container } = config;
|
|
2351
|
+
const formConfig = {
|
|
2352
|
+
container: {
|
|
2353
|
+
...container,
|
|
2354
|
+
id: IFRAME_CONTAINER_ID
|
|
2355
|
+
}
|
|
2356
|
+
};
|
|
2357
|
+
if (appearance) {
|
|
2358
|
+
formConfig.appearance = appearance;
|
|
2359
|
+
}
|
|
2360
|
+
if (styles) {
|
|
2361
|
+
formConfig.styles = styles;
|
|
2362
|
+
}
|
|
2363
|
+
return clientSdk.resign(config.resignRequest, formConfig);
|
|
2364
|
+
};
|
|
2365
|
+
const _sfc_main = defineComponent({
|
|
2366
|
+
__name: "Resign",
|
|
2367
|
+
props: {
|
|
2368
|
+
resignRequest: {},
|
|
2369
|
+
container: {},
|
|
2370
|
+
appearance: {},
|
|
2371
|
+
styles: {},
|
|
2372
|
+
onReadyResignInstance: {},
|
|
2373
|
+
onMounted: { type: Function, default: () => {
|
|
2374
|
+
} },
|
|
2375
|
+
onError: { type: Function, default: () => {
|
|
2376
|
+
} },
|
|
2377
|
+
onSuccess: { type: Function, default: () => {
|
|
2378
|
+
} },
|
|
2379
|
+
onFail: { type: Function, default: () => {
|
|
2380
|
+
} },
|
|
2381
|
+
onSubmit: { type: Function, default: () => {
|
|
2382
|
+
} },
|
|
2383
|
+
onVerify: { type: Function, default: () => {
|
|
2384
|
+
} },
|
|
2385
|
+
onCustomStylesAppended: { type: Function, default: () => {
|
|
2386
|
+
} },
|
|
2387
|
+
onFormRedirect: { type: Function, default: () => {
|
|
2388
|
+
} },
|
|
2389
|
+
onInteraction: { type: Function, default: () => {
|
|
2390
|
+
} },
|
|
2391
|
+
onOrderStatus: { type: Function, default: () => {
|
|
2392
|
+
} },
|
|
2393
|
+
onResize: { type: Function, default: () => {
|
|
2394
|
+
} }
|
|
2395
|
+
},
|
|
2396
|
+
emits: ["mounted", "error", "success", "fail", "submit", "verify", "customStylesAppended", "formRedirect", "interaction", "orderStatus", "resize", "readyResignInstance"],
|
|
2397
|
+
setup(__props, { emit }) {
|
|
2398
|
+
const props = __props;
|
|
2399
|
+
const StyledResign = styled.div`
|
|
2400
|
+
iframe {
|
|
2401
|
+
border: none;
|
|
2402
|
+
}
|
|
2403
|
+
`;
|
|
2404
|
+
const sdkInstance = ref();
|
|
2405
|
+
const resignConfig = {
|
|
2406
|
+
resignRequest: props.resignRequest,
|
|
2407
|
+
container: props.container,
|
|
2408
|
+
appearance: props.appearance,
|
|
2409
|
+
styles: props.styles
|
|
2410
|
+
};
|
|
2411
|
+
const callbacks = {
|
|
2412
|
+
onMounted: (e) => props.onMounted && props.onMounted(e),
|
|
2413
|
+
onError: (e) => props.onError && props.onError(e),
|
|
2414
|
+
onSuccess: (e) => props.onSuccess && props.onSuccess(e),
|
|
2415
|
+
onFail: (e) => props.onFail && props.onFail(e),
|
|
2416
|
+
onSubmit: (e) => props.onSubmit && props.onSubmit(e),
|
|
2417
|
+
onVerify: (e) => props.onVerify && props.onVerify(e),
|
|
2418
|
+
onCustomStylesAppended: (e) => props.onCustomStylesAppended && props.onCustomStylesAppended(e),
|
|
2419
|
+
onFormRedirect: (e) => props.onFormRedirect && props.onFormRedirect(e),
|
|
2420
|
+
onInteraction: (e) => props.onInteraction && props.onInteraction(e),
|
|
2421
|
+
onOrderStatus: (e) => props.onOrderStatus && props.onOrderStatus(e),
|
|
2422
|
+
onResize: (e) => props.onResize && props.onResize(e)
|
|
2423
|
+
};
|
|
2424
|
+
onMounted(async () => {
|
|
2425
|
+
var _a2;
|
|
2426
|
+
sdkInstance.value = await initResignForm(resignConfig);
|
|
2427
|
+
if (sdkInstance.value) {
|
|
2428
|
+
onSubscribe(sdkInstance.value, callbacks);
|
|
2429
|
+
(_a2 = props.onReadyResignInstance) == null ? void 0 : _a2.call(props, sdkInstance.value);
|
|
2430
|
+
}
|
|
2431
|
+
});
|
|
2432
|
+
onUnmounted(() => {
|
|
2433
|
+
var _a2;
|
|
2434
|
+
(_a2 = sdkInstance == null ? void 0 : sdkInstance.value) == null ? void 0 : _a2.destroy();
|
|
2435
|
+
});
|
|
2436
|
+
watch(
|
|
2437
|
+
Object.values(resignConfig).map(
|
|
2438
|
+
(value) => isReactive(value) ? value : () => value
|
|
2439
|
+
),
|
|
2440
|
+
async () => {
|
|
2441
|
+
sdkInstance.value = await initResignForm(resignConfig);
|
|
2442
|
+
}
|
|
2443
|
+
);
|
|
2444
|
+
return (_ctx, _cache) => {
|
|
2445
|
+
return openBlock(), createBlock(unref(ThemeProvider), { theme: {} }, {
|
|
2446
|
+
default: withCtx(() => [
|
|
2447
|
+
createVNode(StyledResign, { id: unref(IFRAME_CONTAINER_ID) }, null, 8, ["id"])
|
|
2448
|
+
]),
|
|
2449
|
+
_: 1
|
|
2450
|
+
});
|
|
2451
|
+
};
|
|
2452
|
+
}
|
|
2453
|
+
});
|
|
2454
|
+
export { AdditionalFieldName, CardBrand, FieldName, FormButtonType, FormType, InteractionTargetType, InteractionType, MessageType, PayableEntity, _sfc_main as Resign, SdkLoader, SecureBrand, _sfc_main$1 as default };
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"import": "./dist/solid-payment.es.js"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
-
"version": "1.
|
|
13
|
+
"version": "1.6.0",
|
|
14
14
|
"typings": "./dist/lib/index.d.ts",
|
|
15
15
|
"license": "Apache-2.0",
|
|
16
16
|
"scripts": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"vue": "^3.2.25"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@solidgate/client-sdk-loader": "^1.
|
|
28
|
+
"@solidgate/client-sdk-loader": "^1.7.0",
|
|
29
29
|
"vue3-styled-components": "^1.2.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"eslint-plugin-vue": "^8.4.1",
|
|
41
41
|
"husky": "^7.0.4",
|
|
42
42
|
"lint-staged": "^11.2.6",
|
|
43
|
+
"path": "^0.12.7",
|
|
43
44
|
"prettier": "^2.5.1",
|
|
44
45
|
"typescript": "5.0.4",
|
|
45
46
|
"vite": "^2.8.0",
|
|
46
|
-
"vue
|
|
47
|
-
"
|
|
48
|
-
"vue": "^3.2.25"
|
|
47
|
+
"vue": "^3.2.25",
|
|
48
|
+
"vue-tsc": "^0.29.8"
|
|
49
49
|
}
|
|
50
50
|
}
|