@solidgate/vue-sdk 1.5.3 → 1.7.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
@@ -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
@@ -1944,6 +1944,17 @@ var CardBrand$1 = {};
1944
1944
  CardBrand3["Elo"] = "elo";
1945
1945
  CardBrand3["Hipercard"] = "hipercard";
1946
1946
  CardBrand3["CartesBancaires"] = "cartes-bancaires";
1947
+ CardBrand3["Rupay"] = "rupay";
1948
+ CardBrand3["BCCard"] = "bc-card";
1949
+ CardBrand3["UnionPay"] = "unionpay";
1950
+ CardBrand3["Dankort"] = "dankort";
1951
+ CardBrand3["GPNCard"] = "gpn-card";
1952
+ CardBrand3["Troy"] = "troy";
1953
+ CardBrand3["ThaiPaymentNetwork"] = "thai-payment-network";
1954
+ CardBrand3["MADA"] = "mada";
1955
+ CardBrand3["Bancontact"] = "bancontact";
1956
+ CardBrand3["Interac"] = "interac";
1957
+ CardBrand3["Bajaj"] = "bajaj";
1947
1958
  })(CardBrand2 = exports.CardBrand || (exports.CardBrand = {}));
1948
1959
  exports.default = CardBrand2;
1949
1960
  })(CardBrand$1);
@@ -1976,6 +1987,7 @@ var PayableEntity$1;
1976
1987
  PayableEntity2["ApplePay"] = "applebtn";
1977
1988
  PayableEntity2["GooglePay"] = "googlebtn";
1978
1989
  PayableEntity2["Form"] = "form";
1990
+ PayableEntity2["Resign"] = "resign";
1979
1991
  })(PayableEntity$1 || (PayableEntity$1 = {}));
1980
1992
  PayableEntity$2.default = PayableEntity$1;
1981
1993
  var InteractionType$2 = {};
@@ -2156,7 +2168,7 @@ function getPayButtonParams(config, key, container) {
2156
2168
  return payParams;
2157
2169
  }
2158
2170
  }
