@getspot/spot-widget-vue2 3.0.2 → 3.0.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
+ ## @getspot/spot-widget-vue2 [3.0.4](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget-vue2@3.0.3...@getspot/spot-widget-vue2@3.0.4) (2025-10-29)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **ci:** update semantic-release tag formats and fix corrupted version ([ec89b9e](https://gitlab.com/getspot/spot-widget/commit/ec89b9ee4c97bea99b683fbbd5e4700d4a8b2c4f))
7
+
8
+
9
+
10
+
11
+
12
+ ### Dependencies
13
+
14
+ * **@getspot/spot-widget:** upgraded to 3.0.4
15
+
1
16
  # @getspot/spot-widget-vue2
2
17
 
18
+ ## 3.0.3
19
+
20
+ ### Patch Changes
21
+
22
+ - 1881ed1: Fix compatibility with Vue 2 build systems by replacing import.meta.url with document.currentScript
23
+ - Updated dependencies [1881ed1]
24
+ - @getspot/spot-widget@3.0.3
25
+
3
26
  ## 3.0.2
4
27
 
5
28
  ### Patch Changes
package/dist/index.es.js CHANGED
@@ -1,27 +1,27 @@
1
1
  import p from "@getspot/spot-widget";
2
- function w(t, e, s, d, r, a, u, f) {
2
+ function w(t, e, n, d, r, a, u, f) {
3
3
  var i = typeof t == "function" ? t.options : t;
4
- e && (i.render = e, i.staticRenderFns = s, i._compiled = !0), d && (i.functional = !0), a && (i._scopeId = "data-v-" + a);
5
- var o;
6
- if (u ? (o = function(n) {
7
- n = n || // cached call
4
+ e && (i.render = e, i.staticRenderFns = n, i._compiled = !0), d && (i.functional = !0), a && (i._scopeId = "data-v-" + a);
5
+ var s;
6
+ if (u ? (s = function(o) {
7
+ o = o || // cached call
8
8
  this.$vnode && this.$vnode.ssrContext || // stateful
9
- this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !n && typeof __VUE_SSR_CONTEXT__ < "u" && (n = __VUE_SSR_CONTEXT__), r && r.call(this, n), n && n._registeredComponents && n._registeredComponents.add(u);
10
- }, i._ssrRegister = o) : r && (o = f ? function() {
9
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !o && typeof __VUE_SSR_CONTEXT__ < "u" && (o = __VUE_SSR_CONTEXT__), r && r.call(this, o), o && o._registeredComponents && o._registeredComponents.add(u);
10
+ }, i._ssrRegister = s) : r && (s = f ? function() {
11
11
  r.call(
12
12
  this,
13
13
  (i.functional ? this.parent : this).$root.$options.shadowRoot
14
14
  );
15
- } : r), o)
15
+ } : r), s)
16
16
  if (i.functional) {
17
- i._injectStyles = o;
17
+ i._injectStyles = s;
18
18
  var c = i.render;
19
19
  i.render = function(g, l) {
20
- return o.call(l), c(g, l);
20
+ return s.call(l), c(g, l);
21
21
  };
22
22
  } else {
23
23
  var h = i.beforeCreate;
24
- i.beforeCreate = h ? [].concat(h, o) : [o];
24
+ i.beforeCreate = h ? [].concat(h, s) : [s];
25
25
  }
26
26
  return {
27
27
  exports: t,
@@ -127,8 +127,13 @@ const y = {
127
127
  watch: {
128
128
  quoteRequestData: {
129
129
  handler: function(t, e) {
130
- this.widget && t && JSON.stringify(t) !== JSON.stringify(e) && (this.reinitTimeout && clearTimeout(this.reinitTimeout), this.reinitTimeout = setTimeout(() => {
131
- this.reinitializeWidget(), this.reinitTimeout = null;
130
+ this.widget && t && JSON.stringify(t) !== JSON.stringify(e) && (this.reinitTimeout && clearTimeout(this.reinitTimeout), this.reinitTimeout = setTimeout(async () => {
131
+ try {
132
+ await this.widget.updateQuote(t) || this.reinitializeWidget();
133
+ } catch {
134
+ this.reinitializeWidget();
135
+ }
136
+ this.reinitTimeout = null;
132
137
  }, 100));
133
138
  },
134
139
  deep: !0
@@ -185,8 +190,8 @@ const y = {
185
190
  },
186
191
  updateTheme: function(t) {
187
192
  if (!(!this.widget || !this.widget.container))
188
- for (var e = Object.keys(t || {}), s = 0; s < e.length; s++) {
189
- var d = e[s], r = t[d], a = "--" + d;
193
+ for (var e = Object.keys(t || {}), n = 0; n < e.length; n++) {
194
+ var d = e[n], r = t[d], a = "--" + d;
190
195
  this.widget.container.style.setProperty(a, r);
191
196
  }
192
197
  },
@@ -202,8 +207,8 @@ const y = {
202
207
  }
203
208
  };
204
209
  var _ = function() {
205
- var e = this, s = e._self._c;
206
- return s("div", { ref: "container" });
210
+ var e = this, n = e._self._c;
211
+ return n("div", { ref: "container" });
207
212
  }, m = [], O = /* @__PURE__ */ w(
208
213
  y,
209
214
  _,
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(d,u){typeof exports=="object"&&typeof module<"u"?module.exports=u(require("@getspot/spot-widget")):typeof define=="function"&&define.amd?define(["@getspot/spot-widget"],u):(d=typeof globalThis<"u"?globalThis:d||self,d.Vue2SpotWidget=u(d.SpotWidget))})(this,function(d){"use strict";function u(t,e,s,a,r,h,f,m){var i=typeof t=="function"?t.options:t;e&&(i.render=e,i.staticRenderFns=s,i._compiled=!0),a&&(i.functional=!0),h&&(i._scopeId="data-v-"+h);var o;if(f?(o=function(n){n=n||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!n&&typeof __VUE_SSR_CONTEXT__<"u"&&(n=__VUE_SSR_CONTEXT__),r&&r.call(this,n),n&&n._registeredComponents&&n._registeredComponents.add(f)},i._ssrRegister=o):r&&(o=m?function(){r.call(this,(i.functional?this.parent:this).$root.$options.shadowRoot)}:r),o)if(i.functional){i._injectStyles=o;var _=i.render;i.render=function(O,c){return o.call(c),_(O,c)}}else{var l=i.beforeCreate;i.beforeCreate=l?[].concat(l,o):[o]}return{exports:t,options:i}}const p={name:"Vue2SpotWidget",props:{apiConfig:{type:Object,default:void 0},quoteRequestData:{type:[Object,Array],default:void 0},showTable:{type:Boolean,default:!0},optInSelected:{type:Boolean,default:!1},theme:{type:Object,default:void 0},callbacks:{type:Object,default:()=>({})},onQuoteRetrieved:{type:Function,default:void 0},onOptIn:{type:Function,default:void 0},onOptOut:{type:Function,default:void 0},onError:{type:Function,default:void 0},onNoMatchingQuote:{type:Function,default:void 0},onSelectionChange:{type:Function,default:void 0},options:{type:Object,default:()=>({})}},data(){return{widget:null,reinitTimeout:null}},computed:{mergedCallbacks(){return{...this.callbacks,...this.onQuoteRetrieved&&{onQuoteRetrieved:this.onQuoteRetrieved},...this.onOptIn&&{onOptIn:t=>{this.onOptIn&&this.onOptIn(t),this.onSelectionChange&&this.onSelectionChange(t)}},...this.onOptOut&&{onOptOut:t=>{this.onOptOut&&this.onOptOut(t),this.onSelectionChange&&this.onSelectionChange(t)}},...this.onError&&{onError:this.onError},...this.onNoMatchingQuote&&{onNoMatchingQuote:this.onNoMatchingQuote}}},widgetOptions(){return{apiConfig:this.apiConfig,quoteRequestData:this.quoteRequestData,showTable:this.showTable,optInSelected:this.optInSelected,theme:this.theme,callbacks:this.mergedCallbacks,...this.options}}},mounted(){this.initializeWidget()},watch:{quoteRequestData:{handler:function(t,e){this.widget&&t&&JSON.stringify(t)!==JSON.stringify(e)&&(this.reinitTimeout&&clearTimeout(this.reinitTimeout),this.reinitTimeout=setTimeout(()=>{this.reinitializeWidget(),this.reinitTimeout=null},100))},deep:!0},apiConfig:{handler:function(){this.reinitializeWidget()},deep:!0},showTable:function(t,e){t!==e&&this.reinitializeWidget()},optInSelected:function(t,e){t!==e&&this.reinitializeWidget()},theme:{handler:function(t,e){this.widget&&JSON.stringify(t)!==JSON.stringify(e)&&this.updateTheme(t)},deep:!0},mergedCallbacks:{handler:function(t,e){this.widget&&JSON.stringify(t)!==JSON.stringify(e)&&this.updateCallbacks(t)},deep:!0}},methods:{initializeWidget(){this.widget&&(this.widget.destroy(),this.widget=null),this.$refs.container&&(this.$refs.container.innerHTML=""),this.$nextTick(()=>{try{this.widget=new d({...this.widgetOptions,location:this.$refs.container})}catch(t){this.$emit("error",t),this.onError&&this.onError(t)}})},reinitializeWidget(){this.widget&&(this.widget.destroy(),this.widget=null),this.initializeWidget()},async updateQuote(t){return this.widget&&this.widget.updateQuote?this.widget.updateQuote(t):void 0},getSelection(){return this.widget&&this.widget.getSelection?this.widget.getSelection():void 0},validateSelection(){return this.widget&&this.widget.validateSelection?this.widget.validateSelection():void 0},updateTheme:function(t){if(!(!this.widget||!this.widget.container))for(var e=Object.keys(t||{}),s=0;s<e.length;s++){var a=e[s],r=t[a],h="--"+a;this.widget.container.style.setProperty(h,r)}},updateCallbacks:function(t){this.widget&&(this.widget.options.callbacks=t)},destroy(){this.widget&&typeof this.widget.destroy=="function"&&(this.widget.destroy(),this.widget=null)}},beforeDestroy(){this.reinitTimeout&&clearTimeout(this.reinitTimeout),this.widget&&typeof this.widget.destroy=="function"&&this.widget.destroy()}};var g=function(){var e=this,s=e._self._c;return s("div",{ref:"container"})},w=[],y=u(p,g,w,!1,null,null,null,null);return y.exports});
1
+ (function(d,u){typeof exports=="object"&&typeof module<"u"?module.exports=u(require("@getspot/spot-widget")):typeof define=="function"&&define.amd?define(["@getspot/spot-widget"],u):(d=typeof globalThis<"u"?globalThis:d||self,d.Vue2SpotWidget=u(d.SpotWidget))})(this,function(d){"use strict";function u(t,e,n,a,r,h,f,m){var i=typeof t=="function"?t.options:t;e&&(i.render=e,i.staticRenderFns=n,i._compiled=!0),a&&(i.functional=!0),h&&(i._scopeId="data-v-"+h);var s;if(f?(s=function(o){o=o||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!o&&typeof __VUE_SSR_CONTEXT__<"u"&&(o=__VUE_SSR_CONTEXT__),r&&r.call(this,o),o&&o._registeredComponents&&o._registeredComponents.add(f)},i._ssrRegister=s):r&&(s=m?function(){r.call(this,(i.functional?this.parent:this).$root.$options.shadowRoot)}:r),s)if(i.functional){i._injectStyles=s;var _=i.render;i.render=function(O,c){return s.call(c),_(O,c)}}else{var l=i.beforeCreate;i.beforeCreate=l?[].concat(l,s):[s]}return{exports:t,options:i}}const g={name:"Vue2SpotWidget",props:{apiConfig:{type:Object,default:void 0},quoteRequestData:{type:[Object,Array],default:void 0},showTable:{type:Boolean,default:!0},optInSelected:{type:Boolean,default:!1},theme:{type:Object,default:void 0},callbacks:{type:Object,default:()=>({})},onQuoteRetrieved:{type:Function,default:void 0},onOptIn:{type:Function,default:void 0},onOptOut:{type:Function,default:void 0},onError:{type:Function,default:void 0},onNoMatchingQuote:{type:Function,default:void 0},onSelectionChange:{type:Function,default:void 0},options:{type:Object,default:()=>({})}},data(){return{widget:null,reinitTimeout:null}},computed:{mergedCallbacks(){return{...this.callbacks,...this.onQuoteRetrieved&&{onQuoteRetrieved:this.onQuoteRetrieved},...this.onOptIn&&{onOptIn:t=>{this.onOptIn&&this.onOptIn(t),this.onSelectionChange&&this.onSelectionChange(t)}},...this.onOptOut&&{onOptOut:t=>{this.onOptOut&&this.onOptOut(t),this.onSelectionChange&&this.onSelectionChange(t)}},...this.onError&&{onError:this.onError},...this.onNoMatchingQuote&&{onNoMatchingQuote:this.onNoMatchingQuote}}},widgetOptions(){return{apiConfig:this.apiConfig,quoteRequestData:this.quoteRequestData,showTable:this.showTable,optInSelected:this.optInSelected,theme:this.theme,callbacks:this.mergedCallbacks,...this.options}}},mounted(){this.initializeWidget()},watch:{quoteRequestData:{handler:function(t,e){this.widget&&t&&JSON.stringify(t)!==JSON.stringify(e)&&(this.reinitTimeout&&clearTimeout(this.reinitTimeout),this.reinitTimeout=setTimeout(async()=>{try{await this.widget.updateQuote(t)||this.reinitializeWidget()}catch{this.reinitializeWidget()}this.reinitTimeout=null},100))},deep:!0},apiConfig:{handler:function(){this.reinitializeWidget()},deep:!0},showTable:function(t,e){t!==e&&this.reinitializeWidget()},optInSelected:function(t,e){t!==e&&this.reinitializeWidget()},theme:{handler:function(t,e){this.widget&&JSON.stringify(t)!==JSON.stringify(e)&&this.updateTheme(t)},deep:!0},mergedCallbacks:{handler:function(t,e){this.widget&&JSON.stringify(t)!==JSON.stringify(e)&&this.updateCallbacks(t)},deep:!0}},methods:{initializeWidget(){this.widget&&(this.widget.destroy(),this.widget=null),this.$refs.container&&(this.$refs.container.innerHTML=""),this.$nextTick(()=>{try{this.widget=new d({...this.widgetOptions,location:this.$refs.container})}catch(t){this.$emit("error",t),this.onError&&this.onError(t)}})},reinitializeWidget(){this.widget&&(this.widget.destroy(),this.widget=null),this.initializeWidget()},async updateQuote(t){return this.widget&&this.widget.updateQuote?this.widget.updateQuote(t):void 0},getSelection(){return this.widget&&this.widget.getSelection?this.widget.getSelection():void 0},validateSelection(){return this.widget&&this.widget.validateSelection?this.widget.validateSelection():void 0},updateTheme:function(t){if(!(!this.widget||!this.widget.container))for(var e=Object.keys(t||{}),n=0;n<e.length;n++){var a=e[n],r=t[a],h="--"+a;this.widget.container.style.setProperty(h,r)}},updateCallbacks:function(t){this.widget&&(this.widget.options.callbacks=t)},destroy(){this.widget&&typeof this.widget.destroy=="function"&&(this.widget.destroy(),this.widget=null)}},beforeDestroy(){this.reinitTimeout&&clearTimeout(this.reinitTimeout),this.widget&&typeof this.widget.destroy=="function"&&this.widget.destroy()}};var p=function(){var e=this,n=e._self._c;return n("div",{ref:"container"})},w=[],y=u(g,p,w,!1,null,null,null,null);return y.exports});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getspot/spot-widget-vue2",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -12,8 +12,17 @@
12
12
  "README.md",
13
13
  "CHANGELOG.md"
14
14
  ],
15
+ "scripts": {
16
+ "build": "vite build && cp src/index.d.ts dist/index.d.ts",
17
+ "docs:readme": "node scripts/generate-readme.js",
18
+ "test": "vitest run",
19
+ "test:watch": "vitest --watch",
20
+ "test:coverage": "vitest --coverage",
21
+ "test:ci": "vitest run --coverage",
22
+ "prepublishOnly": "npm run build"
23
+ },
15
24
  "dependencies": {
16
- "@getspot/spot-widget": "3.0.2"
25
+ "@getspot/spot-widget": "3.0.4"
17
26
  },
18
27
  "peerDependencies": {
19
28
  "vue": "^2.6.0"
@@ -27,13 +36,5 @@
27
36
  "@vue/test-utils": "^1.3.6",
28
37
  "vue": "^2.7.14",
29
38
  "vue-template-compiler": "^2.7.14"
30
- },
31
- "scripts": {
32
- "build": "vite build && cp src/index.d.ts dist/index.d.ts",
33
- "docs:readme": "node scripts/generate-readme.js",
34
- "test": "vitest",
35
- "test:watch": "vitest --watch",
36
- "test:coverage": "vitest --coverage",
37
- "test:ci": "vitest run --coverage"
38
39
  }
39
- }
40
+ }