@uniformdev/canvas-vue 12.2.0 → 12.2.1-alpha.135

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.
Files changed (41) hide show
  1. package/LICENSE.txt +1 -1
  2. package/README.md +3 -3
  3. package/dist/index.d.ts +133 -0
  4. package/dist/index.esm.js +1 -0
  5. package/dist/index.js +1 -0
  6. package/dist/index.mjs +1 -0
  7. package/package.json +28 -25
  8. package/vetur/attributes.json +26 -26
  9. package/vetur/tags.json +10 -10
  10. package/dist/cjs/components/Composition.d.ts +0 -37
  11. package/dist/cjs/components/Composition.js +0 -1
  12. package/dist/cjs/components/DefaultNotImplementedComponent.d.ts +0 -11
  13. package/dist/cjs/components/DefaultNotImplementedComponent.js +0 -1
  14. package/dist/cjs/components/SlotContent.d.ts +0 -22
  15. package/dist/cjs/components/SlotContent.js +0 -1
  16. package/dist/cjs/helpers/index.d.ts +0 -31
  17. package/dist/cjs/helpers/index.js +0 -1
  18. package/dist/cjs/index.d.ts +0 -7
  19. package/dist/cjs/index.js +0 -1
  20. package/dist/cjs/mixins/index.d.ts +0 -8
  21. package/dist/cjs/mixins/index.js +0 -1
  22. package/dist/cjs/types/index.d.ts +0 -28
  23. package/dist/cjs/types/index.js +0 -1
  24. package/dist/cjs/utils/constants.d.ts +0 -4
  25. package/dist/cjs/utils/constants.js +0 -1
  26. package/dist/esm/components/Composition.d.ts +0 -37
  27. package/dist/esm/components/Composition.js +0 -1
  28. package/dist/esm/components/DefaultNotImplementedComponent.d.ts +0 -11
  29. package/dist/esm/components/DefaultNotImplementedComponent.js +0 -1
  30. package/dist/esm/components/SlotContent.d.ts +0 -22
  31. package/dist/esm/components/SlotContent.js +0 -1
  32. package/dist/esm/helpers/index.d.ts +0 -31
  33. package/dist/esm/helpers/index.js +0 -1
  34. package/dist/esm/index.d.ts +0 -7
  35. package/dist/esm/index.js +0 -1
  36. package/dist/esm/mixins/index.d.ts +0 -8
  37. package/dist/esm/mixins/index.js +0 -1
  38. package/dist/esm/types/index.d.ts +0 -28
  39. package/dist/esm/types/index.js +0 -0
  40. package/dist/esm/utils/constants.d.ts +0 -4
  41. package/dist/esm/utils/constants.js +0 -1
