@solidgate/vue-sdk 1.4.0 → 1.5.1

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.
@@ -1,4 +1,4 @@
1
- import { provide, h, inject, defineComponent, ref, onMounted, onUnmounted, openBlock, createBlock, unref, withCtx, createVNode } from "vue";
1
+ import { provide, h, inject, defineComponent, ref, onMounted, onUnmounted, watch, isReactive, openBlock, createBlock, unref, withCtx, createVNode } from "vue";
2
2
  var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
3
3
  var generateAlphabeticName = function generateAlphabeticName2(code) {
4
4
  var lastDigit = chars[code % chars.length];
@@ -2142,14 +2142,15 @@ function getPayButtonParams(config, key, container) {
2142
2142
  if (payParams.containerId) {
2143
2143
  delete payParams.containerId;
2144
2144
  }
2145
+ const syntheticId = payButtonIds[key].id;
2145
2146
  if (container) {
2146
- if (container.id) {
2147
+ if (container.id && container.id !== syntheticId) {
2147
2148
  console.warn(
2148
2149
  `Id attribute "${container.id}" of ${payButtonIds[key].title} container will be overridden`
2149
2150
  );
2150
2151
  }
2151
- payParams.containerId = payButtonIds[key].id;
2152
- container.id = payParams.containerId;
2152
+ payParams.containerId = syntheticId;
2153
+ container.id = syntheticId;
2153
2154
  }
2154
2155
  if (Object.keys(payParams).length) {
2155
2156
  return payParams;
@@ -2161,8 +2162,6 @@ const initClientSdk = async (props) => {
2161
2162
  width,
2162
2163
  styles,
2163
2164
  formParams,
2164
- googlePayButtonParams,
2165
- applePayButtonParams,
2166
2165
  googlePayContainerRef,
2167
2166
  applePayContainerRef
2168
2167
  } = props;
@@ -2259,7 +2258,8 @@ const _sfc_main = defineComponent({
2259
2258
  onCard: { type: Function, default: () => {
2260
2259
  } }
2261
2260
  },
2262
- setup(__props) {
2261
+ emits: ["mounted", "error", "success", "fail", "submit", "verify", "customStylesAppended", "formRedirect", "interaction", "orderStatus", "resize", "card", "readyPaymentInstance"],
2262
+ setup(__props, { emit }) {
2263
2263
  const props = __props;
2264
2264
  const StyledPayment = styled.div`
2265
2265
  iframe {
@@ -2278,18 +2278,18 @@ const _sfc_main = defineComponent({
2278
2278
  applePayContainerRef: props.applePayContainerRef
2279
2279
  };
2280
2280
  const callbacks = {
2281
- onMounted: props.onMounted,
2282
- onError: props.onError,
2283
- onSuccess: props.onSuccess,
2284
- onFail: props.onFail,
2285
- onSubmit: props.onSubmit,
2286
- onVerify: props.onVerify,
2287
- onCustomStylesAppended: props.onCustomStylesAppended,
2288
- onFormRedirect: props.onFormRedirect,
2289
- onInteraction: props.onInteraction,
2290
- onOrderStatus: props.onOrderStatus,
2291
- onResize: props.onResize,
2292
- onCard: props.onCard
2281
+ onMounted: (e) => props.onMounted && props.onMounted(e),
2282
+ onError: (e) => props.onError && props.onError(e),
2283
+ onSuccess: (e) => props.onSuccess && props.onSuccess(e),
2284
+ onFail: (e) => props.onFail && props.onFail(e),
2285
+ onSubmit: (e) => props.onSubmit && props.onSubmit(e),
2286
+ onVerify: (e) => props.onVerify && props.onVerify(e),
2287
+ onCustomStylesAppended: (e) => props.onCustomStylesAppended && props.onCustomStylesAppended(e),
2288
+ onFormRedirect: (e) => props.onFormRedirect && props.onFormRedirect(e),
2289
+ onInteraction: (e) => props.onInteraction && props.onInteraction(e),
2290
+ onOrderStatus: (e) => props.onOrderStatus && props.onOrderStatus(e),
2291
+ onResize: (e) => props.onResize && props.onResize(e),
2292
+ onCard: (e) => props.onCard && props.onCard(e)
2293
2293
  };
2294
2294
  onMounted(async () => {
2295
2295
  var _a2;
@@ -2300,8 +2300,17 @@ const _sfc_main = defineComponent({
2300
2300
  }
2301
2301
  });
2302
2302
  onUnmounted(() => {
2303
- sdkInstance == null ? void 0 : sdkInstance.value.destroy();
2303
+ var _a2;
2304
+ (_a2 = sdkInstance == null ? void 0 : sdkInstance.value) == null ? void 0 : _a2.destroy();
2304
2305
  });
2306
+ watch(
2307
+ Object.values(config).map(
2308
+ (value) => isReactive(value) ? value : () => value
2309
+ ),
2310
+ async () => {
2311
+ sdkInstance.value = await initClientSdk(config);
2312
+ }
2313
+ );
2305
2314
  return (_ctx, _cache) => {
2306
2315
  return openBlock(), createBlock(unref(ThemeProvider), { theme: {} }, {
2307
2316
  default: withCtx(() => [
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "import": "./dist/solid-payment.es.js"
11
11
  }
12
12
  },
13
- "version": "1.4.0",
13
+ "version": "1.5.1",
14
14
  "typings": "./dist/lib/index.d.ts",
15
15
  "license": "Apache-2.0",
16
16
  "scripts": {
@@ -41,7 +41,7 @@
41
41
  "husky": "^7.0.4",
42
42
  "lint-staged": "^11.2.6",
43
43
  "prettier": "^2.5.1",
44
- "typescript": "^4.5.4",
44
+ "typescript": "5.0.4",
45
45
  "vite": "^2.8.0",
46
46
  "vue-tsc": "^0.29.8",
47
47
  "path": "^0.12.7",