@uniformdev/context-vue 16.0.1-alpha.128 → 16.0.1-alpha.143

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/LICENSE.txt ADDED
@@ -0,0 +1,2 @@
1
+ © 2022 Uniform Systems, Inc. All Rights Reserved.
2
+ See details of Uniform Systems, Inc. Master Subscription Agreement here: https://uniform.dev/eula
package/README.md CHANGED
@@ -1,16 +1,3 @@
1
- # Vue 3 + TypeScript + Vite
1
+ Vue SDK for Uniform Context
2
2
 
3
- This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4
-
5
- ## Recommended IDE Setup
6
-
7
- - [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
8
-
9
- ## Type Support For `.vue` Imports in TS
10
-
11
- Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
12
-
13
- 1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
14
- 2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
15
-
16
- You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
3
+ part of the [Uniform Platform](https://uniform.app). See our [documentation](https://docs.uniform.app) for more details.
package/dist/index.d.ts CHANGED
@@ -1,265 +1,90 @@
1
- import type { a0 } from '@uniformdev/context/dist/types-876fb8b8';
2
- import type { AllowedComponentProps } from 'vue';
3
- import { Component } from 'vue';
4
- import type { ComponentCustomProps } from 'vue';
5
- import type { ComponentOptionsMixin } from 'vue';
6
- import type { ComputedOptions } from 'vue';
7
- import type { ComputedRef } from 'vue';
8
- import { Context } from '@uniformdev/context';
9
- import type { d } from '@uniformdev/context/dist/types-876fb8b8';
10
- import type { DefineComponent } from 'vue';
11
- import { EdgeTestComponentOptions } from '@uniformdev/context';
12
- import type { ExtractPropTypes } from 'vue';
13
- import { InjectionKey } from 'vue';
14
- import type { MethodOptions } from 'vue';
15
- import type { PersonalizedVariant } from '@uniformdev/context';
16
- import { Quirks } from '@uniformdev/context';
17
- import type { Ref } from 'vue';
18
- import type { RendererElement } from 'vue';
19
- import type { RendererNode } from 'vue';
20
- import { ScoreVector } from '@uniformdev/context';
21
- import type { ScriptType } from '@uniformdev/context';
22
- import { TestVariant } from '@uniformdev/context';
23
- import type { VNode } from 'vue';
24
- import type { VNodeProps } from 'vue';
25
-
26
- export declare type EdgeTestListComponentOptions<TVariation extends TestVariant> = {
27
- components?: Component<TVariation>[];
28
- variations: TVariation[];
29
- options: EdgeTestComponentOptions;
30
- };
31
-
32
- export declare const initPersonalizeStore: ({ personalized }: PersonalizationContextProps) => void;
33
-
34
- export declare const initStore: ({ context, outputType }: UniformContextProps) => void;
35
-
36
- export declare type PersonalizationContextProps = {
37
- personalized?: boolean;
38
- };
39
-
40
- export declare const Personalize: DefineComponent<{
41
- name: {
42
- type: StringConstructor;
43
- required: true;
44
- };
45
- variations: {
46
- type: ArrayConstructor;
47
- required: true;
48
- };
49
- component: {
50
- type: null;
51
- required: true;
52
- };
53
- count: {
54
- type: NumberConstructor;
55
- required: false;
56
- };
57
- }, {
58
- outputType: VariantOutputType;
59
- props: {
60
- /**
61
- * Name of the personalized placement. Should be unique to this placement location and set of variants.
62
- * This name is emitted to analytics after personalization executes.
63
- */
64
- name: string;
65
- /** The possible variations of the content to render depending on personalization conditions */
66
- variations: PersonalizedVariant[];
67
- /** A Vue component to use to render a selected variant. */
68
- component: PersonalizedVariationComponent<PersonalizedVariant>;
69
- /** A React component that will be used to wrap all personalized variants. If no variants match, the wrapper is not rendered. */
70
- /** The number of variations to select. Use for personalized lists where the `count` most relevant should be shown. */
71
- count?: number | undefined;
72
- };
73
- personalizeComponent: ComputedRef<DefineComponent<{
74
- name: {
75
- type: StringConstructor;
76
- required: true;
77
- };
78
- variations: {
79
- type: ArrayConstructor;
80
- required: true;
81
- };
82
- component: {
83
- type: null;
84
- required: true;
85
- };
86
- count: {
87
- type: NumberConstructor;
88
- required: false; /** The number of variations to select. Use for personalized lists where the `count` most relevant should be shown. */
89
- };
90
- }, {
91
- context: a0;
92
- scores: Ref<d>;
93
- personalized: ComputedRef<{
94
- personalizedVariations: PersonalizedVariant[];
95
- personalizationOccurred: boolean;
96
- } | undefined>;
97
- PersonalizeProvider: DefineComponent<{
98
- personalized: {
99
- type: BooleanConstructor;
100
- required: false;
101
- };
102
- }, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
103
- personalized: {
104
- type: BooleanConstructor;
105
- required: false;
106
- };
107
- }>>, {
108
- personalized: boolean;
109
- }>;
110
- }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
111
- name: {
112
- type: StringConstructor;
113
- required: true;
114
- };
115
- variations: {
116
- type: ArrayConstructor;
117
- required: true;
118
- };
119
- component: {
120
- type: null;
121
- required: true;
122
- };
123
- count: {
124
- type: NumberConstructor;
125
- required: false; /** The number of variations to select. Use for personalized lists where the `count` most relevant should be shown. */
126
- };
127
- }>>, {}> | DefineComponent<{
128
- name: {
129
- type: StringConstructor;
130
- required: true; /** The number of variations to select. Use for personalized lists where the `count` most relevant should be shown. */
131
- }; /** The number of variations to select. Use for personalized lists where the `count` most relevant should be shown. */
132
- variations: {
133
- type: ArrayConstructor;
134
- required: true;
135
- };
136
- component: {
137
- type: null;
138
- required: true;
139
- };
140
- count: {
141
- type: NumberConstructor;
142
- required: false;
143
- };
144
- }, {
145
- options: number;
146
- ScriptType: typeof ScriptType;
147
- /** The number of variations to select. Use for personalized lists where the `count` most relevant should be shown. */
148
- EdgeTag: (props: Record<string, unknown>) => VNode<RendererNode, RendererElement, {
149
- [key: string]: any;
150
- }>;
151
- }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
152
- name: {
153
- type: StringConstructor;
154
- required: true; /** The number of variations to select. Use for personalized lists where the `count` most relevant should be shown. */
155
- }; /** The number of variations to select. Use for personalized lists where the `count` most relevant should be shown. */
156
- variations: {
157
- type: ArrayConstructor;
158
- required: true;
159
- };
160
- component: {
161
- type: null;
162
- required: true;
163
- };
164
- count: {
165
- type: NumberConstructor;
166
- required: false;
167
- };
168
- }>>, {}>>;
169
- }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
170
- name: {
171
- type: StringConstructor;
172
- required: true;
173
- };
174
- variations: {
175
- type: ArrayConstructor;
176
- required: true;
177
- };
178
- component: {
179
- type: null;
180
- required: true;
181
- };
182
- count: {
183
- type: NumberConstructor;
184
- required: false;
185
- };
186
- }>>, {}>;
187
-
188
- declare type PersonalizedVariationComponent<TVariation> = Component<TVariation & {
189
- personalizationResult: {
190
- variation: PersonalizedVariant;
191
- personalizationOccurred: boolean;
192
- };
193
- }>;
194
-
195
- export declare const Test: DefineComponent<unknown, object, {}, ComputedOptions, MethodOptions, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<unknown>, {}>;
196
-
197
- export declare interface TestComponentProps {
198
- /** Name of the test that is running. */
199
- name: string;
200
- /** Variation list that this test will selected from. */
201
- variations: TestVariant[];
202
- /**
203
- * Determines what should be rendered if testing is in a "loading" state.
204
- * default: shows the default variation while loading
205
- * none: shows nothing while loading
206
- * Vue component: shows the component while loading
207
- */
208
- loadingMode?: 'default' | 'none' | Component;
209
- /** A Vue component to use to render the test variant. */
210
- component?: Component<TestVariant>;
211
- }
212
-
213
- export declare type TestEdgeComponentProps = Omit<TestComponentProps, 'selectedVariantId'>;
214
-
215
- export declare const Track: DefineComponent<unknown, object, {}, ComputedOptions, MethodOptions, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<unknown>, {}>;
216
-
217
- export declare const TrackSlot: DefineComponent<unknown, object, {}, ComputedOptions, MethodOptions, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<unknown>, {}>;
218
-
219
- export declare type UniformContextProps = {
220
- context: Context;
221
- outputType?: VariantOutputType;
222
- };
223
-
224
- export declare const UniformContextProvider: DefineComponent<{
225
- context: {
226
- type: null;
227
- required: true;
228
- };
229
- }, {
230
- props: {
231
- context: Context;
232
- };
233
- }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
234
- context: {
235
- type: null;
236
- required: true;
237
- };
238
- }>>, {}>;
239
-
240
- export declare const uniformContextStoreProps: InjectionKey<UniformContextProps>;
241
-
242
- export declare const useIsPersonalized: (key: InjectionKey<PersonalizationContextProps>, fallback?: PersonalizationContextProps | undefined) => {
243
- personalized?: boolean | undefined;
244
- };
245
-
246
- /**
247
- * Provides reactive access to the Uniform Context's current visitor quirks values
248
- * This can be used when you want to read current quirk values directly.
249
- */
250
- export declare const useQuirks: () => Ref<Quirks>;
251
-
252
- /**
253
- * Provides reactive access to the Uniform Context's current visitor scores values.
254
- * This can be used when you want to read current score values directly.
255
- */
256
- export declare const useScores: () => Ref<ScoreVector>;
257
-
258
- export declare const useUniformContext: (key: InjectionKey<UniformContextProps>, fallback?: UniformContextProps | undefined) => {
259
- context: Context;
260
- outputType?: VariantOutputType;
261
- };
262
-
263
- export declare type VariantOutputType = 'edge' | 'standard' | undefined;
264
-
265
- export { }
1
+ import * as vue_demi from 'vue-demi';
2
+ import { Component, InjectionKey, provide } from 'vue-demi';
3
+ import { TestVariant, EdgeTestComponentOptions, Context } from '@uniformdev/context';
4
+
5
+ declare const Test: Component;
6
+
7
+ declare const UniformContextProvider: Component;
8
+
9
+ declare const Personalize: Component;
10
+
11
+ declare const PersonalizeStandard: Component;
12
+
13
+ declare const Track: Component;
14
+
15
+ /**
16
+ * Tracks visitor behavior by adding enrichment score when they are shown a route with this component on it.
17
+ *
18
+ * NOTE: if you wish to track on the visitor seeing the content in the browser viewport instead,
19
+ * use Track instead of TrackFragment.
20
+ */
21
+
22
+ declare const TrackSlot: Component;
23
+
24
+ interface TestComponentProps {
25
+ /** Name of the test that is running. */
26
+ name: string;
27
+ /** Variation list that this test will selected from. */
28
+ variations: TestVariant[];
29
+ /**
30
+ * Determines what should be rendered if testing is in a "loading" state.
31
+ * default: shows the default variation while loading
32
+ * none: shows nothing while loading
33
+ * Vue component: shows the component while loading
34
+ */
35
+ loadingMode?: 'default' | 'none' | Component;
36
+ /** A Vue component to use to render the test variant. */
37
+ component?: Component<TestVariant>;
38
+ }
39
+ declare type TestEdgeComponentProps = Omit<TestComponentProps, 'selectedVariantId'>;
40
+ declare type EdgeTestListComponentOptions<TVariation extends TestVariant> = {
41
+ components?: Component<TVariation>[];
42
+ variations: TVariation[];
43
+ options: EdgeTestComponentOptions;
44
+ };
45
+
46
+ declare type VariantOutputType = 'edge' | 'standard' | undefined;
47
+ declare type UniformContextProps = {
48
+ /** The configured Uniform Context instance to provide */
49
+ context: Context;
50
+ /** The output type to emit.
51
+ * - `standard` - Emits selected variants as HTML suitable for SSR or SSG
52
+ * - `edge` - Emits all variants suitable for Edge-side personalization selection
53
+ *
54
+ * @default standard
55
+ */
56
+ outputType?: VariantOutputType;
57
+ /**
58
+ * Whether to track a route change to the current URL when this component is rendered.
59
+ *
60
+ * @default true
61
+ */
62
+ trackRouteOnRender?: boolean;
63
+ };
64
+ declare const uniformContextInjectionKey: InjectionKey<UniformContextProps>;
65
+ declare const provideUniformContext: ({ context, outputType, trackRouteOnRender, vueAppProvide, }: UniformContextProps & {
66
+ vueAppProvide?: typeof provide | undefined;
67
+ }) => void;
68
+ declare function onRouteChange(context: Context): void;
69
+ declare const useUniformContext: () => UniformContextProps;
70
+
71
+ declare const provideIsPersonalized: (isPersonalized?: boolean) => void;
72
+ declare const useIsPersonalized: () => boolean;
73
+
74
+ /**
75
+ * Provides reactive access to the Uniform Context's current visitor quirks values
76
+ * This can be used when you want to read current quirk values directly.
77
+ */
78
+ declare const useQuirks: () => vue_demi.Ref<{
79
+ [x: string]: string;
80
+ }>;
81
+
82
+ /**
83
+ * Provides reactive access to the Uniform Context's current visitor scores values.
84
+ * This can be used when you want to read current score values directly.
85
+ */
86
+ declare const useScores: () => vue_demi.Ref<{
87
+ [x: string]: number;
88
+ }>;
89
+
90
+ export { EdgeTestListComponentOptions, Personalize, PersonalizeStandard as PersonalizeEdge, Test, TestComponentProps, TestEdgeComponentProps, Track, TrackSlot, UniformContextProps, UniformContextProvider, VariantOutputType, onRouteChange, provideIsPersonalized, provideUniformContext, uniformContextInjectionKey, useIsPersonalized, useQuirks, useScores, useUniformContext };
@@ -0,0 +1,7 @@
1
+ "use strict";var J=Object.create;var A=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var Y=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Z=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of G(t))!X.call(e,i)&&i!==o&&A(e,i,{get:()=>t[i],enumerable:!(r=$(t,i))||r.enumerable});return e};var ee=(e,t,o)=>(o=e!=null?J(W(e)):{},Z(t||!e||!e.__esModule?A(o,"default",{value:e,enumerable:!0}):o,e));var j=Y(S=>{"use strict";S.parse=oe;S.serialize=re;var te=Object.prototype.toString,v=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function oe(e,t){if(typeof e!="string")throw new TypeError("argument str must be a string");for(var o={},r=t||{},i=r.decode||ne,a=0;a<e.length;){var n=e.indexOf("=",a);if(n===-1)break;var s=e.indexOf(";",a);if(s===-1)s=e.length;else if(s<n){a=e.lastIndexOf(";",n-1)+1;continue}var p=e.slice(a,n).trim();if(o[p]===void 0){var u=e.slice(n+1,s).trim();u.charCodeAt(0)===34&&(u=u.slice(1,-1)),o[p]=se(u,i)}a=s+1}return o}function re(e,t,o){var r=o||{},i=r.encode||ie;if(typeof i!="function")throw new TypeError("option encode is invalid");if(!v.test(e))throw new TypeError("argument name is invalid");var a=i(t);if(a&&!v.test(a))throw new TypeError("argument val is invalid");var n=e+"="+a;if(r.maxAge!=null){var s=r.maxAge-0;if(isNaN(s)||!isFinite(s))throw new TypeError("option maxAge is invalid");n+="; Max-Age="+Math.floor(s)}if(r.domain){if(!v.test(r.domain))throw new TypeError("option domain is invalid");n+="; Domain="+r.domain}if(r.path){if(!v.test(r.path))throw new TypeError("option path is invalid");n+="; Path="+r.path}if(r.expires){var p=r.expires;if(!ae(p)||isNaN(p.valueOf()))throw new TypeError("option expires is invalid");n+="; Expires="+p.toUTCString()}if(r.httpOnly&&(n+="; HttpOnly"),r.secure&&(n+="; Secure"),r.priority){var u=typeof r.priority=="string"?r.priority.toLowerCase():r.priority;switch(u){case"low":n+="; Priority=Low";break;case"medium":n+="; Priority=Medium";break;case"high":n+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(r.sameSite){var C=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(C){case!0:n+="; SameSite=Strict";break;case"lax":n+="; SameSite=Lax";break;case"strict":n+="; SameSite=Strict";break;case"none":n+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return n}function ne(e){return e.indexOf("%")!==-1?decodeURIComponent(e):e}function ie(e){return encodeURIComponent(e)}function ae(e){return te.call(e)==="[object Date]"||e instanceof Date}function se(e,t){try{return t(e)}catch(o){return e}}});import{defineComponent as Ce,h as Te,computed as ve}from"vue-demi";var c=typeof window=="undefined";import{defineComponent as ue,h as de}from"vue-demi";import{inject as pe,provide as me}from"vue-demi";var R=ee(j()),b=Symbol("uniformContextInjectionKey"),k=({context:e,outputType:t="standard",trackRouteOnRender:o=!0,vueAppProvide:r=me})=>{r(b,{context:e,outputType:t}),!c&&o&&N(e)};function N(e){e.update({url:new URL(window.location.href),cookies:R.default.parse(document.cookie)})}var m=()=>{let e=pe(b);if(!e)throw Error("Could not inject Uniform's Context, make sure you're using <UniformContextProvider /> or the Nuxt module.");return e};var le=ue({name:"TestStandard",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},loadingMode:{type:String,default:"default"},component:{type:[Object,Function],default:null}},setup(e){let{context:t}=m(),{result:o}=t.test({name:e.name,variations:e.variations});return o?()=>de(e.component,{...o}):null}}),L=le;import{defineComponent as ye,h as f}from"vue-demi";import{ScriptType as h}from"@uniformdev/context";import{EdgeNodeTagName as ce}from"@uniformdev/context";import{h as fe}from"vue-demi";var l=e=>fe(ce,e);var Pe=ye({name:"TestEdge",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},loadingMode:{type:String,default:"default"},component:{type:[Object,Function],default:null}},setup(e){let t={name:e.name};return()=>[f(l,{dataType:h.TestStart,domProps:{innerHTML:JSON.stringify(t)}}),e.variations.map(o=>[f(l,{dataType:h.ListItemSettings,domProps:{innerHTML:JSON.stringify({id:o.id})}}),f(l,{dataType:h.ListItem},f(e.component,{...o}))]),f(l,{dataType:h.TestEnd})]}}),q=Pe;var he=Ce({name:"Test",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},loadingMode:{type:String,default:"default"},component:{type:[Object,Function],default:null}},setup(e){let{outputType:t}=m(),o=ve(()=>!c||t==="standard"?L:q);return()=>Te(o.value,{...e})}}),ge=he;import{defineComponent as xe,h as ze}from"vue-demi";var Se=xe({name:"UniformContextProvider",inheritAttrs:!1,props:{context:{type:Object,required:!0},outputType:{type:String,default:"standard"},trackRouteOnRender:{type:Boolean,default:!0}},setup(e,t){return k(e),()=>ze(t.slots.default)}}),be=Se;import{defineComponent as He,h as _e,computed as Fe}from"vue-demi";import{defineComponent as je,ref as Re,watch as Ne,h as H,onServerPrefetch as Le,onMounted as qe}from"vue-demi";import{ref as ke,watchEffect as Ve}from"vue-demi";var I=Object.prototype.hasOwnProperty;function g(e,t){var o,r;if(e===t)return!0;if(e&&t&&(o=e.constructor)===t.constructor){if(o===Date)return e.getTime()===t.getTime();if(o===RegExp)return e.toString()===t.toString();if(o===Array){if((r=e.length)===t.length)for(;r--&&g(e[r],t[r]););return r===-1}if(!o||typeof e=="object"){r=0;for(o in e)if(I.call(e,o)&&++r&&!I.call(t,o)||!(o in t)||!g(e[o],t[o]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var V=()=>{let{context:e}=m(),t=ke(e.scores);return Ve(()=>{let o=i=>t.value=i,r=e.scores;return g(t.value,r)||(t.value=r),e.events.on("scoresUpdated",o),()=>{e.events.off("scoresUpdated",o)}}),t};import{defineComponent as Oe,h as Ue}from"vue-demi";import{provide as we,inject as Ee}from"vue-demi";var M=Symbol("uniformIsPersonalized"),w=e=>{we(M,e)},y=()=>Ee(M,!1);var Ae=Oe({name:"PersonalizeStandard",inheritAttrs:!1,props:{personalized:Boolean},setup(e,t){return w(e.personalized),()=>Ue(t.slots.default,{...e})}}),D=Ae;var Ie=je({name:"PersonalizeStandard",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},component:{type:Function,required:!0},count:{type:Number,default:1}},setup(e){let{context:t}=m(),o=V(),r=()=>t.personalize({name:e.name,variations:e.variations,take:e.count}),i=Re();return Le(async()=>{i.value=r()}),qe(async()=>{i.value||(i.value=r())}),Ne([o,()=>e.name,()=>e.variations,()=>e.count],()=>{i.value=r()}),()=>H(D,{personalized:!0},()=>{var a;return(a=i.value)==null?void 0:a.variations.map(n=>{var s;return H(e.component,{key:n.id,personalizationResult:{variation:n,personalizationOccurred:(s=i.value)==null?void 0:s.personalized},...n})})})}}),_=Ie;import{ScriptType as x}from"@uniformdev/context";import{defineComponent as Me,h as P}from"vue-demi";var De=Me({name:"PersonalizeStandard",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},component:{type:[Object,Function],required:!0},count:{type:Number,default:1}},setup(e){return()=>[P(l,{dataType:x.ListStart}),e.variations.map(t=>[P(l,{dataType:x.ListItemSettings,domProps:{innerHTML:JSON.stringify({id:t.id,pz:t.pz||null})}}),P(l,{dataType:x.ListItem},P(e.component,{personalizationResult:{variation:t,personalizationOccurred:!1},...t}))]),P(l,{dataType:x.ListEnd})]}}),E=De;var Be=He({name:"Personalize",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},component:{type:[Function,Object],required:!0},count:{type:Number,default:1}},setup(e){let{outputType:t}=m(),o=Fe(()=>!c||t==="standard"?_:E);return()=>_e(o.value,{...e})}}),Ke=Be;import{defineComponent as Qe,watchEffect as F,ref as z,h as Je}from"vue-demi";var $e=Qe({name:"Track",inheritAttrs:!1,props:{behavior:{type:[Object,Array]},tagName:{type:String,default:"div"},disableVisibilityTrigger:{type:Boolean,default:typeof window=="undefined"||!("IntersectionObserver"in window)},threshold:{type:[Number,Array],default:.5}},setup(e,t){let o=typeof document=="undefined"?"__uniform_ssr_url":document.location.href,{context:r}=m(),i=y(),a=z(""),n=z(!1),s=z(),p=z();return F(()=>{a.value!==o&&(a.value=o,n.value=!1)}),F(()=>{var U;let u=!e.behavior||Array.isArray(e.behavior)&&!e.behavior.length;if(i||u||!s.value)return;let Q=Array.isArray(e.behavior)?e.behavior:[e.behavior],O=()=>{var d;n.value||(r.update({enrichments:Q}),n.value=!1,(d=p.value)==null||d.call(p))};if(e.disableVisibilityTrigger)O();else{(U=p.value)==null||U.call(p);let d=new IntersectionObserver(([T])=>{T.isIntersecting&&O()},{threshold:e.threshold});d.observe(s.value),p.value=()=>{var T;return(T=d.disconnect)==null?void 0:T.call(d)}}return()=>{var d;(d=p.value)==null||d.call(p)}}),()=>Je(e.tagName,{ref:s,...t.attrs},t.slots.default())}}),Ge=$e;import{defineComponent as We,ref as B,watchEffect as K,h as Xe}from"vue-demi";var Ye=We({name:"TrackSlot",inheritAttrs:!1,props:{behavior:{type:[Object,Array]}},setup(e,t){let o=typeof document=="undefined"?"__uniform_ssr_url":document.location.href,{context:r}=m(),i=y(),a=B(),n=B(!1);return K(()=>{a.value!==o&&(a.value=o,n.value=!1)}),K(()=>{let s=!e.behavior||Array.isArray(e.behavior)&&!e.behavior.length;if(i||s)return;(()=>{if(n.value)return;let C=Array.isArray(e.behavior)?e.behavior:[e.behavior];r.update({enrichments:C}),n.value=!0})()}),()=>Xe(t.slots.default,{...t.attrs})}}),Ze=Ye;import{ref as et,watch as tt}from"vue-demi";var ot=()=>{let{context:e}=m(),t=et(e.quirks),o=r=>{t.value=r};return tt(e,()=>(e.events.on("quirksUpdated",o),()=>{e.events.off("quirksUpdated",o)})),t};export{Ke as Personalize,E as PersonalizeEdge,ge as Test,Ge as Track,Ze as TrackSlot,be as UniformContextProvider,N as onRouteChange,w as provideIsPersonalized,k as provideUniformContext,b as uniformContextInjectionKey,y as useIsPersonalized,ot as useQuirks,V as useScores,m as useUniformContext};
2
+ /*!
3
+ * cookie
4
+ * Copyright(c) 2012-2014 Roman Shtylman
5
+ * Copyright(c) 2015 Douglas Christopher Wilson
6
+ * MIT Licensed
7
+ */
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";var me=Object.create;var k=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var fe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ye=(e,t)=>{for(var o in t)k(e,o,{get:t[o],enumerable:!0})},K=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of de(t))!ce.call(e,i)&&i!==o&&k(e,i,{get:()=>t[i],enumerable:!(r=ue(t,i))||r.enumerable});return e};var Pe=(e,t,o)=>(o=e!=null?me(le(e)):{},K(t||!e||!e.__esModule?k(o,"default",{value:e,enumerable:!0}):o,e)),Ce=e=>K(k({},"__esModule",{value:!0}),e);var Q=fe(H=>{"use strict";H.parse=ve;H.serialize=he;var Te=Object.prototype.toString,V=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function ve(e,t){if(typeof e!="string")throw new TypeError("argument str must be a string");for(var o={},r=t||{},i=r.decode||ge,a=0;a<e.length;){var n=e.indexOf("=",a);if(n===-1)break;var s=e.indexOf(";",a);if(s===-1)s=e.length;else if(s<n){a=e.lastIndexOf(";",n-1)+1;continue}var p=e.slice(a,n).trim();if(o[p]===void 0){var l=e.slice(n+1,s).trim();l.charCodeAt(0)===34&&(l=l.slice(1,-1)),o[p]=Se(l,i)}a=s+1}return o}function he(e,t,o){var r=o||{},i=r.encode||xe;if(typeof i!="function")throw new TypeError("option encode is invalid");if(!V.test(e))throw new TypeError("argument name is invalid");var a=i(t);if(a&&!V.test(a))throw new TypeError("argument val is invalid");var n=e+"="+a;if(r.maxAge!=null){var s=r.maxAge-0;if(isNaN(s)||!isFinite(s))throw new TypeError("option maxAge is invalid");n+="; Max-Age="+Math.floor(s)}if(r.domain){if(!V.test(r.domain))throw new TypeError("option domain is invalid");n+="; Domain="+r.domain}if(r.path){if(!V.test(r.path))throw new TypeError("option path is invalid");n+="; Path="+r.path}if(r.expires){var p=r.expires;if(!ze(p)||isNaN(p.valueOf()))throw new TypeError("option expires is invalid");n+="; Expires="+p.toUTCString()}if(r.httpOnly&&(n+="; HttpOnly"),r.secure&&(n+="; Secure"),r.priority){var l=typeof r.priority=="string"?r.priority.toLowerCase():r.priority;switch(l){case"low":n+="; Priority=Low";break;case"medium":n+="; Priority=Medium";break;case"high":n+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(r.sameSite){var S=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(S){case!0:n+="; SameSite=Strict";break;case"lax":n+="; SameSite=Lax";break;case"strict":n+="; SameSite=Strict";break;case"none":n+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return n}function ge(e){return e.indexOf("%")!==-1?decodeURIComponent(e):e}function xe(e){return encodeURIComponent(e)}function ze(e){return Te.call(e)==="[object Date]"||e instanceof Date}function Se(e,t){try{return t(e)}catch(o){return e}}});var Ne={};ye(Ne,{Personalize:()=>ne,PersonalizeEdge:()=>M,Test:()=>Y,Track:()=>ie,TrackSlot:()=>ae,UniformContextProvider:()=>Z,onRouteChange:()=>_,provideIsPersonalized:()=>q,provideUniformContext:()=>O,uniformContextInjectionKey:()=>E,useIsPersonalized:()=>h,useQuirks:()=>se,useScores:()=>N,useUniformContext:()=>m});module.exports=Ce(Ne);var v=require("vue-demi");var T=typeof window=="undefined";var U=require("vue-demi");var w=require("vue-demi");var J=Pe(Q()),E=Symbol("uniformContextInjectionKey"),O=({context:e,outputType:t="standard",trackRouteOnRender:o=!0,vueAppProvide:r=w.provide})=>{r(E,{context:e,outputType:t}),!T&&o&&_(e)};function _(e){e.update({url:new URL(window.location.href),cookies:J.default.parse(document.cookie)})}var m=()=>{let e=(0,w.inject)(E);if(!e)throw Error("Could not inject Uniform's Context, make sure you're using <UniformContextProvider /> or the Nuxt module.");return e};var be=(0,U.defineComponent)({name:"TestStandard",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},loadingMode:{type:String,default:"default"},component:{type:[Object,Function],default:null}},setup(e){let{context:t}=m(),{result:o}=t.test({name:e.name,variations:e.variations});return o?()=>(0,U.h)(e.component,{...o}):null}}),$=be;var P=require("vue-demi"),x=require("@uniformdev/context");var G=require("@uniformdev/context"),W=require("vue-demi"),f=e=>(0,W.h)(G.EdgeNodeTagName,e);var ke=(0,P.defineComponent)({name:"TestEdge",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},loadingMode:{type:String,default:"default"},component:{type:[Object,Function],default:null}},setup(e){let t={name:e.name};return()=>[(0,P.h)(f,{dataType:x.ScriptType.TestStart,domProps:{innerHTML:JSON.stringify(t)}}),e.variations.map(o=>[(0,P.h)(f,{dataType:x.ScriptType.ListItemSettings,domProps:{innerHTML:JSON.stringify({id:o.id})}}),(0,P.h)(f,{dataType:x.ScriptType.ListItem},(0,P.h)(e.component,{...o}))]),(0,P.h)(f,{dataType:x.ScriptType.TestEnd})]}}),X=ke;var Ve=(0,v.defineComponent)({name:"Test",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},loadingMode:{type:String,default:"default"},component:{type:[Object,Function],default:null}},setup(e){let{outputType:t}=m(),o=(0,v.computed)(()=>!T||t==="standard"?$:X);return()=>(0,v.h)(o.value,{...e})}}),Y=Ve;var A=require("vue-demi");var we=(0,A.defineComponent)({name:"UniformContextProvider",inheritAttrs:!1,props:{context:{type:Object,required:!0},outputType:{type:String,default:"standard"},trackRouteOnRender:{type:Boolean,default:!0}},setup(e,t){return O(e),()=>(0,A.h)(t.slots.default)}}),Z=we;var g=require("vue-demi");var u=require("vue-demi");var R=require("vue-demi");var ee=Object.prototype.hasOwnProperty;function j(e,t){var o,r;if(e===t)return!0;if(e&&t&&(o=e.constructor)===t.constructor){if(o===Date)return e.getTime()===t.getTime();if(o===RegExp)return e.toString()===t.toString();if(o===Array){if((r=e.length)===t.length)for(;r--&&j(e[r],t[r]););return r===-1}if(!o||typeof e=="object"){r=0;for(o in e)if(ee.call(e,o)&&++r&&!ee.call(t,o)||!(o in t)||!j(e[o],t[o]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var N=()=>{let{context:e}=m(),t=(0,R.ref)(e.scores);return(0,R.watchEffect)(()=>{let o=i=>t.value=i,r=e.scores;return j(t.value,r)||(t.value=r),e.events.on("scoresUpdated",o),()=>{e.events.off("scoresUpdated",o)}}),t};var I=require("vue-demi");var L=require("vue-demi"),te=Symbol("uniformIsPersonalized"),q=e=>{(0,L.provide)(te,e)},h=()=>(0,L.inject)(te,!1);var Ee=(0,I.defineComponent)({name:"PersonalizeStandard",inheritAttrs:!1,props:{personalized:Boolean},setup(e,t){return q(e.personalized),()=>(0,I.h)(t.slots.default,{...e})}}),oe=Ee;var Oe=(0,u.defineComponent)({name:"PersonalizeStandard",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},component:{type:Function,required:!0},count:{type:Number,default:1}},setup(e){let{context:t}=m(),o=N(),r=()=>t.personalize({name:e.name,variations:e.variations,take:e.count}),i=(0,u.ref)();return(0,u.onServerPrefetch)(async()=>{i.value=r()}),(0,u.onMounted)(async()=>{i.value||(i.value=r())}),(0,u.watch)([o,()=>e.name,()=>e.variations,()=>e.count],()=>{i.value=r()}),()=>(0,u.h)(oe,{personalized:!0},()=>{var a;return(a=i.value)==null?void 0:a.variations.map(n=>{var s;return(0,u.h)(e.component,{key:n.id,personalizationResult:{variation:n,personalizationOccurred:(s=i.value)==null?void 0:s.personalized},...n})})})}}),re=Oe;var z=require("@uniformdev/context");var C=require("vue-demi"),Ue=(0,C.defineComponent)({name:"PersonalizeStandard",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},component:{type:[Object,Function],required:!0},count:{type:Number,default:1}},setup(e){return()=>[(0,C.h)(f,{dataType:z.ScriptType.ListStart}),e.variations.map(t=>[(0,C.h)(f,{dataType:z.ScriptType.ListItemSettings,domProps:{innerHTML:JSON.stringify({id:t.id,pz:t.pz||null})}}),(0,C.h)(f,{dataType:z.ScriptType.ListItem},(0,C.h)(e.component,{personalizationResult:{variation:t,personalizationOccurred:!1},...t}))]),(0,C.h)(f,{dataType:z.ScriptType.ListEnd})]}}),M=Ue;var Ae=(0,g.defineComponent)({name:"Personalize",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},component:{type:[Function,Object],required:!0},count:{type:Number,default:1}},setup(e){let{outputType:t}=m(),o=(0,g.computed)(()=>!T||t==="standard"?re:M);return()=>(0,g.h)(o.value,{...e})}}),ne=Ae;var d=require("vue-demi");var je=(0,d.defineComponent)({name:"Track",inheritAttrs:!1,props:{behavior:{type:[Object,Array]},tagName:{type:String,default:"div"},disableVisibilityTrigger:{type:Boolean,default:typeof window=="undefined"||!("IntersectionObserver"in window)},threshold:{type:[Number,Array],default:.5}},setup(e,t){let o=typeof document=="undefined"?"__uniform_ssr_url":document.location.href,{context:r}=m(),i=h(),a=(0,d.ref)(""),n=(0,d.ref)(!1),s=(0,d.ref)(),p=(0,d.ref)();return(0,d.watchEffect)(()=>{a.value!==o&&(a.value=o,n.value=!1)}),(0,d.watchEffect)(()=>{var B;let l=!e.behavior||Array.isArray(e.behavior)&&!e.behavior.length;if(i||l||!s.value)return;let pe=Array.isArray(e.behavior)?e.behavior:[e.behavior],F=()=>{var c;n.value||(r.update({enrichments:pe}),n.value=!1,(c=p.value)==null||c.call(p))};if(e.disableVisibilityTrigger)F();else{(B=p.value)==null||B.call(p);let c=new IntersectionObserver(([b])=>{b.isIntersecting&&F()},{threshold:e.threshold});c.observe(s.value),p.value=()=>{var b;return(b=c.disconnect)==null?void 0:b.call(c)}}return()=>{var c;(c=p.value)==null||c.call(p)}}),()=>(0,d.h)(e.tagName,{ref:s,...t.attrs},t.slots.default())}}),ie=je;var y=require("vue-demi");var Re=(0,y.defineComponent)({name:"TrackSlot",inheritAttrs:!1,props:{behavior:{type:[Object,Array]}},setup(e,t){let o=typeof document=="undefined"?"__uniform_ssr_url":document.location.href,{context:r}=m(),i=h(),a=(0,y.ref)(),n=(0,y.ref)(!1);return(0,y.watchEffect)(()=>{a.value!==o&&(a.value=o,n.value=!1)}),(0,y.watchEffect)(()=>{let s=!e.behavior||Array.isArray(e.behavior)&&!e.behavior.length;if(i||s)return;(()=>{if(n.value)return;let S=Array.isArray(e.behavior)?e.behavior:[e.behavior];r.update({enrichments:S}),n.value=!0})()}),()=>(0,y.h)(t.slots.default,{...t.attrs})}}),ae=Re;var D=require("vue-demi");var se=()=>{let{context:e}=m(),t=(0,D.ref)(e.quirks),o=r=>{t.value=r};return(0,D.watch)(e,()=>(e.events.on("quirksUpdated",o),()=>{e.events.off("quirksUpdated",o)})),t};0&&(module.exports={Personalize,PersonalizeEdge,Test,Track,TrackSlot,UniformContextProvider,onRouteChange,provideIsPersonalized,provideUniformContext,uniformContextInjectionKey,useIsPersonalized,useQuirks,useScores,useUniformContext});
2
+ /*!
3
+ * cookie
4
+ * Copyright(c) 2012-2014 Roman Shtylman
5
+ * Copyright(c) 2015 Douglas Christopher Wilson
6
+ * MIT Licensed
7
+ */
package/dist/index.mjs ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";var J=Object.create;var A=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var Y=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Z=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of G(t))!X.call(e,i)&&i!==o&&A(e,i,{get:()=>t[i],enumerable:!(r=$(t,i))||r.enumerable});return e};var ee=(e,t,o)=>(o=e!=null?J(W(e)):{},Z(t||!e||!e.__esModule?A(o,"default",{value:e,enumerable:!0}):o,e));var j=Y(S=>{"use strict";S.parse=oe;S.serialize=re;var te=Object.prototype.toString,v=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function oe(e,t){if(typeof e!="string")throw new TypeError("argument str must be a string");for(var o={},r=t||{},i=r.decode||ne,a=0;a<e.length;){var n=e.indexOf("=",a);if(n===-1)break;var s=e.indexOf(";",a);if(s===-1)s=e.length;else if(s<n){a=e.lastIndexOf(";",n-1)+1;continue}var p=e.slice(a,n).trim();if(o[p]===void 0){var u=e.slice(n+1,s).trim();u.charCodeAt(0)===34&&(u=u.slice(1,-1)),o[p]=se(u,i)}a=s+1}return o}function re(e,t,o){var r=o||{},i=r.encode||ie;if(typeof i!="function")throw new TypeError("option encode is invalid");if(!v.test(e))throw new TypeError("argument name is invalid");var a=i(t);if(a&&!v.test(a))throw new TypeError("argument val is invalid");var n=e+"="+a;if(r.maxAge!=null){var s=r.maxAge-0;if(isNaN(s)||!isFinite(s))throw new TypeError("option maxAge is invalid");n+="; Max-Age="+Math.floor(s)}if(r.domain){if(!v.test(r.domain))throw new TypeError("option domain is invalid");n+="; Domain="+r.domain}if(r.path){if(!v.test(r.path))throw new TypeError("option path is invalid");n+="; Path="+r.path}if(r.expires){var p=r.expires;if(!ae(p)||isNaN(p.valueOf()))throw new TypeError("option expires is invalid");n+="; Expires="+p.toUTCString()}if(r.httpOnly&&(n+="; HttpOnly"),r.secure&&(n+="; Secure"),r.priority){var u=typeof r.priority=="string"?r.priority.toLowerCase():r.priority;switch(u){case"low":n+="; Priority=Low";break;case"medium":n+="; Priority=Medium";break;case"high":n+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(r.sameSite){var C=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(C){case!0:n+="; SameSite=Strict";break;case"lax":n+="; SameSite=Lax";break;case"strict":n+="; SameSite=Strict";break;case"none":n+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return n}function ne(e){return e.indexOf("%")!==-1?decodeURIComponent(e):e}function ie(e){return encodeURIComponent(e)}function ae(e){return te.call(e)==="[object Date]"||e instanceof Date}function se(e,t){try{return t(e)}catch(o){return e}}});import{defineComponent as Ce,h as Te,computed as ve}from"vue-demi";var c=typeof window=="undefined";import{defineComponent as ue,h as de}from"vue-demi";import{inject as pe,provide as me}from"vue-demi";var R=ee(j()),b=Symbol("uniformContextInjectionKey"),k=({context:e,outputType:t="standard",trackRouteOnRender:o=!0,vueAppProvide:r=me})=>{r(b,{context:e,outputType:t}),!c&&o&&N(e)};function N(e){e.update({url:new URL(window.location.href),cookies:R.default.parse(document.cookie)})}var m=()=>{let e=pe(b);if(!e)throw Error("Could not inject Uniform's Context, make sure you're using <UniformContextProvider /> or the Nuxt module.");return e};var le=ue({name:"TestStandard",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},loadingMode:{type:String,default:"default"},component:{type:[Object,Function],default:null}},setup(e){let{context:t}=m(),{result:o}=t.test({name:e.name,variations:e.variations});return o?()=>de(e.component,{...o}):null}}),L=le;import{defineComponent as ye,h as f}from"vue-demi";import{ScriptType as h}from"@uniformdev/context";import{EdgeNodeTagName as ce}from"@uniformdev/context";import{h as fe}from"vue-demi";var l=e=>fe(ce,e);var Pe=ye({name:"TestEdge",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},loadingMode:{type:String,default:"default"},component:{type:[Object,Function],default:null}},setup(e){let t={name:e.name};return()=>[f(l,{dataType:h.TestStart,domProps:{innerHTML:JSON.stringify(t)}}),e.variations.map(o=>[f(l,{dataType:h.ListItemSettings,domProps:{innerHTML:JSON.stringify({id:o.id})}}),f(l,{dataType:h.ListItem},f(e.component,{...o}))]),f(l,{dataType:h.TestEnd})]}}),q=Pe;var he=Ce({name:"Test",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},loadingMode:{type:String,default:"default"},component:{type:[Object,Function],default:null}},setup(e){let{outputType:t}=m(),o=ve(()=>!c||t==="standard"?L:q);return()=>Te(o.value,{...e})}}),ge=he;import{defineComponent as xe,h as ze}from"vue-demi";var Se=xe({name:"UniformContextProvider",inheritAttrs:!1,props:{context:{type:Object,required:!0},outputType:{type:String,default:"standard"},trackRouteOnRender:{type:Boolean,default:!0}},setup(e,t){return k(e),()=>ze(t.slots.default)}}),be=Se;import{defineComponent as He,h as _e,computed as Fe}from"vue-demi";import{defineComponent as je,ref as Re,watch as Ne,h as H,onServerPrefetch as Le,onMounted as qe}from"vue-demi";import{ref as ke,watchEffect as Ve}from"vue-demi";var I=Object.prototype.hasOwnProperty;function g(e,t){var o,r;if(e===t)return!0;if(e&&t&&(o=e.constructor)===t.constructor){if(o===Date)return e.getTime()===t.getTime();if(o===RegExp)return e.toString()===t.toString();if(o===Array){if((r=e.length)===t.length)for(;r--&&g(e[r],t[r]););return r===-1}if(!o||typeof e=="object"){r=0;for(o in e)if(I.call(e,o)&&++r&&!I.call(t,o)||!(o in t)||!g(e[o],t[o]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var V=()=>{let{context:e}=m(),t=ke(e.scores);return Ve(()=>{let o=i=>t.value=i,r=e.scores;return g(t.value,r)||(t.value=r),e.events.on("scoresUpdated",o),()=>{e.events.off("scoresUpdated",o)}}),t};import{defineComponent as Oe,h as Ue}from"vue-demi";import{provide as we,inject as Ee}from"vue-demi";var M=Symbol("uniformIsPersonalized"),w=e=>{we(M,e)},y=()=>Ee(M,!1);var Ae=Oe({name:"PersonalizeStandard",inheritAttrs:!1,props:{personalized:Boolean},setup(e,t){return w(e.personalized),()=>Ue(t.slots.default,{...e})}}),D=Ae;var Ie=je({name:"PersonalizeStandard",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},component:{type:Function,required:!0},count:{type:Number,default:1}},setup(e){let{context:t}=m(),o=V(),r=()=>t.personalize({name:e.name,variations:e.variations,take:e.count}),i=Re();return Le(async()=>{i.value=r()}),qe(async()=>{i.value||(i.value=r())}),Ne([o,()=>e.name,()=>e.variations,()=>e.count],()=>{i.value=r()}),()=>H(D,{personalized:!0},()=>{var a;return(a=i.value)==null?void 0:a.variations.map(n=>{var s;return H(e.component,{key:n.id,personalizationResult:{variation:n,personalizationOccurred:(s=i.value)==null?void 0:s.personalized},...n})})})}}),_=Ie;import{ScriptType as x}from"@uniformdev/context";import{defineComponent as Me,h as P}from"vue-demi";var De=Me({name:"PersonalizeStandard",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},component:{type:[Object,Function],required:!0},count:{type:Number,default:1}},setup(e){return()=>[P(l,{dataType:x.ListStart}),e.variations.map(t=>[P(l,{dataType:x.ListItemSettings,domProps:{innerHTML:JSON.stringify({id:t.id,pz:t.pz||null})}}),P(l,{dataType:x.ListItem},P(e.component,{personalizationResult:{variation:t,personalizationOccurred:!1},...t}))]),P(l,{dataType:x.ListEnd})]}}),E=De;var Be=He({name:"Personalize",inheritAttrs:!1,props:{name:{type:String,required:!0},variations:{type:Array,required:!0},component:{type:[Function,Object],required:!0},count:{type:Number,default:1}},setup(e){let{outputType:t}=m(),o=Fe(()=>!c||t==="standard"?_:E);return()=>_e(o.value,{...e})}}),Ke=Be;import{defineComponent as Qe,watchEffect as F,ref as z,h as Je}from"vue-demi";var $e=Qe({name:"Track",inheritAttrs:!1,props:{behavior:{type:[Object,Array]},tagName:{type:String,default:"div"},disableVisibilityTrigger:{type:Boolean,default:typeof window=="undefined"||!("IntersectionObserver"in window)},threshold:{type:[Number,Array],default:.5}},setup(e,t){let o=typeof document=="undefined"?"__uniform_ssr_url":document.location.href,{context:r}=m(),i=y(),a=z(""),n=z(!1),s=z(),p=z();return F(()=>{a.value!==o&&(a.value=o,n.value=!1)}),F(()=>{var U;let u=!e.behavior||Array.isArray(e.behavior)&&!e.behavior.length;if(i||u||!s.value)return;let Q=Array.isArray(e.behavior)?e.behavior:[e.behavior],O=()=>{var d;n.value||(r.update({enrichments:Q}),n.value=!1,(d=p.value)==null||d.call(p))};if(e.disableVisibilityTrigger)O();else{(U=p.value)==null||U.call(p);let d=new IntersectionObserver(([T])=>{T.isIntersecting&&O()},{threshold:e.threshold});d.observe(s.value),p.value=()=>{var T;return(T=d.disconnect)==null?void 0:T.call(d)}}return()=>{var d;(d=p.value)==null||d.call(p)}}),()=>Je(e.tagName,{ref:s,...t.attrs},t.slots.default())}}),Ge=$e;import{defineComponent as We,ref as B,watchEffect as K,h as Xe}from"vue-demi";var Ye=We({name:"TrackSlot",inheritAttrs:!1,props:{behavior:{type:[Object,Array]}},setup(e,t){let o=typeof document=="undefined"?"__uniform_ssr_url":document.location.href,{context:r}=m(),i=y(),a=B(),n=B(!1);return K(()=>{a.value!==o&&(a.value=o,n.value=!1)}),K(()=>{let s=!e.behavior||Array.isArray(e.behavior)&&!e.behavior.length;if(i||s)return;(()=>{if(n.value)return;let C=Array.isArray(e.behavior)?e.behavior:[e.behavior];r.update({enrichments:C}),n.value=!0})()}),()=>Xe(t.slots.default,{...t.attrs})}}),Ze=Ye;import{ref as et,watch as tt}from"vue-demi";var ot=()=>{let{context:e}=m(),t=et(e.quirks),o=r=>{t.value=r};return tt(e,()=>(e.events.on("quirksUpdated",o),()=>{e.events.off("quirksUpdated",o)})),t};export{Ke as Personalize,E as PersonalizeEdge,ge as Test,Ge as Track,Ze as TrackSlot,be as UniformContextProvider,N as onRouteChange,w as provideIsPersonalized,k as provideUniformContext,b as uniformContextInjectionKey,y as useIsPersonalized,ot as useQuirks,V as useScores,m as useUniformContext};
2
+ /*!
3
+ * cookie
4
+ * Copyright(c) 2012-2014 Roman Shtylman
5
+ * Copyright(c) 2015 Douglas Christopher Wilson
6
+ * MIT Licensed
7
+ */
package/package.json CHANGED
@@ -1,37 +1,67 @@
1
1
  {
2
2
  "name": "@uniformdev/context-vue",
3
- "version": "16.0.1-alpha.128+6cdb4ff33",
4
- "description": "Uniform Context Vue integration package",
3
+ "version": "16.0.1-alpha.143+8bf270fcc",
4
+ "description": "Vue SDK for Uniform Context",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
- "main": "./dist/index.cjs.js",
7
- "module": "./dist/index.es.js",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.esm.js",
8
8
  "exports": {
9
- "import": "./dist/index.es.js",
10
- "require": "./dist/index.cjs.js"
9
+ "import": {
10
+ "node": "./dist/index.mjs",
11
+ "default": "./dist/index.esm.js"
12
+ },
13
+ "require": "./dist/index.js"
11
14
  },
12
15
  "types": "./dist/index.d.ts",
16
+ "sideEffects": false,
13
17
  "scripts": {
14
- "dev": "vue-tsc --noEmit && vite build --watch",
15
- "build": "vue-tsc --noEmit && vite build",
16
- "preview": "vite preview"
18
+ "build": "tsup --minify",
19
+ "dev": "tsup --watch",
20
+ "clean": "rimraf dist",
21
+ "test": "jest --maxWorkers=1 --passWithNoTests",
22
+ "lint": "eslint \"src/**/*.{js,ts,tsx}\"",
23
+ "format": "prettier --write \"src/**/*.{js,ts,tsx}\""
17
24
  },
18
25
  "dependencies": {
19
- "@uniformdev/context": "^16.0.1-alpha.128+6cdb4ff33",
20
- "vue": "^3.2.25"
26
+ "@uniformdev/context": "^16.0.1-alpha.143+8bf270fcc",
27
+ "pascal-case": "3.1.2",
28
+ "uuid": "8.3.2",
29
+ "vue-demi": "^0.12.5"
30
+ },
31
+ "peerDependencies": {
32
+ "@vue/composition-api": "^1.0.0-rc.1",
33
+ "vue": "^2.0.0 || >=3.0.0"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "@vue/composition-api": {
37
+ "optional": true
38
+ }
21
39
  },
22
40
  "devDependencies": {
23
- "@types/node": "^17.0.34",
24
- "@vitejs/plugin-vue": "^2.3.3",
25
- "typescript": "^4.5.4",
26
- "vite": "^2.9.9",
27
- "vite-plugin-dts": "^1.1.1",
28
- "vue-tsc": "^0.34.15"
41
+ "@testing-library/vue": "6.5.1",
42
+ "@types/uuid": "8.3.4",
43
+ "@vue/server-test-utils": "1.3.0",
44
+ "@vue/test-utils": "1.3.0",
45
+ "vue": "3.2.25",
46
+ "vue-server-renderer": "2.6.14",
47
+ "vue-template-compiler": "2.6.14"
29
48
  },
30
49
  "files": [
31
- "dist"
50
+ "dist",
51
+ "vetur/tags.json",
52
+ "vetur/attributes.json"
32
53
  ],
54
+ "vetur": {
55
+ "tags": "vetur/tags.json",
56
+ "attributes": "vetur/attributes.json"
57
+ },
33
58
  "publishConfig": {
34
59
  "access": "public"
35
60
  },
36
- "gitHead": "6cdb4ff331d6d0d9d5c154b7b342e7703067bfc3"
61
+ "browserslist": [
62
+ "> 1%",
63
+ "last 2 versions",
64
+ "not dead"
65
+ ],
66
+ "gitHead": "8bf270fcc0cc82383d1f30311fe11dafd5fe3782"
37
67
  }