2159
- const initClientSdk = async (props) => {
2171
+ const initPaymentForm = async (props) => {
2160
2172
  const {
2161
2173
  merchantData,
2162
2174
  width,
@@ -2196,32 +2208,52 @@ const initClientSdk = async (props) => {
2196
2208
  }
2197
2209
  return clientSdk.init(initConfig);
2198
2210
  };
2199
- const onSubscribe = (sdkInstanceValue, props) => {
2200
- sdkInstanceValue.on(MessageType.Mounted, (e) => props.onMounted(e.data));
2201
- sdkInstanceValue.on(MessageType.Success, (e) => props.onSuccess(e.data));
2202
- sdkInstanceValue.on(MessageType.Error, (e) => props.onError(e.data));
2203
- sdkInstanceValue.on(MessageType.Fail, (e) => props.onFail(e.data));
2204
- sdkInstanceValue.on(MessageType.Submit, (e) => props.onSubmit(e.data));
2205
- sdkInstanceValue.on(MessageType.Verify, (e) => props.onVerify(e.data));
2211
+ const onSubscribe = (sdkInstanceValue, callbacks) => {
2212
+ const {
2213
+ onMounted: onMounted2 = () => {
2214
+ },
2215
+ onError = () => {
2216
+ },
2217
+ onSuccess = () => {
2218
+ },
2219
+ onFail = () => {
2220
+ },
2221
+ onSubmit = () => {
2222
+ },
2223
+ onVerify = () => {
2224
+ },
2225
+ onCustomStylesAppended = () => {
2226
+ },
2227
+ onFormRedirect = () => {
2228
+ },
2229
+ onInteraction = () => {
2230
+ },
2231
+ onOrderStatus = () => {
2232
+ },
2233
+ onResize = () => {
2234
+ },
2235
+ onCard = () => {
2236
+ }
2237
+ } = callbacks;
2238
+ sdkInstanceValue.on(MessageType.Mounted, (e) => onMounted2(e.data));
2239
+ sdkInstanceValue.on(MessageType.Success, (e) => onSuccess(e.data));
2240
+ sdkInstanceValue.on(MessageType.Error, (e) => onError(e.data));
2241
+ sdkInstanceValue.on(MessageType.Fail, (e) => onFail(e.data));
2242
+ sdkInstanceValue.on(MessageType.Submit, (e) => onSubmit(e.data));
2243
+ sdkInstanceValue.on(MessageType.Verify, (e) => onVerify(e.data));
2206
2244
  sdkInstanceValue.on(
2207
2245
  MessageType.CustomStylesAppended,
2208
- (e) => props.onCustomStylesAppended(e.data)
2209
- );
2210
- sdkInstanceValue.on(MessageType.Redirect, (e) => props.onFormRedirect(e.data));
2211
- sdkInstanceValue.on(
2212
- MessageType.Interaction,
2213
- (e) => props.onInteraction(e.data)
2246
+ (e) => onCustomStylesAppended(e.data)
2214
2247
  );
2215
- sdkInstanceValue.on(
2216
- MessageType.OrderStatus,
2217
- (e) => props.onOrderStatus(e.data)
2218
- );
2219
- sdkInstanceValue.on(MessageType.Resize, (e) => props.onResize(e.data));
2220
- sdkInstanceValue.on(MessageType.Card, (e) => props.onCard(e.data));
2248
+ sdkInstanceValue.on(MessageType.Redirect, (e) => onFormRedirect(e.data));
2249
+ sdkInstanceValue.on(MessageType.Interaction, (e) => onInteraction(e.data));
2250
+ sdkInstanceValue.on(MessageType.OrderStatus, (e) => onOrderStatus(e.data));
2251
+ sdkInstanceValue.on(MessageType.Resize, (e) => onResize(e.data));
2252
+ sdkInstanceValue.on(MessageType.Card, (e) => onCard(e.data));
2221
2253
  };
2222
2254
  const sdkInitType = "vue";
2223
2255
  window.__SOLIDGATE_PRIVATE__SDK_INIT_TYPE = sdkInitType;
2224
- const _sfc_main = defineComponent({
2256
+ const _sfc_main$1 = defineComponent({
2225
2257
  __name: "Payment",
2226
2258
  props: {
2227
2259
  merchantData: {},
@@ -2293,7 +2325,7 @@ const _sfc_main = defineComponent({
2293
2325
  };
2294
2326
  onMounted(async () => {
2295
2327
  var _a2;
2296
- sdkInstance.value = await initClientSdk(config);
2328
+ sdkInstance.value = await initPaymentForm(config);
2297
2329
  if (sdkInstance.value) {
2298
2330
  onSubscribe(sdkInstance.value, callbacks);
2299
2331
  (_a2 = props.onReadyPaymentInstance) == null ? void 0 : _a2.call(props, sdkInstance.value);
@@ -2308,7 +2340,7 @@ const _sfc_main = defineComponent({
2308
2340
  (value) => isReactive(value) ? value : () => value
2309
2341
  ),
2310
2342
  async () => {
2311
- sdkInstance.value = await initClientSdk(config);
2343
+ sdkInstance.value = await initPaymentForm(config);
2312
2344
  }
2313
2345
  );
2314
2346
  return (_ctx, _cache) => {
@@ -2321,4 +2353,113 @@ const _sfc_main = defineComponent({
2321
2353
  };
2322
2354
  }
2323
2355
  });
2324
- export { AdditionalFieldName, CardBrand, FieldName, FormButtonType, FormType, InteractionTargetType, InteractionType, MessageType, PayableEntity, SdkLoader, SecureBrand, _sfc_main as default };
2356
+ const initResignForm = async (config) => {
2357
+ if (!config.resignRequest) {
2358
+ throw new Error("Attribute 'resignRequest' is required");
2359
+ }
2360
+ const clientSdk = await SdkLoader.load();
2361
+ const { appearance, styles, container } = config;
2362
+ const formConfig = {
2363
+ container: {
2364
+ ...container,
2365
+ id: IFRAME_CONTAINER_ID
2366
+ }
2367
+ };
2368
+ if (appearance) {
2369
+ formConfig.appearance = appearance;
2370
+ }
2371
+ if (styles) {
2372
+ formConfig.styles = styles;
2373
+ }
2374
+ return clientSdk.resign(config.resignRequest, formConfig);
2375
+ };
2376
+ const _sfc_main = defineComponent({
2377
+ __name: "Resign",
2378
+ props: {
2379
+ resignRequest: {},
2380
+ container: {},
2381
+ appearance: {},
2382
+ styles: {},
2383
+ onReadyResignInstance: {},
2384
+ onMounted: { type: Function, default: () => {
2385
+ } },
2386
+ onError: { type: Function, default: () => {
2387
+ } },
2388
+ onSuccess: { type: Function, default: () => {
2389
+ } },
2390
+ onFail: { type: Function, default: () => {
2391
+ } },
2392
+ onSubmit: { type: Function, default: () => {
2393
+ } },
2394
+ onVerify: { type: Function, default: () => {
2395
+ } },
2396
+ onCustomStylesAppended: { type: Function, default: () => {
2397
+ } },
2398
+ onFormRedirect: { type: Function, default: () => {
2399
+ } },
2400
+ onInteraction: { type: Function, default: () => {
2401
+ } },
2402
+ onOrderStatus: { type: Function, default: () => {
2403
+ } },
2404
+ onResize: { type: Function, default: () => {
2405
+ } }
2406
+ },
2407
+ emits: ["mounted", "error", "success", "fail", "submit", "verify", "customStylesAppended", "formRedirect", "interaction", "orderStatus", "resize", "readyResignInstance"],
2408
+ setup(__props, { emit }) {
2409
+ const props = __props;
2410
+ const StyledResign = styled.div`
2411
+ iframe {
2412
+ border: none;
2413
+ }
2414
+ `;
2415
+ const sdkInstance = ref();
2416
+ const resignConfig = {
2417
+ resignRequest: props.resignRequest,
2418
+ container: props.container,
2419
+ appearance: props.appearance,
2420
+ styles: props.styles
2421
+ };
2422
+ const callbacks = {
2423
+ onMounted: (e) => props.onMounted && props.onMounted(e),
2424
+ onError: (e) => props.onError && props.onError(e),
2425
+ onSuccess: (e) => props.onSuccess && props.onSuccess(e),
2426
+ onFail: (e) => props.onFail && props.onFail(e),
2427
+ onSubmit: (e) => props.onSubmit && props.onSubmit(e),
2428
+ onVerify: (e) => props.onVerify && props.onVerify(e),
2429
+ onCustomStylesAppended: (e) => props.onCustomStylesAppended && props.onCustomStylesAppended(e),
2430
+ onFormRedirect: (e) => props.onFormRedirect && props.onFormRedirect(e),
2431
+ onInteraction: (e) => props.onInteraction && props.onInteraction(e),
2432
+ onOrderStatus: (e) => props.onOrderStatus && props.onOrderStatus(e),
2433
+ onResize: (e) => props.onResize && props.onResize(e)
2434
+ };
2435
+ onMounted(async () => {
2436
+ var _a2;
2437
+ sdkInstance.value = await initResignForm(resignConfig);
2438
+ if (sdkInstance.value) {
2439
+ onSubscribe(sdkInstance.value, callbacks);
2440
+ (_a2 = props.onReadyResignInstance) == null ? void 0 : _a2.call(props, sdkInstance.value);
2441
+ }
2442
+ });
2443
+ onUnmounted(() => {
2444
+ var _a2;
2445
+ (_a2 = sdkInstance == null ? void 0 : sdkInstance.value) == null ? void 0 : _a2.destroy();
2446
+ });
2447
+ watch(
2448
+ Object.values(resignConfig).map(
2449
+ (value) => isReactive(value) ? value : () => value
2450
+ ),
2451
+ async () => {
2452
+ sdkInstance.value = await initResignForm(resignConfig);
2453
+ }
2454
+ );
2455
+ return (_ctx, _cache) => {
2456
+ return openBlock(), createBlock(unref(ThemeProvider), { theme: {} }, {
2457
+ default: withCtx(() => [
2458
+ createVNode(StyledResign, { id: unref(IFRAME_CONTAINER_ID) }, null, 8, ["id"])
2459
+ ]),
2460
+ _: 1
2461
+ });
2462
+ };
2463
+ }
2464
+ });
2465
+ 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.5.3",
13
+ "version": "1.7.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.6.2",
28
+ "@solidgate/client-sdk-loader": "^1.8.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-tsc": "^0.29.8",
47
- "path": "^0.12.7",
48
- "vue": "^3.2.25"
47
+ "vue": "^3.2.25",
48
+ "vue-tsc": "^0.29.8"
49
49
  }
50
50
  }