@getspot/spot-widget-vue2 3.0.1 → 3.0.3
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 +16 -0
- package/dist/index.es.js +22 -17
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @getspot/spot-widget-vue2
|
|
2
2
|
|
|
3
|
+
## 3.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1881ed1: Fix compatibility with Vue 2 build systems by replacing import.meta.url with document.currentScript
|
|
8
|
+
- Updated dependencies [1881ed1]
|
|
9
|
+
- @getspot/spot-widget@3.0.3
|
|
10
|
+
|
|
11
|
+
## 3.0.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- f3c5aed: fix rerender errors
|
|
16
|
+
- Updated dependencies [f3c5aed]
|
|
17
|
+
- @getspot/spot-widget@3.0.2
|
|
18
|
+
|
|
3
19
|
## 3.0.1
|
|
4
20
|
|
|
5
21
|
### 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,
|
|
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 =
|
|
5
|
-
var
|
|
6
|
-
if (u ? (
|
|
7
|
-
|
|
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, !
|
|
10
|
-
}, i._ssrRegister =
|
|
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),
|
|
15
|
+
} : r), s)
|
|
16
16
|
if (i.functional) {
|
|
17
|
-
i._injectStyles =
|
|
17
|
+
i._injectStyles = s;
|
|
18
18
|
var c = i.render;
|
|
19
19
|
i.render = function(g, l) {
|
|
20
|
-
return
|
|
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,
|
|
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
|
-
|
|
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 || {}),
|
|
189
|
-
var d = e[
|
|
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,
|
|
206
|
-
return
|
|
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,
|
|
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.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"CHANGELOG.md"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@getspot/spot-widget": "3.0.
|
|
16
|
+
"@getspot/spot-widget": "3.0.3"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"vue": "^2.6.0"
|