package/dist/index.cjs.js DELETED
@@ -1 +0,0 @@
1
- "use strict";var q=Object.defineProperty;var A=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var L=(n,t,o)=>t in n?q(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,g=(n,t)=>{for(var o in t||(t={}))k.call(t,o)&&L(n,o,t[o]);if(A)for(var o of A(t))V.call(t,o)&&L(n,o,t[o]);return n};var P=(n,t)=>{var o={};for(var i in n)k.call(n,i)&&t.indexOf(i)<0&&(o[i]=n[i]);if(n!=null&&A)for(var i of A(n))t.indexOf(i)<0&&V.call(n,i)&&(o[i]=n[i]);return o};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e=require("vue");const b=typeof window=="undefined",v=Symbol("uniformContextStore"),N=({context:n,outputType:t="standard"})=>{e.provide(v,{context:n,outputType:t})},h=(n,t)=>{const o=e.inject(n,t);if(!o)throw Error(`could not resolve ${n.description}`);return g({},o)},J=e.defineComponent({__name:"TestStandard",props:{name:null,variations:null,loadingMode:null,component:null},setup(n){const{name:t,variations:o,component:i}=n,{context:s}=h(v),{result:f}=s.test({name:t,variations:o});return(r,a)=>e.unref(f)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.component),e.normalizeProps(e.mergeProps({key:0},e.unref(f))),null,16)):e.createCommentVNode("",!0)}});/*! js-cookie v3.0.1 | MIT */function z(n){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)n[i]=o[i]}return n}var Q={read:function(n){return n[0]==='"'&&(n=n.slice(1,-1)),n.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(n){return encodeURIComponent(n).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function T(n,t){function o(s,f,r){if(typeof document!="undefined"){r=z({},t,r),typeof r.expires=="number"&&(r.expires=new Date(Date.now()+r.expires*864e5)),r.expires&&(r.expires=r.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var c in r)!r[c]||(a+="; "+c,r[c]!==!0&&(a+="="+r[c].split(";")[0]));return document.cookie=s+"="+n.write(f,s)+a}}function i(s){if(!(typeof document=="undefined"||arguments.length&&!s)){for(var f=document.cookie?document.cookie.split("; "):[],r={},a=0;a<f.length;a++){var c=f[a].split("="),l=c.slice(1).join("=");try{var u=decodeURIComponent(c[0]);if(r[u]=n.read(l,u),s===u)break}catch{}}return s?r[s]:r}}return Object.create({set:o,get:i,remove:function(s,f){o(s,"",z({},f,{expires:-1}))},withAttributes:function(s){return T(this.converter,z({},this.attributes,s))},withConverter:function(s){return T(z({},this.converter,s),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(n)}})}T(Q,{path:"/"});var D=G;function _(n){return n instanceof Buffer?Buffer.from(n):new n.constructor(n.buffer.slice(),n.byteOffset,n.length)}function G(n){if(n=n||{},n.circles)return W(n);return n.proto?i:o;function t(s,f){for(var r=Object.keys(s),a=new Array(r.length),c=0;c<r.length;c++){var l=r[c],u=s[l];typeof u!="object"||u===null?a[l]=u:u instanceof Date?a[l]=new Date(u):ArrayBuffer.isView(u)?a[l]=_(u):a[l]=f(u)}return a}function o(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return t(s,o);if(s instanceof Map)return new Map(t(Array.from(s),o));if(s instanceof Set)return new Set(t(Array.from(s),o));var f={};for(var r in s)if(Object.hasOwnProperty.call(s,r)!==!1){var a=s[r];typeof a!="object"||a===null?f[r]=a:a instanceof Date?f[r]=new Date(a):a instanceof Map?f[r]=new Map(t(Array.from(a),o)):a instanceof Set?f[r]=new Set(t(Array.from(a),o)):ArrayBuffer.isView(a)?f[r]=_(a):f[r]=o(a)}return f}function i(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return t(s,i);if(s instanceof Map)return new Map(t(Array.from(s),i));if(s instanceof Set)return new Set(t(Array.from(s),i));var f={};for(var r in s){var a=s[r];typeof a!="object"||a===null?f[r]=a:a instanceof Date?f[r]=new Date(a):a instanceof Map?f[r]=new Map(t(Array.from(a),i)):a instanceof Set?f[r]=new Set(t(Array.from(a),i)):ArrayBuffer.isView(a)?f[r]=_(a):f[r]=i(a)}return f}}function W(n){var t=[],o=[];return n.proto?f:s;function i(r,a){for(var c=Object.keys(r),l=new Array(c.length),u=0;u<c.length;u++){var d=c[u],p=r[d];if(typeof p!="object"||p===null)l[d]=p;else if(p instanceof Date)l[d]=new Date(p);else if(ArrayBuffer.isView(p))l[d]=_(p);else{var C=t.indexOf(p);C!==-1?l[d]=o[C]:l[d]=a(p)}}return l}function s(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return i(r,s);if(r instanceof Map)return new Map(i(Array.from(r),s));if(r instanceof Set)return new Set(i(Array.from(r),s));var a={};t.push(r),o.push(a);for(var c in r)if(Object.hasOwnProperty.call(r,c)!==!1){var l=r[c];if(typeof l!="object"||l===null)a[c]=l;else if(l instanceof Date)a[c]=new Date(l);else if(l instanceof Map)a[c]=new Map(i(Array.from(l),s));else if(l instanceof Set)a[c]=new Set(i(Array.from(l),s));else if(ArrayBuffer.isView(l))a[c]=_(l);else{var u=t.indexOf(l);u!==-1?a[c]=o[u]:a[c]=s(l)}}return t.pop(),o.pop(),a}function f(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return i(r,f);if(r instanceof Map)return new Map(i(Array.from(r),f));if(r instanceof Set)return new Set(i(Array.from(r),f));var a={};t.push(r),o.push(a);for(var c in r){var l=r[c];if(typeof l!="object"||l===null)a[c]=l;else if(l instanceof Date)a[c]=new Date(l);else if(l instanceof Map)a[c]=new Map(i(Array.from(l),f));else if(l instanceof Set)a[c]=new Set(i(Array.from(l),f));else if(ArrayBuffer.isView(l))a[c]=_(l);else{var u=t.indexOf(l);u!==-1?a[c]=o[u]:a[c]=f(l)}}return t.pop(),o.pop(),a}}var U="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",X=new Array(123);for(let n=0;n<U.length;n++)X[U.charCodeAt(n)]=n;D();D();D();var y=(n=>(n.ListStart="nesi-list-start",n.ListEnd="nesi-list-end",n.ListItem="nesi-list-item-html",n.ListItemSettings="nesi-list-item-settings",n.TestStart="nesi-test-start",n.TestEnd="nesi-test-end",n.Unknown="unknown",n))(y||{}),Y="nesitag";const w=n=>e.h(Y,n),Z=e.defineComponent({__name:"TestEdge",props:{name:null,variations:null,loadingMode:null,component:null},setup(n){const{name:t,variations:o,component:i}=n,s={name:t};return(f,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(w),{"data-type":e.unref(y).TestStart,innerHTML:JSON.stringify(s)},null,8,["data-type","innerHTML"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.variations,(a,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:c},[e.createVNode(e.unref(w),{"data-type":e.unref(y).ListItemSettings,innerHTML:JSON.stringify({id:a.id})},null,8,["data-type","innerHTML"]),e.createVNode(e.unref(w),{"data-type":e.unref(y).ListItem},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(f.renderComponent),e.normalizeProps(e.guardReactiveProps(a)),null,16))]),_:2},1032,["data-type"])],64))),128)),e.createVNode(e.unref(w),{"data-type":e.unref(y).TestEnd},null,8,["data-type"])],64))}}),K=e.defineComponent({__name:"Test",props:{name:null,variations:null,loadingMode:null,component:null},setup(n){const t=n,{outputType:o}=h(v),i=e.computed(()=>!b||o==="standard"?J:Z);return(s,f)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(i)),e.normalizeProps(e.guardReactiveProps(t)),null,16))}}),ee=e.defineComponent({__name:"UniformContextProvider",props:{context:null},setup(n){return N(g({},n)),(o,i)=>e.renderSlot(o.$slots,"default")}});var I=Object.prototype.hasOwnProperty;function x(n,t){var o,i;if(n===t)return!0;if(n&&t&&(o=n.constructor)===t.constructor){if(o===Date)return n.getTime()===t.getTime();if(o===RegExp)return n.toString()===t.toString();if(o===Array){if((i=n.length)===t.length)for(;i--&&x(n[i],t[i]););return i===-1}if(!o||typeof n=="object"){i=0;for(o in n)if(I.call(n,o)&&++i&&!I.call(t,o)||!(o in t)||!x(n[o],t[o]))return!1;return Object.keys(t).length===i}}return n!==n&&t!==t}const R=()=>{const{context:n}=h(v),t=e.ref(n.scores);return e.watchEffect(()=>{const o=s=>t.value=s,i=n.scores;return x(t,i)||(t.value=i),n.events.on("scoresUpdated",o),()=>{n.events.off("scoresUpdated",o)}}),t},M=Symbol("uniformIsPersonalizedStore"),$=({personalized:n=!1})=>{e.provide(M,{personalized:n})},E=(n,t)=>{const o=e.inject(n,t);return o?g({},o):{personalized:!1}},ne=e.defineComponent({__name:"PersonalizeProvider",props:{personalized:{type:Boolean}},setup(n){const{personalized:t}=n;return $({personalized:t}),(o,i)=>e.renderSlot(o.$slots,"default",e.normalizeProps(e.guardReactiveProps({personalized:n.personalized})))}}),te=e.defineComponent({__name:"PersonalizeStandard",props:{name:null,variations:null,component:null,count:null},setup(n){const{name:t,component:o,variations:i,count:s=1}=n,{context:f}=h(v),r=R(),a=e.computed(()=>{if(r.value,o){const{variations:c,personalized:l}=f.personalize({name:t,variations:i,take:s});return{personalizedVariations:c,personalizationOccurred:l}}});return(c,l)=>(e.openBlock(),e.createBlock(ne,{personalized:!0},{default:e.withCtx(()=>{var u;return[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList((u=e.unref(a))==null?void 0:u.personalizedVariations,d=>{var p;return e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.component),e.normalizeProps(e.mergeProps({key:d.id},g({personalizationResult:{variation:d,personalizationOccurred:(p=e.unref(a))==null?void 0:p.personalizationOccurred}},d))),null,16)}),128))]}),_:1}))}}),re=e.defineComponent({__name:"PersonalizeEdge",props:{name:null,variations:null,component:null,count:null},setup(n){const{component:t,variations:o,count:i}=n,s=i!=null?i:1;return(f,r)=>{const a=e.resolveComponent("component");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(w),{"data-type":e.unref(y).ListStart,innerHTML:JSON.stringify(e.unref(s))},null,8,["data-type","innerHTML"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.variations,c=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:c.id},[e.createVNode(e.unref(w),{"data-type":e.unref(y).ListItemSettings,innerHTML:JSON.stringify({id:c.id,pz:c.pz||null})},null,8,["data-type","innerHTML"]),e.createVNode(e.unref(w),{"data-type":e.unref(y).ListItem},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(a,{key:c.id,personalizationResult:{variant:c,personalizationOccurred:!1}},null,8,["personalizationResult"]))]),_:2},1032,["data-type"])],64))),128)),e.createVNode(e.unref(w),{"data-type":e.unref(y).ListEnd},null,8,["data-type"])],64)}}}),oe=e.defineComponent({__name:"Personalize",props:{name:null,variations:null,component:null,count:null},setup(n){const t=n,{outputType:o}=h(v),i=e.computed(()=>!b||o==="standard"?te:re);return(s,f)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(i)),e.normalizeProps(e.guardReactiveProps(g({},t))),null,16))}}),ae=e.defineComponent({__name:"Track",props:{behavior:null,tagName:{default:"div"},disableVisibilityTrigger:{type:Boolean},threshold:{default:.5}},setup(n){const C=n,{behavior:t,tagName:o,threshold:i,disableVisibilityTrigger:s=typeof window=="undefined"||!("IntersectionObserver"in window)}=C,f=P(C,["behavior","tagName","threshold","disableVisibilityTrigger"]),r=typeof document=="undefined"?"__uniform_ssr_url":document.location.href,{context:a}=h(v),{personalized:c}=E(M),l=e.ref(""),u=e.ref(!1),d=e.ref(),p=e.ref();return e.watchEffect(()=>{l.value!==r&&(l.value=r,u.value=!1)}),e.watchEffect(()=>{var j;const S=!t||Array.isArray(t)&&!t.length;if(c||S||!d.value)return;const F=Array.isArray(t)?t:[t],O=()=>{var m;u.value||(a.update({enrichments:F}),u.value=!1,(m=p.value)==null||m.call(p))};if(s)O();else{(j=p.value)==null||j.call(p);const m=new IntersectionObserver(([B])=>{B.isIntersecting&&O()},{threshold:i});m.observe(d.value),p.value=()=>{var B;return(B=m.disconnect)==null?void 0:B.call(m)}}return()=>{var m;(m=p.value)==null||m.call(p)}}),(S,H)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o),e.mergeProps(g({},f),{ref_key:"wrapperEl",ref:d}),{default:e.withCtx(()=>[e.renderSlot(S.$slots,"default")]),_:3},16))}}),se=e.defineComponent({__name:"TrackSlot",props:{behavior:null},setup(n){const c=n,{behavior:t}=c,o=P(c,["behavior"]),i=typeof document=="undefined"?"__uniform_ssr_url":document.location.href,{context:s}=h(v),{personalized:f}=E(M),r=e.ref(""),a=e.ref(!1);return e.watchEffect(()=>{r.value!==i&&(r.value=i,a.value=!1)}),e.watchEffect(()=>{const l=!t||Array.isArray(t)&&!t.length;if(f||l)return;(()=>{if(a.value)return;const p=Array.isArray(t)?t:[t];s.update({enrichments:p}),a.value=!0})()}),(l,u)=>e.renderSlot(l.$slots,"default",e.normalizeProps(e.guardReactiveProps(g({},l.rest))))}}),ie=()=>{const{context:n}=h(v),t=e.ref(n.quirks),o=i=>{t.value=i};return e.watch(n,()=>(n.events.on("quirksUpdated",o),()=>{n.events.off("quirksUpdated",o)})),t};exports.Personalize=oe;exports.Test=K;exports.Track=ae;exports.TrackSlot=se;exports.UniformContextProvider=ee;exports.initPersonalizeStore=$;exports.initStore=N;exports.uniformContextStoreProps=v;exports.useIsPersonalized=E;exports.useQuirks=ie;exports.useScores=R;exports.useUniformContext=h;