package/LICENSE.txt CHANGED
@@ -1,2 +1,2 @@
1
- © 2021 Uniform Systems, Inc. All Rights Reserved.
1
+ © 2021 Uniform Systems, Inc. All Rights Reserved.
2
2
  See details of Uniform Systems, Inc. Master Subscription Agreement here: https://uniform.dev/eula
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- Vue SDK for Uniform Canvas
2
-
3
- part of the [Uniform Platform](https://uniform.app). See our [documentation](https://docs.uniform.app) for more details.
1
+ Vue SDK for Uniform Canvas
2
+
3
+ part of the [Uniform Platform](https://uniform.app). See our [documentation](https://docs.uniform.app) for more details.
@@ -0,0 +1,133 @@
1
+ import Vue, { Component } from 'vue';
2
+ import { ThisTypedComponentOptionsWithRecordProps, DefaultData, DefaultMethods, DefaultComputed } from 'vue/types/options';
3
+ import { ComponentInstance, ComponentParameter } from '@uniformdev/canvas';
4
+ import { ListPersonalizerArguments } from '@uniformdev/optimize-tracker-common';
5
+
6
+ declare type PageMetaProps = {
7
+ id: string;
8
+ name: string;
9
+ slug: string;
10
+ };
11
+ declare type CompositionProps = {
12
+ composition: ComponentInstance;
13
+ pageMeta?: PageMetaProps;
14
+ wrapper?: string | Component;
15
+ };
16
+ declare type CompositionState = DefaultData<Vue>;
17
+ declare type Methods$2 = DefaultMethods<Vue>;
18
+ declare type Computed$2 = {
19
+ slots: Record<string, unknown> | Record<string, never>;
20
+ pageMetaData: {
21
+ id?: string | undefined;
22
+ name?: string | undefined;
23
+ slug?: string | undefined;
24
+ } | Record<string, never> | undefined;
25
+ parameters: Record<string, unknown> | Record<string, never>;
26
+ componentKey: string;
27
+ };
28
+ declare type VueSetupProps$2 = ThisTypedComponentOptionsWithRecordProps<Vue, CompositionState, Methods$2, Computed$2, CompositionProps>;
29
+ /**
30
+ * Generates a Composition Vue Component
31
+ * @vue-prop {Object} composition - A dynamic vue component that provides data to the Uniform Canvas SlotContent component via provide/inject
32
+ * @vue-prop {Object} pageMeta - Page meta data that takes and ID, name and slug as an object
33
+ * @vue-prop {String | Object} wrapper - defaults to 'div' but can be passed a HTML tag as string or a Vue component
34
+ * @vue-computed {Object} slots - returns Uniform Canvas slot data
35
+ * @vue-computed {Object | undefined} pageMetaData - returns undefined or an object of keys / values (id, name, slug)
36
+ * @vue-computed {Object} parameters - returns and empty object or a object of parameters
37
+ * @vue-computed {String} componentKey - returns a generated unique key value
38
+ */
39
+ declare const Composition: VueSetupProps$2;
40
+
41
+ declare type DefaultNotImplementedComponentProps<TProps = unknown> = TProps & {
42
+ component: ComponentInstance;
43
+ };
44
+ declare type VueSetupProps$1 = ThisTypedComponentOptionsWithRecordProps<Vue, DefaultNotImplementedComponentState, Methods$1, Computed$1, DefaultNotImplementedComponentProps>;
45
+ declare type DefaultNotImplementedComponentState = DefaultData<Vue>;
46
+ declare type Methods$1 = DefaultMethods<Vue>;
47
+ declare type Computed$1 = DefaultComputed;
48
+ declare const DefaultNotImplementedComponent: VueSetupProps$1;
49
+
50
+ declare type MapComponentNameProps = {
51
+ name: string;
52
+ components: Array<ComponentInstance>;
53
+ };
54
+ declare type SlotDataProps = Record<string, any>;
55
+ declare type MapSlotDataResolve = Array<MapComponentNameProps>;
56
+ declare type PersonalizeComponetProps = {
57
+ uniformData: {
58
+ parameters?: {
59
+ trackingEventName?: ComponentParameter<string>;
60
+ count?: ComponentParameter<string | number>;
61
+ matchFilter?: ComponentParameter<ListPersonalizerArguments<any>['matchFilter']>;
62
+ };
63
+ slots?: Record<string, ComponentInstance[]>;
64
+ };
65
+ };
66
+ declare type TestComponentProps = {
67
+ uniformData: {
68
+ slots?: {
69
+ test?: ComponentInstance[];
70
+ };
71
+ parameters?: {
72
+ test?: ComponentParameter<string | undefined>;
73
+ };
74
+ };
75
+ };
76
+
77
+ declare type SlotComponentProps = {
78
+ uniformData?: Record<string, unknown>;
79
+ slotName?: string;
80
+ wrapper?: string | Component;
81
+ };
82
+ declare type SlotComponentState = DefaultData<Vue>;
83
+ declare type Methods = DefaultMethods<Vue>;
84
+ declare type Computed = {
85
+ slotItems: Array<MapComponentNameProps>;
86
+ };
87
+ /**
88
+ * Generates a SlotContent Vue Component
89
+ * @vue-prop {Object} uniformData - Optional prop
90
+ * @vue-prop {String} slotName - name of the Uniform Canvas slot you wish to scope to
91
+ * @vue-prop {String | Object} wrapper - defaults to 'div' but can be passed a HTML tag as string or a Vue component
92
+ * @vue-computed {Array} slotItems - returns an array of objects with keys "name: String, components: Array<>"
93
+ */
94
+ declare type VueSetupProps = ThisTypedComponentOptionsWithRecordProps<Vue, SlotComponentState, Methods, Computed, SlotComponentProps>;
95
+ declare const SlotContent: VueSetupProps;
96
+
97
+ /**
98
+ * Finds the data for the provide slot name
99
+ * @param {Object} slots - Array<MapSlotDataResolve> e.g. [{ name: 'string', components: [{ ... }]}]
100
+ * @param {string} name - Name of the slot that you want find within the array of slots
101
+ * @returns {Object} - Object of found slot
102
+ */
103
+ declare const getDataForSlot: (slots: Array<MapComponentNameProps>, name: string) => MapComponentNameProps | undefined;
104
+ /**
105
+ * Converts the Uniform Canvas data into an array
106
+ * @param {Object} slots -
107
+ * @returns {Array} - An array with key value pairs [{ name: 'string', components: [{ ... }]}]
108
+ */
109
+ declare const mapSlotsData: (slots: SlotDataProps) => MapSlotDataResolve;
110
+ /**
111
+ *
112
+ * @param {Object} slotData - Takes an object with name and components as key value pair
113
+ * @returns {Array} - An array with key value pairs [{ name: 'string', components: [{ ... }], intentTag: {}}]
114
+ */
115
+ declare const mapPzSlotToVariants: (slotData: MapComponentNameProps) => {
116
+ component: string;
117
+ intentTag: any;
118
+ }[];
119
+ /**
120
+ *
121
+ * @param {Object} slotData - Takes an object with name and components as key value pair
122
+ * @returns - An array with key value pairs [{ name: 'string', components: [{ ... }]}]
123
+ */
124
+ declare const mapTestSlotToVariants: (slotData: MapComponentNameProps) => {
125
+ component: string;
126
+ }[];
127
+
128
+ /** Public ID of Canvas composition component type */
129
+ declare const CANVAS_COMPOSITION_TYPE = "Composition";
130
+ /** Public ID of Canvas slot component component type */
131
+ declare const CANVAS_SLOT_CONTENT_TYPE = "SlotContent";
132
+
133
+ export { CANVAS_COMPOSITION_TYPE, CANVAS_SLOT_CONTENT_TYPE, Composition, DefaultNotImplementedComponent, MapComponentNameProps, MapSlotDataResolve, PersonalizeComponetProps, SlotComponentProps, SlotContent, SlotDataProps, TestComponentProps, getDataForSlot, mapPzSlotToVariants, mapSlotsData, mapTestSlotToVariants };
@@ -0,0 +1 @@
1
+ import{v4 as I}from"uuid";var S="Composition",D="SlotContent";var g={watch:{"$route.query"(){this.reevaluateSignals()}},mounted(){this.$nextTick(()=>{this.reevaluateSignals()})},methods:{reevaluateSignals(){this.$uniformOptimizeContext&&(this.$uniformOptimizeContext.trackerInitializing||this.$uniformOptimizeContext.tracker.reevaluateSignals())}}};var k={name:S,inheritAttrs:!1,props:{composition:{type:Object,required:!0},pageMeta:{type:Object},wrapper:{type:[String,Object],default:"div"}},mixins:[g],provide(){var t;return{$__uniformData__:(t=this.$props.composition)==null?void 0:t.slots}},computed:{slots(){return!this.$props.composition||!this.$props.composition.slots?{}:this.$props.composition.slots},pageMetaData(){var t,o,e;if(!!this.$props.pageMeta)return Object.keys(this.$props.pageMeta).length?{id:(t=this.$props.pageMeta)==null?void 0:t.id,name:(o=this.$props.pageMeta)==null?void 0:o.name,slug:(e=this.$props.pageMeta)==null?void 0:e.slug}:{}},parameters(){var t;return!this.$props.composition||!((t=this.$props.composition)==null?void 0:t.parameters)?{}:this.$props.composition.parameters},componentKey(){return`uniform-composition-${I()}`}},render(t){return Object.keys(this.slots).length&&this.$scopedSlots.default?t(this.wrapper,{key:this.componentKey,attrs:{...this.$attrs}},this.$scopedSlots.default({slots:this.slots,parameters:this.parameters})):Object.keys(this.slots).length===0&&this.$scopedSlots.default?t(this.wrapper,{key:this.componentKey,attrs:{...this.$attrs}},this.$scopedSlots.default({slots:this.slots,parameters:this.parameters})):t(this.wrapper,{key:this.componentKey,attrs:{...this.$attrs}},this.$slots.default)}};var _={borderLeft:"10px solid #e42535",background:"rgba(122, 215, 218, 0.3)",color:"#1d3557",padding:"1rem",textAlign:"left",margin:"1rem 5vw"},v={margin:"0 0 1rem"},E={name:"default-not-implemented-component",inheritAttrs:!1,props:{component:{type:Object,required:!0}},render(t){var e;let o=(e=this.component)==null?void 0:e.type;return t("div",{key:"content",style:{..._}},[t("h2",{style:{...v}},`Component: ${o}`),t("p",[t("strong",`${o} has no Vue implementation. It may need to be added to your `),t("code",{},"resolveRenderer() function.")]),t("details",{},[t("summary",{},"props"),t("pre",{style:{overflowX:"auto"}},`${JSON.stringify(this.$props)}`)])])}};import{pascalCase as N}from"pascal-case";import{CANVAS_PERSONALIZE_TYPE as x,CANVAS_TEST_TYPE as M,mapSlotToPersonalizedVariations as w}from"@uniformdev/canvas";import{Personalize as R,Test as b}from"@uniformdev/optimize-tracker-vue";import{pascalCase as $}from"pascal-case";var T=(t,o)=>t.find(e=>e.name===o),C=t=>{let o=[];for(let e in t)o.push({name:e,components:t[e]});return o},J=t=>{let o=e=>(delete e.parameters.intentTag,e);return t.components.map(e=>{var r;return{component:$(e.type),intentTag:((r=e.parameters.intentTag)==null?void 0:r.value)||{intents:{}},...o(e)}})},X=t=>{let o=e=>e;return t.components.map(e=>({component:$(e.type),...o(e)}))};var A={name:D,inheritAttrs:!1,props:{uniformData:{type:Object},slotName:{type:String,required:!0},wrapper:{type:[String,Object],default:"div"}},inject:["$__uniformData__"],computed:{slotItems(){return this.uniformData?C(this.uniformData):C(this.$__uniformData__)}},render(t){if(this.slotItems){if(this.slotName){let o=T(this.slotItems,this.slotName),e=o==null?void 0:o.components.map((r,p)=>{let n={uniformData:r};if(r.type===M)return O(t,n,`${r.type}-${p}`);if(r.type===x)return V(t,n,`${r.type}-${p}`);let s=N(r.type);return t(s,{props:n,attrs:{...this.$attrs},key:`${s}-${p}`})});return t(this.wrapper,{key:this.slotName,props:{...this.$props},attrs:{...this.$attrs}},e)}if(!this.slotName){let o=this.slotItems.map((e,r)=>{let p=e==null?void 0:e.components.map((n,s)=>{let i={uniformData:n};if(n.type===M)return O(t,i,`${n.type}-${s}`);if(n.type===x)return V(t,i,`${n.type}-${s}`);let m=N(n.type);return t(m,{props:i,attrs:{...this.$attrs},key:`${m}-${s}`})});return t(this.wrapper,{key:`${e.name}-${r}`},p)});return t(this.wrapper,{key:"slot-content",props:{...this.$props},attrs:{...this.$attrs}},o)}}return t(this.wrapper,{key:"slot-content",props:{...this.$props},attrs:{...this.$attrs}},this.$slots.default)}};function z(t){if(typeof(t==null?void 0:t.value)=="string")return t.value}function V(t,o,e){var s,i,m,d,c;let r=o.uniformData,p=r==null?void 0:r.parameters,n=w((s=r==null?void 0:r.slots)==null?void 0:s.pz);return t(R,{props:{variations:n,count:Number((m=(i=p==null?void 0:p.count)==null?void 0:i.value)!=null?m:1),trackingEventName:(d=p==null?void 0:p.trackingEventName)==null?void 0:d.value,matchFilter:(c=p==null?void 0:p.matchFilter)==null?void 0:c.value},key:e,scopedSlots:{default:f=>f.variations.map((a,y)=>t(a.type,{props:{uniformData:a},key:`${a.type}-${y}`}))}})}function O(t,o,e){var s,i,m,d,c,f;let r=(m=(i=(s=o.uniformData)==null?void 0:s.slots)==null?void 0:i.test)!=null?m:[],p=((f=(c=(d=o.uniformData)==null?void 0:d.parameters)==null?void 0:c.test)==null?void 0:f.value)||"Untitled Test",n=r.map((a,y)=>{var h,P;return{...a,id:(P=z((h=a.parameters)==null?void 0:h.testId))!=null?P:`variation-${y+1}-${a.type}`}});return t(b,{props:{variations:n,name:p},key:e,scopedSlots:{default:({variant:a})=>t(a.type,{key:`${a.type}-${e}`,props:{uniformData:a}})}})}export{S as CANVAS_COMPOSITION_TYPE,D as CANVAS_SLOT_CONTENT_TYPE,k as Composition,E as DefaultNotImplementedComponent,A as SlotContent,T as getDataForSlot,J as mapPzSlotToVariants,C as mapSlotsData,X as mapTestSlotToVariants};
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ var P=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var b=t=>P(t,"__esModule",{value:!0});var A=(t,o)=>{for(var e in o)P(t,e,{get:o[e],enumerable:!0})},z=(t,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of w(o))!R.call(t,p)&&(e||p!=="default")&&P(t,p,{get:()=>o[p],enumerable:!(r=E(o,p))||r.enumerable});return t};var j=(t=>(o,e)=>t&&t.get(o)||(e=z(b({}),o,1),t&&t.set(o,e),e))(typeof WeakMap!="undefined"?new WeakMap:0);var K={};A(K,{CANVAS_COMPOSITION_TYPE:()=>S,CANVAS_SLOT_CONTENT_TYPE:()=>D,Composition:()=>O,DefaultNotImplementedComponent:()=>I,SlotContent:()=>k,getDataForSlot:()=>$,mapPzSlotToVariants:()=>L,mapSlotsData:()=>y,mapTestSlotToVariants:()=>q});var V=require("uuid");var S="Composition",D="SlotContent";var M={watch:{"$route.query"(){this.reevaluateSignals()}},mounted(){this.$nextTick(()=>{this.reevaluateSignals()})},methods:{reevaluateSignals(){this.$uniformOptimizeContext&&(this.$uniformOptimizeContext.trackerInitializing||this.$uniformOptimizeContext.tracker.reevaluateSignals())}}};var O={name:S,inheritAttrs:!1,props:{composition:{type:Object,required:!0},pageMeta:{type:Object},wrapper:{type:[String,Object],default:"div"}},mixins:[M],provide(){var t;return{$__uniformData__:(t=this.$props.composition)==null?void 0:t.slots}},computed:{slots(){return!this.$props.composition||!this.$props.composition.slots?{}:this.$props.composition.slots},pageMetaData(){var t,o,e;if(!!this.$props.pageMeta)return Object.keys(this.$props.pageMeta).length?{id:(t=this.$props.pageMeta)==null?void 0:t.id,name:(o=this.$props.pageMeta)==null?void 0:o.name,slug:(e=this.$props.pageMeta)==null?void 0:e.slug}:{}},parameters(){var t;return!this.$props.composition||!((t=this.$props.composition)==null?void 0:t.parameters)?{}:this.$props.composition.parameters},componentKey(){return`uniform-composition-${(0,V.v4)()}`}},render(t){return Object.keys(this.slots).length&&this.$scopedSlots.default?t(this.wrapper,{key:this.componentKey,attrs:{...this.$attrs}},this.$scopedSlots.default({slots:this.slots,parameters:this.parameters})):Object.keys(this.slots).length===0&&this.$scopedSlots.default?t(this.wrapper,{key:this.componentKey,attrs:{...this.$attrs}},this.$scopedSlots.default({slots:this.slots,parameters:this.parameters})):t(this.wrapper,{key:this.componentKey,attrs:{...this.$attrs}},this.$slots.default)}};var W={borderLeft:"10px solid #e42535",background:"rgba(122, 215, 218, 0.3)",color:"#1d3557",padding:"1rem",textAlign:"left",margin:"1rem 5vw"},Y={margin:"0 0 1rem"},I={name:"default-not-implemented-component",inheritAttrs:!1,props:{component:{type:Object,required:!0}},render(t){var e;let o=(e=this.component)==null?void 0:e.type;return t("div",{key:"content",style:{...W}},[t("h2",{style:{...Y}},`Component: ${o}`),t("p",[t("strong",`${o} has no Vue implementation. It may need to be added to your `),t("code",{},"resolveRenderer() function.")]),t("details",{},[t("summary",{},"props"),t("pre",{style:{overflowX:"auto"}},`${JSON.stringify(this.$props)}`)])])}};var T=require("pascal-case"),u=require("@uniformdev/canvas"),C=require("@uniformdev/optimize-tracker-vue");var g=require("pascal-case"),$=(t,o)=>t.find(e=>e.name===o),y=t=>{let o=[];for(let e in t)o.push({name:e,components:t[e]});return o},L=t=>{let o=e=>(delete e.parameters.intentTag,e);return t.components.map(e=>{var r;return{component:(0,g.pascalCase)(e.type),intentTag:((r=e.parameters.intentTag)==null?void 0:r.value)||{intents:{}},...o(e)}})},q=t=>{let o=e=>e;return t.components.map(e=>({component:(0,g.pascalCase)(e.type),...o(e)}))};var k={name:D,inheritAttrs:!1,props:{uniformData:{type:Object},slotName:{type:String,required:!0},wrapper:{type:[String,Object],default:"div"}},inject:["$__uniformData__"],computed:{slotItems(){return this.uniformData?y(this.uniformData):y(this.$__uniformData__)}},render(t){if(this.slotItems){if(this.slotName){let o=$(this.slotItems,this.slotName),e=o==null?void 0:o.components.map((r,p)=>{let n={uniformData:r};if(r.type===u.CANVAS_TEST_TYPE)return v(t,n,`${r.type}-${p}`);if(r.type===u.CANVAS_PERSONALIZE_TYPE)return _(t,n,`${r.type}-${p}`);let s=(0,T.pascalCase)(r.type);return t(s,{props:n,attrs:{...this.$attrs},key:`${s}-${p}`})});return t(this.wrapper,{key:this.slotName,props:{...this.$props},attrs:{...this.$attrs}},e)}if(!this.slotName){let o=this.slotItems.map((e,r)=>{let p=e==null?void 0:e.components.map((n,s)=>{let i={uniformData:n};if(n.type===u.CANVAS_TEST_TYPE)return v(t,i,`${n.type}-${s}`);if(n.type===u.CANVAS_PERSONALIZE_TYPE)return _(t,i,`${n.type}-${s}`);let m=(0,T.pascalCase)(n.type);return t(m,{props:i,attrs:{...this.$attrs},key:`${m}-${s}`})});return t(this.wrapper,{key:`${e.name}-${r}`},p)});return t(this.wrapper,{key:"slot-content",props:{...this.$props},attrs:{...this.$attrs}},o)}}return t(this.wrapper,{key:"slot-content",props:{...this.$props},attrs:{...this.$attrs}},this.$slots.default)}};function F(t){if(typeof(t==null?void 0:t.value)=="string")return t.value}function _(t,o,e){var s,i,m,d,c;let r=o.uniformData,p=r==null?void 0:r.parameters,n=(0,u.mapSlotToPersonalizedVariations)((s=r==null?void 0:r.slots)==null?void 0:s.pz);return t(C.Personalize,{props:{variations:n,count:Number((m=(i=p==null?void 0:p.count)==null?void 0:i.value)!=null?m:1),trackingEventName:(d=p==null?void 0:p.trackingEventName)==null?void 0:d.value,matchFilter:(c=p==null?void 0:p.matchFilter)==null?void 0:c.value},key:e,scopedSlots:{default:f=>f.variations.map((a,h)=>t(a.type,{props:{uniformData:a},key:`${a.type}-${h}`}))}})}function v(t,o,e){var s,i,m,d,c,f;let r=(m=(i=(s=o.uniformData)==null?void 0:s.slots)==null?void 0:i.test)!=null?m:[],p=((f=(c=(d=o.uniformData)==null?void 0:d.parameters)==null?void 0:c.test)==null?void 0:f.value)||"Untitled Test",n=r.map((a,h)=>{var N,x;return{...a,id:(x=F((N=a.parameters)==null?void 0:N.testId))!=null?x:`variation-${h+1}-${a.type}`}});return t(C.Test,{props:{variations:n,name:p},key:e,scopedSlots:{default:({variant:a})=>t(a.type,{key:`${a.type}-${e}`,props:{uniformData:a}})}})}module.exports=j(K);0&&(module.exports={CANVAS_COMPOSITION_TYPE,CANVAS_SLOT_CONTENT_TYPE,Composition,DefaultNotImplementedComponent,SlotContent,getDataForSlot,mapPzSlotToVariants,mapSlotsData,mapTestSlotToVariants});
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{v4 as I}from"uuid";var S="Composition",D="SlotContent";var g={watch:{"$route.query"(){this.reevaluateSignals()}},mounted(){this.$nextTick(()=>{this.reevaluateSignals()})},methods:{reevaluateSignals(){this.$uniformOptimizeContext&&(this.$uniformOptimizeContext.trackerInitializing||this.$uniformOptimizeContext.tracker.reevaluateSignals())}}};var k={name:S,inheritAttrs:!1,props:{composition:{type:Object,required:!0},pageMeta:{type:Object},wrapper:{type:[String,Object],default:"div"}},mixins:[g],provide(){var t;return{$__uniformData__:(t=this.$props.composition)==null?void 0:t.slots}},computed:{slots(){return!this.$props.composition||!this.$props.composition.slots?{}:this.$props.composition.slots},pageMetaData(){var t,o,e;if(!!this.$props.pageMeta)return Object.keys(this.$props.pageMeta).length?{id:(t=this.$props.pageMeta)==null?void 0:t.id,name:(o=this.$props.pageMeta)==null?void 0:o.name,slug:(e=this.$props.pageMeta)==null?void 0:e.slug}:{}},parameters(){var t;return!this.$props.composition||!((t=this.$props.composition)==null?void 0:t.parameters)?{}:this.$props.composition.parameters},componentKey(){return`uniform-composition-${I()}`}},render(t){return Object.keys(this.slots).length&&this.$scopedSlots.default?t(this.wrapper,{key:this.componentKey,attrs:{...this.$attrs}},this.$scopedSlots.default({slots:this.slots,parameters:this.parameters})):Object.keys(this.slots).length===0&&this.$scopedSlots.default?t(this.wrapper,{key:this.componentKey,attrs:{...this.$attrs}},this.$scopedSlots.default({slots:this.slots,parameters:this.parameters})):t(this.wrapper,{key:this.componentKey,attrs:{...this.$attrs}},this.$slots.default)}};var _={borderLeft:"10px solid #e42535",background:"rgba(122, 215, 218, 0.3)",color:"#1d3557",padding:"1rem",textAlign:"left",margin:"1rem 5vw"},v={margin:"0 0 1rem"},E={name:"default-not-implemented-component",inheritAttrs:!1,props:{component:{type:Object,required:!0}},render(t){var e;let o=(e=this.component)==null?void 0:e.type;return t("div",{key:"content",style:{..._}},[t("h2",{style:{...v}},`Component: ${o}`),t("p",[t("strong",`${o} has no Vue implementation. It may need to be added to your `),t("code",{},"resolveRenderer() function.")]),t("details",{},[t("summary",{},"props"),t("pre",{style:{overflowX:"auto"}},`${JSON.stringify(this.$props)}`)])])}};import{pascalCase as N}from"pascal-case";import{CANVAS_PERSONALIZE_TYPE as x,CANVAS_TEST_TYPE as M,mapSlotToPersonalizedVariations as w}from"@uniformdev/canvas";import{Personalize as R,Test as b}from"@uniformdev/optimize-tracker-vue";import{pascalCase as $}from"pascal-case";var T=(t,o)=>t.find(e=>e.name===o),C=t=>{let o=[];for(let e in t)o.push({name:e,components:t[e]});return o},J=t=>{let o=e=>(delete e.parameters.intentTag,e);return t.components.map(e=>{var r;return{component:$(e.type),intentTag:((r=e.parameters.intentTag)==null?void 0:r.value)||{intents:{}},...o(e)}})},X=t=>{let o=e=>e;return t.components.map(e=>({component:$(e.type),...o(e)}))};var A={name:D,inheritAttrs:!1,props:{uniformData:{type:Object},slotName:{type:String,required:!0},wrapper:{type:[String,Object],default:"div"}},inject:["$__uniformData__"],computed:{slotItems(){return this.uniformData?C(this.uniformData):C(this.$__uniformData__)}},render(t){if(this.slotItems){if(this.slotName){let o=T(this.slotItems,this.slotName),e=o==null?void 0:o.components.map((r,p)=>{let n={uniformData:r};if(r.type===M)return O(t,n,`${r.type}-${p}`);if(r.type===x)return V(t,n,`${r.type}-${p}`);let s=N(r.type);return t(s,{props:n,attrs:{...this.$attrs},key:`${s}-${p}`})});return t(this.wrapper,{key:this.slotName,props:{...this.$props},attrs:{...this.$attrs}},e)}if(!this.slotName){let o=this.slotItems.map((e,r)=>{let p=e==null?void 0:e.components.map((n,s)=>{let i={uniformData:n};if(n.type===M)return O(t,i,`${n.type}-${s}`);if(n.type===x)return V(t,i,`${n.type}-${s}`);let m=N(n.type);return t(m,{props:i,attrs:{...this.$attrs},key:`${m}-${s}`})});return t(this.wrapper,{key:`${e.name}-${r}`},p)});return t(this.wrapper,{key:"slot-content",props:{...this.$props},attrs:{...this.$attrs}},o)}}return t(this.wrapper,{key:"slot-content",props:{...this.$props},attrs:{...this.$attrs}},this.$slots.default)}};function z(t){if(typeof(t==null?void 0:t.value)=="string")return t.value}function V(t,o,e){var s,i,m,d,c;let r=o.uniformData,p=r==null?void 0:r.parameters,n=w((s=r==null?void 0:r.slots)==null?void 0:s.pz);return t(R,{props:{variations:n,count:Number((m=(i=p==null?void 0:p.count)==null?void 0:i.value)!=null?m:1),trackingEventName:(d=p==null?void 0:p.trackingEventName)==null?void 0:d.value,matchFilter:(c=p==null?void 0:p.matchFilter)==null?void 0:c.value},key:e,scopedSlots:{default:f=>f.variations.map((a,y)=>t(a.type,{props:{uniformData:a},key:`${a.type}-${y}`}))}})}function O(t,o,e){var s,i,m,d,c,f;let r=(m=(i=(s=o.uniformData)==null?void 0:s.slots)==null?void 0:i.test)!=null?m:[],p=((f=(c=(d=o.uniformData)==null?void 0:d.parameters)==null?void 0:c.test)==null?void 0:f.value)||"Untitled Test",n=r.map((a,y)=>{var h,P;return{...a,id:(P=z((h=a.parameters)==null?void 0:h.testId))!=null?P:`variation-${y+1}-${a.type}`}});return t(b,{props:{variations:n,name:p},key:e,scopedSlots:{default:({variant:a})=>t(a.type,{key:`${a.type}-${e}`,props:{uniformData:a}})}})}export{S as CANVAS_COMPOSITION_TYPE,D as CANVAS_SLOT_CONTENT_TYPE,k as Composition,E as DefaultNotImplementedComponent,A as SlotContent,T as getDataForSlot,J as mapPzSlotToVariants,C as mapSlotsData,X as mapTestSlotToVariants};
package/package.json CHANGED
@@ -1,50 +1,53 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-vue",
3
- "version": "12.2.0",
3
+ "version": "12.2.1-alpha.135+7a372e5f",
4
4
  "description": "Vue SDK for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
- "main": "./dist/cjs/index.js",
7
- "module": "./dist/esm/index.js",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.esm.js",
8
8
  "exports": {
9
- "import": "./dist/esm/index.js",
10
- "require": "./dist/cjs/index.js"
9
+ "import": {
10
+ "node": "./dist/index.mjs",
11
+ "default": "./dist/index.esm.js"
12
+ },
13
+ "require": "./dist/index.js"
11
14
  },
12
- "types": "./dist/cjs/index.d.ts",
15
+ "types": "./dist/index.d.ts",
13
16
  "sideEffects": false,
14
17
  "scripts": {
15
- "build": "run-p build:cjs build:esm",
16
- "build:esm": "tsc",
17
- "build:cjs": "tsc -p ./tsconfig.cjs.json",
18
- "dev": "run-p dev:esm dev:cjs",
19
- "dev:esm": "tsc -w",
20
- "dev:cjs": "tsc -w -p ./tsconfig.cjs.json",
18
+ "build": "tsup",
19
+ "dev": "tsup --watch",
21
20
  "clean": "rimraf dist",
22
21
  "test": "jest --maxWorkers=1 --passWithNoTests",
23
22
  "lint": "eslint \"src/**/*.{js,ts,tsx}\"",
24
23
  "format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
25
24
  "ci:verify": "run-p lint test",
26
- "ci:build": "run-s clean build"
25
+ "ci:build": "tsup --minify --clean"
27
26
  },
28
27
  "dependencies": {
29
- "@uniformdev/canvas": "^12.2.0",
30
- "@uniformdev/optimize-common": "^12.2.0",
31
- "@uniformdev/optimize-tracker-browser": "^12.2.0",
32
- "@uniformdev/optimize-tracker-vue": "^12.2.0",
33
- "pascal-case": "^3.1.2"
28
+ "@uniformdev/canvas": "^12.2.1-alpha.135+7a372e5f",
29
+ "@uniformdev/optimize-common": "^12.2.1-alpha.135+7a372e5f",
30
+ "@uniformdev/optimize-tracker-browser": "^12.2.1-alpha.135+7a372e5f",
31
+ "@uniformdev/optimize-tracker-common": "^12.2.1-alpha.135+7a372e5f",
32
+ "@uniformdev/optimize-tracker-vue": "^12.2.1-alpha.135+7a372e5f",
33
+ "@vue/test-utils": "1.3.0",
34
+ "pascal-case": "^3.1.2",
35
+ "uuid": "^8.3.2"
34
36
  },
35
37
  "peerDependencies": {
36
38
  "vue": ">=2.6 <3.0"
37
39
  },
38
40
  "devDependencies": {
39
41
  "@testing-library/vue": "5.8.2",
40
- "@types/jest": "27.0.2",
41
- "@types/node": "16.7.1",
42
- "@vue/server-test-utils": "1.2.1",
43
- "eslint": "7.32.0",
44
- "jest": "27.3.1",
42
+ "@types/jest": "27.4.0",
43
+ "@types/node": "16.11.21",
44
+ "@vue/server-test-utils": "1.3.0",
45
+ "eslint": "8.7.0",
46
+ "jest": "27.4.7",
45
47
  "npm-run-all": "4.1.5",
46
48
  "rimraf": "3.0.2",
47
- "ts-jest": "27.0.7",
49
+ "ts-jest": "27.1.3",
50
+ "tsup": "5.11.11",
48
51
  "vue": "2.6.14",
49
52
  "vue-server-renderer": "2.6.14",
50
53
  "vue-template-compiler": "2.6.14"
@@ -66,5 +69,5 @@
66
69
  "last 2 versions",
67
70
  "not dead"
68
71
  ],
69
- "gitHead": "f3fd2aeff34cf986ccb1c2d50e5920151beeafe9"
72
+ "gitHead": "7a372e5f5dddf0b615e61d765f5545d0dc642216"
70
73
  }
