@getspot/spot-widget-vue2 3.2.3 → 4.0.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.
- package/CHANGELOG.md +12 -2
- package/README.md +5 -7
- package/dist/index.es.js +20 -19
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
## [
|
|
1
|
+
## [4.0.1](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget-vue2@4.0.0...@getspot/spot-widget-vue2@4.0.1) (2026-01-12)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* when the selection is no we need to check the NO option ([628f5f4](https://gitlab.com/getspot/spot-widget/commit/628f5f453d95bf4956ed4328b8c1fceeb633edd2))
|
|
7
|
+
|
|
8
|
+
# [4.0.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget-vue2@3.2.2...@getspot/spot-widget-vue2@4.0.0) (2026-01-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
* feat!(core): replacing optInSelected prop with selection enum ([0d40913](https://gitlab.com/getspot/spot-widget/commit/0d409135aa50eaa98995b9c1e20ca05cc7e2b2fc))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* better preselection of widget optIn/optOut
|
|
7
17
|
|
|
8
18
|
## [3.2.2](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget-vue2@3.2.1...@getspot/spot-widget-vue2@3.2.2) (2026-01-09)
|
|
9
19
|
|
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ npm install @getspot/spot-widget-vue2
|
|
|
30
30
|
}"
|
|
31
31
|
:quote-request-data="quoteData"
|
|
32
32
|
:show-table="true"
|
|
33
|
-
:
|
|
33
|
+
:selection="'unselected'"
|
|
34
34
|
@quote-retrieved="onQuoteRetrieved"
|
|
35
35
|
@opt-in="onOptIn"
|
|
36
36
|
@opt-out="onOptOut"
|
|
@@ -169,7 +169,7 @@ export default Vue.extend({
|
|
|
169
169
|
| Prop | Type | Default | Description |
|
|
170
170
|
|------|------|---------|-------------|
|
|
171
171
|
| `showTable` | `boolean` | `true` | Whether to show the payout table |
|
|
172
|
-
| `
|
|
172
|
+
| `selection` | `SelectionEnum` | `'unselected'` | Initial selection state for the widget |
|
|
173
173
|
| `theme` | `Theme` | `undefined` | Theme customization options for styling the widget |
|
|
174
174
|
|
|
175
175
|
## Events
|
|
@@ -332,11 +332,9 @@ For multiple items in a cart:
|
|
|
332
332
|
|
|
333
333
|
```typescript
|
|
334
334
|
{
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
currencyCode: 'USD' | 'CAD' | 'AUD'
|
|
339
|
-
},
|
|
335
|
+
cartId: string,
|
|
336
|
+
cartName: string,
|
|
337
|
+
currencyCode: 'USD' | 'CAD' | 'AUD',
|
|
340
338
|
items: Array<{
|
|
341
339
|
// Same fields as single quote, minus cartId and currencyCode
|
|
342
340
|
cartItemId?: string // Optional unique identifier for cart item
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
1
|
+
import w, { SelectionEnum as f } from "@getspot/spot-widget";
|
|
2
|
+
function y(t, e, n, d, r, a, u, c) {
|
|
3
3
|
var i = typeof t == "function" ? t.options : t;
|
|
4
4
|
e && (i.render = e, i.staticRenderFns = n, i._compiled = !0), d && (i.functional = !0), a && (i._scopeId = "data-v-" + a);
|
|
5
5
|
var s;
|
|
@@ -7,7 +7,7 @@ function w(t, e, n, d, r, a, u, f) {
|
|
|
7
7
|
o = o || // cached call
|
|
8
8
|
this.$vnode && this.$vnode.ssrContext || // stateful
|
|
9
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 =
|
|
10
|
+
}, i._ssrRegister = s) : r && (s = c ? function() {
|
|
11
11
|
r.call(
|
|
12
12
|
this,
|
|
13
13
|
(i.functional ? this.parent : this).$root.$options.shadowRoot
|
|
@@ -15,9 +15,9 @@ function w(t, e, n, d, r, a, u, f) {
|
|
|
15
15
|
} : r), s)
|
|
16
16
|
if (i.functional) {
|
|
17
17
|
i._injectStyles = s;
|
|
18
|
-
var
|
|
19
|
-
i.render = function(
|
|
20
|
-
return s.call(l),
|
|
18
|
+
var g = i.render;
|
|
19
|
+
i.render = function(p, l) {
|
|
20
|
+
return s.call(l), g(p, l);
|
|
21
21
|
};
|
|
22
22
|
} else {
|
|
23
23
|
var h = i.beforeCreate;
|
|
@@ -28,7 +28,7 @@ function w(t, e, n, d, r, a, u, f) {
|
|
|
28
28
|
options: i
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const m = {
|
|
32
32
|
name: "Vue2SpotWidget",
|
|
33
33
|
props: {
|
|
34
34
|
apiConfig: {
|
|
@@ -43,9 +43,10 @@ const y = {
|
|
|
43
43
|
type: Boolean,
|
|
44
44
|
default: !0
|
|
45
45
|
},
|
|
46
|
-
|
|
47
|
-
type:
|
|
48
|
-
default:
|
|
46
|
+
selection: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: f.UNSELECTED,
|
|
49
|
+
validator: (t) => Object.values(f).includes(t)
|
|
49
50
|
},
|
|
50
51
|
theme: {
|
|
51
52
|
type: Object,
|
|
@@ -114,7 +115,7 @@ const y = {
|
|
|
114
115
|
apiConfig: this.apiConfig,
|
|
115
116
|
quoteRequestData: this.quoteRequestData,
|
|
116
117
|
showTable: this.showTable,
|
|
117
|
-
|
|
118
|
+
selection: this.selection,
|
|
118
119
|
theme: this.theme,
|
|
119
120
|
callbacks: this.mergedCallbacks,
|
|
120
121
|
...this.options
|
|
@@ -147,7 +148,7 @@ const y = {
|
|
|
147
148
|
showTable: function(t, e) {
|
|
148
149
|
t !== e && this.reinitializeWidget();
|
|
149
150
|
},
|
|
150
|
-
|
|
151
|
+
selection: function(t, e) {
|
|
151
152
|
t !== e && this.reinitializeWidget();
|
|
152
153
|
},
|
|
153
154
|
theme: {
|
|
@@ -167,7 +168,7 @@ const y = {
|
|
|
167
168
|
initializeWidget() {
|
|
168
169
|
this.widget && (this.widget.destroy(), this.widget = null), this.$refs.container && (this.$refs.container.innerHTML = ""), this.$nextTick(() => {
|
|
169
170
|
try {
|
|
170
|
-
this.widget = new
|
|
171
|
+
this.widget = new w({
|
|
171
172
|
...this.widgetOptions,
|
|
172
173
|
location: this.$refs.container
|
|
173
174
|
});
|
|
@@ -206,20 +207,20 @@ const y = {
|
|
|
206
207
|
this.reinitTimeout && clearTimeout(this.reinitTimeout), this.widget && typeof this.widget.destroy == "function" && this.widget.destroy();
|
|
207
208
|
}
|
|
208
209
|
};
|
|
209
|
-
var
|
|
210
|
+
var O = function() {
|
|
210
211
|
var e = this, n = e._self._c;
|
|
211
212
|
return n("div", { ref: "container" });
|
|
212
|
-
},
|
|
213
|
-
y,
|
|
214
|
-
_,
|
|
213
|
+
}, _ = [], v = /* @__PURE__ */ y(
|
|
215
214
|
m,
|
|
215
|
+
O,
|
|
216
|
+
_,
|
|
216
217
|
!1,
|
|
217
218
|
null,
|
|
218
219
|
null,
|
|
219
220
|
null,
|
|
220
221
|
null
|
|
221
222
|
);
|
|
222
|
-
const
|
|
223
|
+
const C = v.exports;
|
|
223
224
|
export {
|
|
224
|
-
|
|
225
|
+
C as default
|
|
225
226
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(s,u){typeof exports=="object"&&typeof module<"u"?module.exports=u(require("@getspot/spot-widget")):typeof define=="function"&&define.amd?define(["@getspot/spot-widget"],u):(s=typeof globalThis<"u"?globalThis:s||self,s.Vue2SpotWidget=u(s.SpotWidget))})(this,function(s){"use strict";function u(t,e,n,a,d,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 r;if(f?(r=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__),d&&d.call(this,o),o&&o._registeredComponents&&o._registeredComponents.add(f)},i._ssrRegister=r):d&&(r=m?function(){d.call(this,(i.functional?this.parent:this).$root.$options.shadowRoot)}:d),r)if(i.functional){i._injectStyles=r;var O=i.render;i.render=function(_,c){return r.call(c),O(_,c)}}else{var l=i.beforeCreate;i.beforeCreate=l?[].concat(l,r):[r]}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},selection:{type:String,default:s.SelectionEnum.UNSELECTED,validator:t=>Object.values(s.SelectionEnum).includes(t)},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,selection:this.selection,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()},selection: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 s({...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],d=t[a],h="--"+a;this.widget.container.style.setProperty(h,d)}},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
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Vue 2 wrapper for Spot Widget",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"CHANGELOG.md"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@getspot/spot-widget": "^
|
|
17
|
+
"@getspot/spot-widget": "^4.0.1"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"vue": "^2.6.0"
|