@@ -1,26 +1,26 @@
1
- {
2
- "composition/composition": {
3
- "type": "object",
4
- "description": "The Uniform canvas data to be used from a prop or via provide/inject using $__uniformData__"
5
- },
6
- "composition/page-meta": {
7
- "type": "object",
8
- "description": "Object includes id: string, name: string and slug: string, that is converted to page meta data"
9
- },
10
- "composition/wrapper": {
11
- "type": "string | Component",
12
- "description": "HTML tag name or a component. Defaults to `\"div\""
13
- },
14
- "slot-content/uniform-data": {
15
- "type": "object",
16
- "description": "Data that can be used as a named prop or provided by inject/provide from the Composition component"
17
- },
18
- "slot-content/slot-name": {
19
- "type": "string",
20
- "description": "The Uniform canvas slot name to render"
21
- },
22
- "slot-content/wrapper": {
23
- "type": "string | Component",
24
- "description": "HTML tag name or a component. Defaults to `\"div\""
25
- }
26
- }
1
+ {
2
+ "composition/composition": {
3
+ "type": "object",
4
+ "description": "The Uniform canvas data to be used from a prop or via provide/inject using $__uniformData__"
5
+ },
6
+ "composition/page-meta": {
7
+ "type": "object",
8
+ "description": "Object includes id: string, name: string and slug: string, that is converted to page meta data"
9
+ },
10
+ "composition/wrapper": {
11
+ "type": "string | Component",
12
+ "description": "HTML tag name or a component. Defaults to `\"div\""
13
+ },
14
+ "slot-content/uniform-data": {
15
+ "type": "object",
16
+ "description": "Data that can be used as a named prop or provided by inject/provide from the Composition component"
17
+ },
18
+ "slot-content/slot-name": {
19
+ "type": "string",
20
+ "description": "The Uniform canvas slot name to render"
21
+ },
22
+ "slot-content/wrapper": {
23
+ "type": "string | Component",
24
+ "description": "HTML tag name or a component. Defaults to `\"div\""
25
+ }
26
+ }
package/vetur/tags.json CHANGED
@@ -1,10 +1,10 @@
1
- {
2
- "composition": {
3
- "attributes": ["composition", "page-meta", "wrapper"],
4
- "description": "Component that wraps around and provides uniformData to the SlotContent component"
5
- },
6
- "slot-content": {
7
- "attributes": ["uniform-data", "slot-name", "wrapper"],
8
- "description": "Component to render Uniform Canvas components"
9
- }
10
- }
1
+ {
2
+ "composition": {
3
+ "attributes": ["composition", "page-meta", "wrapper"],
4
+ "description": "Component that wraps around and provides uniformData to the SlotContent component"
5
+ },
6
+ "slot-content": {
7
+ "attributes": ["uniform-data", "slot-name", "wrapper"],
8
+ "description": "Component to render Uniform Canvas components"
9
+ }
10
+ }
@@ -1,37 +0,0 @@
1
- import Vue, { Component } from 'vue';
2
- import { DefaultMethods, ThisTypedComponentOptionsWithRecordProps, DefaultData } from 'vue/types/options';
3
- import { ComponentInstance } from '@uniformdev/canvas';
4
- export declare type PageMetaProps = {
5
- id: string;
6
- name: string;
7
- slug: string;
8
- };
9
- export declare type CompositionProps = {
10
- composition: ComponentInstance;
11
- pageMeta?: PageMetaProps;
12
- wrapper?: string | Component;
13
- };
14
- export declare type CompositionState = DefaultData<Vue>;
15
- export declare type Methods = DefaultMethods<Vue>;
16
- export declare type Computed = {
17
- slots: Record<string, unknown> | Record<string, never>;
18
- pageMetaData: {
19
- id?: string | undefined;
20
- name?: string | undefined;
21
- slug?: string | undefined;
22
- } | Record<string, never> | undefined;
23
- parameters: Record<string, unknown> | Record<string, never>;
24
- componentKey: string;
25
- };
26
- export declare type VueSetupProps = ThisTypedComponentOptionsWithRecordProps<Vue, CompositionState, Methods, Computed, CompositionProps>;
27
- /**
28
- * Generates a Composition Vue Component
29
- * @vue-prop {Object} composition - A dynamic vue component that provides data to the Uniform Canvas SlotContent component via provide/inject
30
- * @vue-prop {Object} pageMeta - Page meta data that takes and ID, name and slug as an object
31
- * @vue-prop {String | Object} wrapper - defaults to 'div' but can be passed a HTML tag as string or a Vue component
32
- * @vue-computed {Object} slots - returns Uniform Canvas slot data
33
- * @vue-computed {Object | undefined} pageMetaData - returns undefined or an object of keys / values (id, name, slug)
34
- * @vue-computed {Object} parameters - returns and empty object or a object of parameters
35
- * @vue-computed {String} componentKey - returns a generated unique key value
36
- */
37
- export declare const Composition: VueSetupProps;
@@ -1 +0,0 @@
1
- "use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,o=arguments.length;i<o;i++)for(var e in s=arguments[i])Object.prototype.hasOwnProperty.call(s,e)&&(t[e]=s[e]);return t}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Composition=void 0;var uuid_1=require("uuid"),constants_1=require("./../utils/constants"),mixins_1=require("./../mixins");exports.Composition={name:constants_1.CANVAS_COMPOSITION_TYPE,inheritAttrs:!1,props:{composition:{type:Object,required:!0},pageMeta:{type:Object},wrapper:{type:[String,Object],default:"div"}},mixins:[mixins_1.UniformOptimizeMixin],provide:function(){var t;return{$__uniformData__:null===(t=this.$props.composition)||void 0===t?void 0:t.slots}},computed:{slots:function(){return this.$props.composition&&this.$props.composition.slots?this.$props.composition.slots:{}},pageMetaData:function(){var t;if(this.$props.pageMeta)return Object.keys(this.$props.pageMeta).length?{id:null===(t=this.$props.pageMeta)||void 0===t?void 0:t.id,name:null===(t=this.$props.pageMeta)||void 0===t?void 0:t.name,slug:null===(t=this.$props.pageMeta)||void 0===t?void 0:t.slug}:{}},parameters:function(){var t;return this.$props.composition&&null!==(t=this.$props.composition)&&void 0!==t&&t.parameters?this.$props.composition.parameters:{}},componentKey:function(){return"uniform-composition-"+(0,uuid_1.v4)()}},render:function(t){return Object.keys(this.slots).length&&this.$scopedSlots.default||0===Object.keys(this.slots).length&&this.$scopedSlots.default?t(this.wrapper,{key:this.componentKey,attrs:__assign({},this.$attrs)},this.$scopedSlots.default({slots:this.slots,parameters:this.parameters})):t(this.wrapper,{key:this.componentKey,attrs:__assign({},this.$attrs)},this.$slots.default)}};
@@ -1,11 +0,0 @@
1
- import Vue from 'vue';
2
- import { DefaultMethods, ThisTypedComponentOptionsWithRecordProps, DefaultComputed, DefaultData } from 'vue/types/options';
3
- import { ComponentInstance } from '@uniformdev/canvas';
4
- export declare type DefaultNotImplementedComponentProps<TProps = unknown> = TProps & {
5
- component: ComponentInstance;
6
- };
7
- export declare type VueSetupProps = ThisTypedComponentOptionsWithRecordProps<Vue, DefaultNotImplementedComponentState, Methods, Computed, DefaultNotImplementedComponentProps>;
8
- export declare type DefaultNotImplementedComponentState = DefaultData<Vue>;
9
- export declare type Methods = DefaultMethods<Vue>;
10
- export declare type Computed = DefaultComputed;
11
- export declare const DefaultNotImplementedComponent: VueSetupProps;
@@ -1 +0,0 @@
1
- "use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.DefaultNotImplementedComponent=void 0;var inlineStyles={borderLeft:"10px solid #e42535",background:"rgba(122, 215, 218, 0.3)",color:"#1d3557",padding:"1rem",textAlign:"left",margin:"1rem 5vw"},headingStyle={margin:"0 0 1rem"};exports.DefaultNotImplementedComponent={name:"default-not-implemented-component",inheritAttrs:!1,props:{component:{type:Object,required:!0}},render:function(e){var t=null===(t=this.component)||void 0===t?void 0:t.type;return e("div",{key:"content",style:__assign({},inlineStyles)},[e("h2",{style:__assign({},headingStyle)},"Component: "+t),e("p",[e("strong",t+" has no Vue implementation. It may need to be added to your "),e("code",{},"resolveRenderer() function.")]),e("details",{},[e("summary",{},"props"),e("pre",{style:{overflowX:"auto"}},""+JSON.stringify(this.$props))])])}};
@@ -1,22 +0,0 @@
1
- import Vue, { Component } from 'vue';
2
- import { DefaultMethods, ThisTypedComponentOptionsWithRecordProps, DefaultData } from 'vue/types/options';
3
- import { MapComponentNameProps } from './../types';
4
- export declare type SlotComponentProps = {
5
- uniformData?: Record<string, unknown>;
6
- slotName?: string;
7
- wrapper?: string | Component;
8
- };
9
- export declare type SlotComponentState = DefaultData<Vue>;
10
- export declare type Methods = DefaultMethods<Vue>;
11
- export declare type Computed = {
12
- slotItems: Array<MapComponentNameProps>;
13
- };
14
- /**
15
- * Generates a SlotContent Vue Component
16
- * @vue-prop {Object} uniformData - Optional prop
17
- * @vue-prop {String} slotName - name of the Uniform Canvas slot you wish to scope to
18
- * @vue-prop {String | Object} wrapper - defaults to 'div' but can be passed a HTML tag as string or a Vue component
19
- * @vue-computed {Array} slotItems - returns an array of objects with keys "name: String, components: Array<>"
20
- */
21
- export declare type VueSetupProps = ThisTypedComponentOptionsWithRecordProps<Vue, SlotComponentState, Methods, Computed, SlotComponentProps>;
22
- export declare const SlotContent: VueSetupProps;
@@ -1 +0,0 @@
1
- "use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,a=arguments.length;r<a;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SlotContent=void 0;var pascal_case_1=require("pascal-case"),canvas_1=require("@uniformdev/canvas"),optimize_tracker_vue_1=require("@uniformdev/optimize-tracker-vue"),helpers_1=require("./../helpers"),constants_1=require("./../utils/constants");function paramValueIfString(t){if("string"==typeof(null==t?void 0:t.value))return t.value}function renderPersonalizeComponent(r,t,e){var a=t.uniformData,t=null==a?void 0:a.parameters,a=(0,canvas_1.mapSlotToPersonalizedVariations)(null===(a=null==a?void 0:a.slots)||void 0===a?void 0:a.pz);return r(optimize_tracker_vue_1.Personalize,{props:{variations:a,count:Number(null!==(a=null===(a=null==t?void 0:t.count)||void 0===a?void 0:a.value)&&void 0!==a?a:1),trackingEventName:null===(a=null==t?void 0:t.trackingEventName)||void 0===a?void 0:a.value,matchFilter:null===(t=null==t?void 0:t.matchFilter)||void 0===t?void 0:t.value},key:e,scopedSlots:{default:function(t){return t.variations.map(function(t,e){return r(t.type,{props:{uniformData:t},key:t.type+"-"+e})})}}})}function renderTestComponent(e,t,r){var a=null!==(a=null===(a=null===(a=t.uniformData)||void 0===a?void 0:a.slots)||void 0===a?void 0:a.test)&&void 0!==a?a:[],t=(null===(t=null===(t=null===(t=t.uniformData)||void 0===t?void 0:t.parameters)||void 0===t?void 0:t.test)||void 0===t?void 0:t.value)||"Untitled Test",a=a.map(function(t,e){var r;return __assign(__assign({},t),{id:null!==(r=paramValueIfString(null===(r=t.parameters)||void 0===r?void 0:r.testId))&&void 0!==r?r:"variation-"+(e+1)+"-"+t.type})});return e(optimize_tracker_vue_1.Test,{props:{variations:a,name:t},key:r,scopedSlots:{default:function(t){t=t.variant;return e(t.type,{key:t.type+"-"+r,props:{uniformData:t}})}}})}exports.SlotContent={name:constants_1.CANVAS_SLOT_CONTENT_TYPE,inheritAttrs:!1,props:{uniformData:{type:Object},slotName:{type:String,required:!0},wrapper:{type:[String,Object],default:"div"}},inject:["$__uniformData__"],computed:{slotItems:function(){return this.uniformData?(0,helpers_1.mapSlotsData)(this.uniformData):(0,helpers_1.mapSlotsData)(this.$__uniformData__)}},render:function(a){var n=this;if(this.slotItems){if(this.slotName){var t=(0,helpers_1.getDataForSlot)(this.slotItems,this.slotName),t=null==t?void 0:t.components.map(function(t,e){var r={uniformData:t};if(t.type===canvas_1.CANVAS_TEST_TYPE)return renderTestComponent(a,r,t.type+"-"+e);if(t.type===canvas_1.CANVAS_PERSONALIZE_TYPE)return renderPersonalizeComponent(a,r,t.type+"-"+e);t=(0,pascal_case_1.pascalCase)(t.type);return a(t,{props:r,attrs:__assign({},n.$attrs),key:t+"-"+e})});return a(this.wrapper,{key:this.slotName,props:__assign({},this.$props),attrs:__assign({},this.$attrs)},t)}if(!this.slotName){t=this.slotItems.map(function(t,e){var r=null==t?void 0:t.components.map(function(t,e){var r={uniformData:t};if(t.type===canvas_1.CANVAS_TEST_TYPE)return renderTestComponent(a,r,t.type+"-"+e);if(t.type===canvas_1.CANVAS_PERSONALIZE_TYPE)return renderPersonalizeComponent(a,r,t.type+"-"+e);t=(0,pascal_case_1.pascalCase)(t.type);return a(t,{props:r,attrs:__assign({},n.$attrs),key:t+"-"+e})});return a(n.wrapper,{key:t.name+"-"+e},r)});return a(this.wrapper,{key:"slot-content",props:__assign({},this.$props),attrs:__assign({},this.$attrs)},t)}}return a(this.wrapper,{key:"slot-content",props:__assign({},this.$props),attrs:__assign({},this.$attrs)},this.$slots.default)}};
@@ -1,31 +0,0 @@
1
- import { SlotDataProps, MapSlotDataResolve, MapComponentNameProps } from './../types';
2
- /**
3
- * Finds the data for the provide slot name
4
- * @param {Object} slots - Array<MapSlotDataResolve> e.g. [{ name: 'string', components: [{ ... }]}]
5
- * @param {string} name - Name of the slot that you want find within the array of slots
6
- * @returns {Object} - Object of found slot
7
- */
8
- export declare const getDataForSlot: (slots: Array<MapComponentNameProps>, name: string) => MapComponentNameProps | undefined;
9
- /**
10
- * Converts the Uniform Canvas data into an array
11
- * @param {Object} slots -
12
- * @returns {Array} - An array with key value pairs [{ name: 'string', components: [{ ... }]}]
13
- */
14
- export declare const mapSlotsData: (slots: SlotDataProps) => MapSlotDataResolve;
15
- /**
16
- *
17
- * @param {Object} slotData - Takes an object with name and components as key value pair
18
- * @returns {Array} - An array with key value pairs [{ name: 'string', components: [{ ... }], intentTag: {}}]
19
- */
20
- export declare const mapPzSlotToVariants: (slotData: MapComponentNameProps) => {
21
- component: string;
22
- intentTag: any;
23
- }[];
24
- /**
25
- *
26
- * @param {Object} slotData - Takes an object with name and components as key value pair
27
- * @returns - An array with key value pairs [{ name: 'string', components: [{ ... }]}]
28
- */
29
- export declare const mapTestSlotToVariants: (slotData: MapComponentNameProps) => {
30
- component: string;
31
- }[];
@@ -1 +0,0 @@
1
- "use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var a,e=1,n=arguments.length;e<n;e++)for(var o in a=arguments[e])Object.prototype.hasOwnProperty.call(a,o)&&(t[o]=a[o]);return t}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.mapTestSlotToVariants=exports.mapPzSlotToVariants=exports.mapSlotsData=exports.getDataForSlot=void 0;var pascal_case_1=require("pascal-case"),getDataForSlot=function(t,a){return t.find(function(t){return t.name===a})};exports.getDataForSlot=getDataForSlot;var mapSlotsData=function(t){var a,e=[];for(a in t)e.push({name:a,components:t[a]});return e};exports.mapSlotsData=mapSlotsData;var mapPzSlotToVariants=function(t){return t.components.map(function(t){var a;return __assign({component:(0,pascal_case_1.pascalCase)(t.type),intentTag:(null===(a=t.parameters.intentTag)||void 0===a?void 0:a.value)||{intents:{}}},(delete(t=t).parameters.intentTag,t))})};exports.mapPzSlotToVariants=mapPzSlotToVariants;var mapTestSlotToVariants=function(t){return t.components.map(function(t){return __assign({component:(0,pascal_case_1.pascalCase)(t.type)},t)})};exports.mapTestSlotToVariants=mapTestSlotToVariants;
@@ -1,7 +0,0 @@
1
- export { Composition } from './components/Composition';
2
- export { DefaultNotImplementedComponent } from './components/DefaultNotImplementedComponent';
3
- export { SlotContent } from './components/SlotContent';
4
- export * from './helpers';
5
- export * from './utils/constants';
6
- export type { SlotComponentProps } from './components/SlotContent';
7
- export type { MapComponentNameProps, PersonalizeComponetProps, TestComponentProps, SlotDataProps, MapSlotDataResolve, } from './types';
package/dist/cjs/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,o,n){void 0===n&&(n=o),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,n){e[n=void 0===n?o:n]=t[o]}),__exportStar=this&&this.__exportStar||function(e,t){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(t,o)||__createBinding(t,e,o)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SlotContent=exports.DefaultNotImplementedComponent=exports.Composition=void 0;var Composition_1=require("./components/Composition");Object.defineProperty(exports,"Composition",{enumerable:!0,get:function(){return Composition_1.Composition}});var DefaultNotImplementedComponent_1=require("./components/DefaultNotImplementedComponent");Object.defineProperty(exports,"DefaultNotImplementedComponent",{enumerable:!0,get:function(){return DefaultNotImplementedComponent_1.DefaultNotImplementedComponent}});var SlotContent_1=require("./components/SlotContent");Object.defineProperty(exports,"SlotContent",{enumerable:!0,get:function(){return SlotContent_1.SlotContent}}),__exportStar(require("./helpers"),exports),__exportStar(require("./utils/constants"),exports);
@@ -1,8 +0,0 @@
1
- import Vue from 'vue';
2
- import { DefaultMethods, ThisTypedComponentOptionsWithRecordProps, DefaultData, DefaultComputed, DefaultProps } from 'vue/types/options';
3
- export declare type CompositionState = DefaultData<Vue>;
4
- export declare type Methods = DefaultMethods<Vue>;
5
- export declare type Computed = DefaultComputed;
6
- export declare type MixinProps = DefaultProps;
7
- export declare type VueSetupProps = ThisTypedComponentOptionsWithRecordProps<Vue, CompositionState, Methods, Computed, MixinProps>;
8
- export declare const UniformOptimizeMixin: VueSetupProps;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UniformOptimizeMixin=void 0,exports.UniformOptimizeMixin={watch:{"$route.query":function(){this.reevaluateSignals()}},mounted:function(){var i=this;this.$nextTick(function(){i.reevaluateSignals()})},methods:{reevaluateSignals:function(){this.$uniformOptimizeContext&&(this.$uniformOptimizeContext.trackerInitializing||this.$uniformOptimizeContext.tracker.reevaluateSignals())}}};
@@ -1,28 +0,0 @@
1
- import { ComponentInstance, ComponentParameter } from '@uniformdev/canvas';
2
- import { ListPersonalizerArguments } from '@uniformdev/optimize-tracker-common';
3
- export declare type MapComponentNameProps = {
4
- name: string;
5
- components: Array<ComponentInstance>;
6
- };
7
- export declare type SlotDataProps = Record<string, any>;
8
- export declare type MapSlotDataResolve = Array<MapComponentNameProps>;
9
- export declare type PersonalizeComponetProps = {
10
- uniformData: {
11
- parameters?: {
12
- trackingEventName?: ComponentParameter<string>;
13
- count?: ComponentParameter<string | number>;
14
- matchFilter?: ComponentParameter<ListPersonalizerArguments<any>['matchFilter']>;
15
- };
16
- slots?: Record<string, ComponentInstance[]>;
17
- };
18
- };
19
- export declare type TestComponentProps = {
20
- uniformData: {
21
- slots?: {
22
- test?: ComponentInstance[];
23
- };
24
- parameters?: {
25
- test?: ComponentParameter<string | undefined>;
26
- };
27
- };
28
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
@@ -1,4 +0,0 @@
1
- /** Public ID of Canvas composition component type */
2
- export declare const CANVAS_COMPOSITION_TYPE = "Composition";
3
- /** Public ID of Canvas slot component component type */
4
- export declare const CANVAS_SLOT_CONTENT_TYPE = "SlotContent";
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CANVAS_SLOT_CONTENT_TYPE=exports.CANVAS_COMPOSITION_TYPE=void 0,exports.CANVAS_COMPOSITION_TYPE="Composition",exports.CANVAS_SLOT_CONTENT_TYPE="SlotContent";
@@ -1,37 +0,0 @@
1
- import Vue, { Component } from 'vue';
2
- import { DefaultMethods, ThisTypedComponentOptionsWithRecordProps, DefaultData } from 'vue/types/options';
3
- import { ComponentInstance } from '@uniformdev/canvas';
4
- export declare type PageMetaProps = {
5
- id: string;
6
- name: string;
7
- slug: string;
8
- };
9
- export declare type CompositionProps = {
10
- composition: ComponentInstance;
11
- pageMeta?: PageMetaProps;
12
- wrapper?: string | Component;
13
- };
14
- export declare type CompositionState = DefaultData<Vue>;
15
- export declare type Methods = DefaultMethods<Vue>;
16
- export declare type Computed = {
17
- slots: Record<string, unknown> | Record<string, never>;
18
- pageMetaData: {
19
- id?: string | undefined;
20
- name?: string | undefined;
21
- slug?: string | undefined;
22
- } | Record<string, never> | undefined;
23
- parameters: Record<string, unknown> | Record<string, never>;
24
- componentKey: string;
25
- };
26
- export declare type VueSetupProps = ThisTypedComponentOptionsWithRecordProps<Vue, CompositionState, Methods, Computed, CompositionProps>;
27
- /**
28
- * Generates a Composition Vue Component
29
- * @vue-prop {Object} composition - A dynamic vue component that provides data to the Uniform Canvas SlotContent component via provide/inject
30
- * @vue-prop {Object} pageMeta - Page meta data that takes and ID, name and slug as an object
31
- * @vue-prop {String | Object} wrapper - defaults to 'div' but can be passed a HTML tag as string or a Vue component
32
- * @vue-computed {Object} slots - returns Uniform Canvas slot data
33
- * @vue-computed {Object | undefined} pageMetaData - returns undefined or an object of keys / values (id, name, slug)
34
- * @vue-computed {Object} parameters - returns and empty object or a object of parameters
35
- * @vue-computed {String} componentKey - returns a generated unique key value
36
- */
37
- export declare const Composition: VueSetupProps;
@@ -1 +0,0 @@
1
- var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,o=arguments.length;i<o;i++)for(var e in s=arguments[i])Object.prototype.hasOwnProperty.call(s,e)&&(t[e]=s[e]);return t}).apply(this,arguments)};import{v4 as uuidv4}from"uuid";import{CANVAS_COMPOSITION_TYPE}from"./../utils/constants";import{UniformOptimizeMixin}from"./../mixins";var Composition={name:CANVAS_COMPOSITION_TYPE,inheritAttrs:!1,props:{composition:{type:Object,required:!0},pageMeta:{type:Object},wrapper:{type:[String,Object],default:"div"}},mixins:[UniformOptimizeMixin],provide:function(){var t;return{$__uniformData__:null===(t=this.$props.composition)||void 0===t?void 0:t.slots}},computed:{slots:function(){return this.$props.composition&&this.$props.composition.slots?this.$props.composition.slots:{}},pageMetaData:function(){var t;if(this.$props.pageMeta)return Object.keys(this.$props.pageMeta).length?{id:null===(t=this.$props.pageMeta)||void 0===t?void 0:t.id,name:null===(t=this.$props.pageMeta)||void 0===t?void 0:t.name,slug:null===(t=this.$props.pageMeta)||void 0===t?void 0:t.slug}:{}},parameters:function(){var t;return this.$props.composition&&null!==(t=this.$props.composition)&&void 0!==t&&t.parameters?this.$props.composition.parameters:{}},componentKey:function(){return"uniform-composition-"+uuidv4()}},render:function(t){return Object.keys(this.slots).length&&this.$scopedSlots.default||0===Object.keys(this.slots).length&&this.$scopedSlots.default?t(this.wrapper,{key:this.componentKey,attrs:__assign({},this.$attrs)},this.$scopedSlots.default({slots:this.slots,parameters:this.parameters})):t(this.wrapper,{key:this.componentKey,attrs:__assign({},this.$attrs)},this.$slots.default)}};export{Composition};
@@ -1,11 +0,0 @@
1
- import Vue from 'vue';
2
- import { DefaultMethods, ThisTypedComponentOptionsWithRecordProps, DefaultComputed, DefaultData } from 'vue/types/options';
3
- import { ComponentInstance } from '@uniformdev/canvas';
4
- export declare type DefaultNotImplementedComponentProps<TProps = unknown> = TProps & {
5
- component: ComponentInstance;
6
- };
7
- export declare type VueSetupProps = ThisTypedComponentOptionsWithRecordProps<Vue, DefaultNotImplementedComponentState, Methods, Computed, DefaultNotImplementedComponentProps>;
8
- export declare type DefaultNotImplementedComponentState = DefaultData<Vue>;
9
- export declare type Methods = DefaultMethods<Vue>;
10
- export declare type Computed = DefaultComputed;
11
- export declare const DefaultNotImplementedComponent: VueSetupProps;
@@ -1 +0,0 @@
1
- var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},inlineStyles={borderLeft:"10px solid #e42535",background:"rgba(122, 215, 218, 0.3)",color:"#1d3557",padding:"1rem",textAlign:"left",margin:"1rem 5vw"},headingStyle={margin:"0 0 1rem"},DefaultNotImplementedComponent={name:"default-not-implemented-component",inheritAttrs:!1,props:{component:{type:Object,required:!0}},render:function(e){var t=null===(t=this.component)||void 0===t?void 0:t.type;return e("div",{key:"content",style:__assign({},inlineStyles)},[e("h2",{style:__assign({},headingStyle)},"Component: "+t),e("p",[e("strong",t+" has no Vue implementation. It may need to be added to your "),e("code",{},"resolveRenderer() function.")]),e("details",{},[e("summary",{},"props"),e("pre",{style:{overflowX:"auto"}},""+JSON.stringify(this.$props))])])}};export{DefaultNotImplementedComponent};
@@ -1,22 +0,0 @@
1
- import Vue, { Component } from 'vue';
2
- import { DefaultMethods, ThisTypedComponentOptionsWithRecordProps, DefaultData } from 'vue/types/options';
3
- import { MapComponentNameProps } from './../types';
4
- export declare type SlotComponentProps = {
5
- uniformData?: Record<string, unknown>;
6
- slotName?: string;
7
- wrapper?: string | Component;
8
- };
9
- export declare type SlotComponentState = DefaultData<Vue>;
10
- export declare type Methods = DefaultMethods<Vue>;
11
- export declare type Computed = {
12
- slotItems: Array<MapComponentNameProps>;
13
- };
14
- /**
15
- * Generates a SlotContent Vue Component
16
- * @vue-prop {Object} uniformData - Optional prop
17
- * @vue-prop {String} slotName - name of the Uniform Canvas slot you wish to scope to
18
- * @vue-prop {String | Object} wrapper - defaults to 'div' but can be passed a HTML tag as string or a Vue component
19
- * @vue-computed {Array} slotItems - returns an array of objects with keys "name: String, components: Array<>"
20
- */
21
- export declare type VueSetupProps = ThisTypedComponentOptionsWithRecordProps<Vue, SlotComponentState, Methods, Computed, SlotComponentProps>;
22
- export declare const SlotContent: VueSetupProps;
@@ -1 +0,0 @@
1
- var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t}).apply(this,arguments)};import{pascalCase}from"pascal-case";import{CANVAS_PERSONALIZE_TYPE,CANVAS_TEST_TYPE,mapSlotToPersonalizedVariations}from"@uniformdev/canvas";import{Personalize,Test}from"@uniformdev/optimize-tracker-vue";import{mapSlotsData,getDataForSlot}from"./../helpers";import{CANVAS_SLOT_CONTENT_TYPE}from"./../utils/constants";var SlotContent={name:CANVAS_SLOT_CONTENT_TYPE,inheritAttrs:!1,props:{uniformData:{type:Object},slotName:{type:String,required:!0},wrapper:{type:[String,Object],default:"div"}},inject:["$__uniformData__"],computed:{slotItems:function(){return this.uniformData?mapSlotsData(this.uniformData):mapSlotsData(this.$__uniformData__)}},render:function(n){var a=this;if(this.slotItems){if(this.slotName){var t=getDataForSlot(this.slotItems,this.slotName),t=null==t?void 0:t.components.map(function(t,r){var e={uniformData:t};if(t.type===CANVAS_TEST_TYPE)return renderTestComponent(n,e,t.type+"-"+r);if(t.type===CANVAS_PERSONALIZE_TYPE)return renderPersonalizeComponent(n,e,t.type+"-"+r);t=pascalCase(t.type);return n(t,{props:e,attrs:__assign({},a.$attrs),key:t+"-"+r})});return n(this.wrapper,{key:this.slotName,props:__assign({},this.$props),attrs:__assign({},this.$attrs)},t)}if(!this.slotName){t=this.slotItems.map(function(t,r){var e=null==t?void 0:t.components.map(function(t,r){var e={uniformData:t};if(t.type===CANVAS_TEST_TYPE)return renderTestComponent(n,e,t.type+"-"+r);if(t.type===CANVAS_PERSONALIZE_TYPE)return renderPersonalizeComponent(n,e,t.type+"-"+r);t=pascalCase(t.type);return n(t,{props:e,attrs:__assign({},a.$attrs),key:t+"-"+r})});return n(a.wrapper,{key:t.name+"-"+r},e)});return n(this.wrapper,{key:"slot-content",props:__assign({},this.$props),attrs:__assign({},this.$attrs)},t)}}return n(this.wrapper,{key:"slot-content",props:__assign({},this.$props),attrs:__assign({},this.$attrs)},this.$slots.default)}};function paramValueIfString(t){if("string"==typeof(null==t?void 0:t.value))return t.value}function renderPersonalizeComponent(e,t,r){var n=t.uniformData,t=null==n?void 0:n.parameters,n=mapSlotToPersonalizedVariations(null===(n=null==n?void 0:n.slots)||void 0===n?void 0:n.pz);return e(Personalize,{props:{variations:n,count:Number(null!==(n=null===(n=null==t?void 0:t.count)||void 0===n?void 0:n.value)&&void 0!==n?n:1),trackingEventName:null===(n=null==t?void 0:t.trackingEventName)||void 0===n?void 0:n.value,matchFilter:null===(t=null==t?void 0:t.matchFilter)||void 0===t?void 0:t.value},key:r,scopedSlots:{default:function(t){return t.variations.map(function(t,r){return e(t.type,{props:{uniformData:t},key:t.type+"-"+r})})}}})}function renderTestComponent(r,t,e){var n=null!==(n=null===(n=null===(n=t.uniformData)||void 0===n?void 0:n.slots)||void 0===n?void 0:n.test)&&void 0!==n?n:[],t=(null===(t=null===(t=null===(t=t.uniformData)||void 0===t?void 0:t.parameters)||void 0===t?void 0:t.test)||void 0===t?void 0:t.value)||"Untitled Test",n=n.map(function(t,r){var e;return __assign(__assign({},t),{id:null!==(e=paramValueIfString(null===(e=t.parameters)||void 0===e?void 0:e.testId))&&void 0!==e?e:"variation-"+(r+1)+"-"+t.type})});return r(Test,{props:{variations:n,name:t},key:e,scopedSlots:{default:function(t){t=t.variant;return r(t.type,{key:t.type+"-"+e,props:{uniformData:t}})}}})}export{SlotContent};
@@ -1,31 +0,0 @@
1
- import { SlotDataProps, MapSlotDataResolve, MapComponentNameProps } from './../types';
2
- /**
3
- * Finds the data for the provide slot name
4
- * @param {Object} slots - Array<MapSlotDataResolve> e.g. [{ name: 'string', components: [{ ... }]}]
5
- * @param {string} name - Name of the slot that you want find within the array of slots
6
- * @returns {Object} - Object of found slot
7
- */
8
- export declare const getDataForSlot: (slots: Array<MapComponentNameProps>, name: string) => MapComponentNameProps | undefined;
9
- /**
10
- * Converts the Uniform Canvas data into an array
11
- * @param {Object} slots -
12
- * @returns {Array} - An array with key value pairs [{ name: 'string', components: [{ ... }]}]
13
- */
14
- export declare const mapSlotsData: (slots: SlotDataProps) => MapSlotDataResolve;
15
- /**
16
- *
17
- * @param {Object} slotData - Takes an object with name and components as key value pair
18
- * @returns {Array} - An array with key value pairs [{ name: 'string', components: [{ ... }], intentTag: {}}]
19
- */
20
- export declare const mapPzSlotToVariants: (slotData: MapComponentNameProps) => {
21
- component: string;
22
- intentTag: any;
23
- }[];
24
- /**
25
- *
26
- * @param {Object} slotData - Takes an object with name and components as key value pair
27
- * @returns - An array with key value pairs [{ name: 'string', components: [{ ... }]}]
28
- */
29
- export declare const mapTestSlotToVariants: (slotData: MapComponentNameProps) => {
30
- component: string;
31
- }[];
@@ -1 +0,0 @@
1
- var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var n,a=1,e=arguments.length;a<e;a++)for(var o in n=arguments[a])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)};import{pascalCase}from"pascal-case";var getDataForSlot=function(t,n){return t.find(function(t){return t.name===n})},mapSlotsData=function(t){var n,a=[];for(n in t)a.push({name:n,components:t[n]});return a},mapPzSlotToVariants=function(t){return t.components.map(function(t){var n;return __assign({component:pascalCase(t.type),intentTag:(null===(n=t.parameters.intentTag)||void 0===n?void 0:n.value)||{intents:{}}},(delete(t=t).parameters.intentTag,t))})},mapTestSlotToVariants=function(t){return t.components.map(function(t){return __assign({component:pascalCase(t.type)},t)})};export{getDataForSlot,mapSlotsData,mapPzSlotToVariants,mapTestSlotToVariants};
@@ -1,7 +0,0 @@
1
- export { Composition } from './components/Composition';
2
- export { DefaultNotImplementedComponent } from './components/DefaultNotImplementedComponent';
3
- export { SlotContent } from './components/SlotContent';
4
- export * from './helpers';
5
- export * from './utils/constants';
6
- export type { SlotComponentProps } from './components/SlotContent';
7
- export type { MapComponentNameProps, PersonalizeComponetProps, TestComponentProps, SlotDataProps, MapSlotDataResolve, } from './types';
package/dist/esm/index.js DELETED
@@ -1 +0,0 @@
1
- export{Composition}from"./components/Composition";export{DefaultNotImplementedComponent}from"./components/DefaultNotImplementedComponent";export{SlotContent}from"./components/SlotContent";export*from"./helpers";export*from"./utils/constants";
@@ -1,8 +0,0 @@
1
- import Vue from 'vue';
2
- import { DefaultMethods, ThisTypedComponentOptionsWithRecordProps, DefaultData, DefaultComputed, DefaultProps } from 'vue/types/options';
3
- export declare type CompositionState = DefaultData<Vue>;
4
- export declare type Methods = DefaultMethods<Vue>;
5
- export declare type Computed = DefaultComputed;
6
- export declare type MixinProps = DefaultProps;
7
- export declare type VueSetupProps = ThisTypedComponentOptionsWithRecordProps<Vue, CompositionState, Methods, Computed, MixinProps>;
8
- export declare const UniformOptimizeMixin: VueSetupProps;
@@ -1 +0,0 @@
1
- var UniformOptimizeMixin={watch:{"$route.query":function(){this.reevaluateSignals()}},mounted:function(){var i=this;this.$nextTick(function(){i.reevaluateSignals()})},methods:{reevaluateSignals:function(){this.$uniformOptimizeContext&&(this.$uniformOptimizeContext.trackerInitializing||this.$uniformOptimizeContext.tracker.reevaluateSignals())}}};export{UniformOptimizeMixin};
@@ -1,28 +0,0 @@
1
- import { ComponentInstance, ComponentParameter } from '@uniformdev/canvas';
2
- import { ListPersonalizerArguments } from '@uniformdev/optimize-tracker-common';
3
- export declare type MapComponentNameProps = {
4
- name: string;
5
- components: Array<ComponentInstance>;
6
- };
7
- export declare type SlotDataProps = Record<string, any>;
8
- export declare type MapSlotDataResolve = Array<MapComponentNameProps>;
9
- export declare type PersonalizeComponetProps = {
10
- uniformData: {
11
- parameters?: {
12
- trackingEventName?: ComponentParameter<string>;
13
- count?: ComponentParameter<string | number>;
14
- matchFilter?: ComponentParameter<ListPersonalizerArguments<any>['matchFilter']>;
15
- };
16
- slots?: Record<string, ComponentInstance[]>;
17
- };
18
- };
19
- export declare type TestComponentProps = {
20
- uniformData: {
21
- slots?: {
22
- test?: ComponentInstance[];
23
- };
24
- parameters?: {
25
- test?: ComponentParameter<string | undefined>;
26
- };
27
- };
28
- };
File without changes
@@ -1,4 +0,0 @@
1
- /** Public ID of Canvas composition component type */
2
- export declare const CANVAS_COMPOSITION_TYPE = "Composition";
3
- /** Public ID of Canvas slot component component type */
4
- export declare const CANVAS_SLOT_CONTENT_TYPE = "SlotContent";
@@ -1 +0,0 @@
1
- var CANVAS_COMPOSITION_TYPE="Composition",CANVAS_SLOT_CONTENT_TYPE="SlotContent";export{CANVAS_COMPOSITION_TYPE,CANVAS_SLOT_CONTENT_TYPE};