@uniformdev/context-vue 16.0.1-alpha.128 → 16.0.1-nuxt.149
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 +2 -0
- package/README.md +2 -15
- package/dist/index.d.ts +91 -265
- package/dist/index.esm.js +7 -0
- package/dist/index.js +7 -0
- package/dist/index.mjs +7 -0
- package/package.json +49 -19
- package/dist/index.cjs.js +0 -1
- package/dist/index.es.js +0 -770
package/LICENSE.txt
ADDED
package/README.md
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
# Vue
|
|
1
|
+
# Vue SDK for Uniform Context
|
|
2
2
|
|
|
3
|
-
|
|
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,91 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
variations:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
+
declare function isUsingUniformContext(): boolean;
|
|
71
|
+
|
|
72
|
+
declare const provideIsPersonalized: (isPersonalized?: boolean) => void;
|
|
73
|
+
declare const useIsPersonalized: () => boolean;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Provides reactive access to the Uniform Context's current visitor quirks values
|
|
77
|
+
* This can be used when you want to read current quirk values directly.
|
|
78
|
+
*/
|
|
79
|
+
declare const useQuirks: () => vue_demi.Ref<{
|
|
80
|
+
[x: string]: string;
|
|
81
|
+
}>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Provides reactive access to the Uniform Context's current visitor scores values.
|
|
85
|
+
* This can be used when you want to read current score values directly.
|
|
86
|
+
*/
|
|
87
|
+
declare const useScores: () => vue_demi.Ref<{
|
|
88
|
+
[x: string]: number;
|
|
89
|
+
}>;
|
|
90
|
+
|
|
91
|
+
export { EdgeTestListComponentOptions, Personalize, PersonalizeStandard as PersonalizeEdge, Test, TestComponentProps, TestEdgeComponentProps, Track, TrackSlot, UniformContextProps, UniformContextProvider, VariantOutputType, isUsingUniformContext, onRouteChange, provideIsPersonalized, provideUniformContext, uniformContextInjectionKey, useIsPersonalized, useQuirks, useScores, useUniformContext };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";var $=Object.create;var A=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var Z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ee=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of W(t))!Y.call(e,i)&&i!==o&&A(e,i,{get:()=>t[i],enumerable:!(r=G(t,i))||r.enumerable});return e};var te=(e,t,o)=>(o=e!=null?$(X(e)):{},ee(t||!e||!e.__esModule?A(o,"default",{value:e,enumerable:!0}):o,e));var j=Z(b=>{"use strict";b.parse=re;b.serialize=ne;var oe=Object.prototype.toString,v=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function re(e,t){if(typeof e!="string")throw new TypeError("argument str must be a string");for(var o={},r=t||{},i=r.decode||ie,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]=pe(u,i)}a=s+1}return o}function ne(e,t,o){var r=o||{},i=r.encode||ae;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(!se(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 ie(e){return e.indexOf("%")!==-1?decodeURIComponent(e):e}function ae(e){return encodeURIComponent(e)}function se(e){return oe.call(e)==="[object Date]"||e instanceof Date}function pe(e,t){try{return t(e)}catch(o){return e}}});import{defineComponent as Te,h as ve,computed as he}from"vue-demi";var c=typeof window=="undefined";import{defineComponent as de,h as le}from"vue-demi";import{inject as R,provide as me}from"vue-demi";var N=te(j()),h=Symbol("uniformContextInjectionKey"),k=({context:e,outputType:t="standard",trackRouteOnRender:o=!0,vueAppProvide:r=me})=>{r(h,{context:e,outputType:t}),!c&&o&&L(e)};function L(e){e.update({url:new URL(window.location.href),cookies:N.default.parse(document.cookie)})}var m=()=>{let e=R(h);if(!e)throw Error("Could not inject Uniform's Context, make sure you're using <UniformContextProvider /> or the Nuxt module.");return e};function ue(){return Boolean(R(h))}var ce=de({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?()=>le(e.component,{...o}):null}}),q=ce;import{defineComponent as Pe,h as f}from"vue-demi";import{ScriptType as g}from"@uniformdev/context";import{EdgeNodeTagName as fe}from"@uniformdev/context";import{h as ye}from"vue-demi";var l=e=>ye(fe,e);var Ce=Pe({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:g.TestStart,domProps:{innerHTML:JSON.stringify(t)}}),e.variations.map(o=>[f(l,{dataType:g.ListItemSettings,domProps:{innerHTML:JSON.stringify({id:o.id})}}),f(l,{dataType:g.ListItem},()=>f(e.component,{...o}))]),f(l,{dataType:g.TestEnd})]}}),I=Ce;var ge=Te({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=he(()=>!c||t==="standard"?q:I);return()=>ve(o.value,{...e})}}),xe=ge;import{defineComponent as ze,h as Se}from"vue-demi";var be=ze({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),()=>Se(t.slots.default)}}),ke=be;import{defineComponent as _e,h as Be,computed as Fe}from"vue-demi";import{defineComponent as Re,ref as Ne,watch as Le,h as _,onServerPrefetch as qe,onMounted as Ie}from"vue-demi";import{ref as Ve,watchEffect as we}from"vue-demi";var M=Object.prototype.hasOwnProperty;function x(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--&&x(e[r],t[r]););return r===-1}if(!o||typeof e=="object"){r=0;for(o in e)if(M.call(e,o)&&++r&&!M.call(t,o)||!(o in t)||!x(e[o],t[o]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var V=()=>{let{context:e}=m(),t=Ve(e.scores);return we(()=>{let o=i=>t.value=i,r=e.scores;return x(t.value,r)||(t.value=r),e.events.on("scoresUpdated",o),()=>{e.events.off("scoresUpdated",o)}}),t};import{defineComponent as Oe,h as Ae}from"vue-demi";import{provide as Ee,inject as Ue}from"vue-demi";var D=Symbol("uniformIsPersonalized"),w=e=>{Ee(D,e)},y=()=>Ue(D,!1);var je=Oe({name:"PersonalizeStandard",inheritAttrs:!1,props:{personalized:Boolean},setup(e,t){return w(e.personalized),()=>Ae(t.slots.default,{...e})}}),H=je;var Me=Re({name:"PersonalizeStandard",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{context:t}=m(),o=V(),r=()=>t.personalize({name:e.name,variations:e.variations,take:e.count}),i=Ne();return qe(async()=>{i.value=r()}),Ie(async()=>{i.value||(i.value=r())}),Le([o,()=>e.name,()=>e.variations,()=>e.count],()=>{i.value=r()}),()=>_(H,{personalized:!0},()=>{var a;return(a=i.value)==null?void 0:a.variations.map(n=>{var s;return _(e.component,{key:n.id,personalizationResult:{variation:n,personalizationOccurred:(s=i.value)==null?void 0:s.personalized},...n})})})}}),B=Me;import{ScriptType as z}from"@uniformdev/context";import{defineComponent as De,h as P}from"vue-demi";var He=De({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:z.ListStart}),e.variations.map(t=>[P(l,{dataType:z.ListItemSettings,domProps:{innerHTML:JSON.stringify({id:t.id,pz:t.pz||null})}}),P(l,{dataType:z.ListItem},()=>P(e.component,{personalizationResult:{variation:t,personalizationOccurred:!1},...t}))]),P(l,{dataType:z.ListEnd})]}}),E=He;var Ke=_e({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"?B:E);return()=>Be(o.value,{...e})}}),Qe=Ke;import{defineComponent as Je,watchEffect as F,ref as S,h as $e}from"vue-demi";var Ge=Je({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=S(""),n=S(!1),s=S(),p=S();return F(()=>{a.value!==o&&(a.value=o,n.value=!1)}),F(()=>{var O;let u=!e.behavior||Array.isArray(e.behavior)&&!e.behavior.length;if(i||u||!s.value)return;let J=Array.isArray(e.behavior)?e.behavior:[e.behavior],U=()=>{var d;n.value||(r.update({enrichments:J}),n.value=!1,(d=p.value)==null||d.call(p))};if(e.disableVisibilityTrigger)U();else{(O=p.value)==null||O.call(p);let d=new IntersectionObserver(([T])=>{T.isIntersecting&&U()},{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)}}),()=>$e(e.tagName,{ref:s,...t.attrs},t.slots.default())}}),We=Ge;import{defineComponent as Xe,ref as K,watchEffect as Q,h as Ye}from"vue-demi";var Ze=Xe({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=K(),n=K(!1);return Q(()=>{a.value!==o&&(a.value=o,n.value=!1)}),Q(()=>{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})()}),()=>Ye(t.slots.default,{...t.attrs})}}),et=Ze;import{ref as tt,watch as ot}from"vue-demi";var rt=()=>{let{context:e}=m(),t=tt(e.quirks),o=r=>{t.value=r};return ot(e,()=>(e.events.on("quirksUpdated",o),()=>{e.events.off("quirksUpdated",o)})),t};export{Qe as Personalize,E as PersonalizeEdge,xe as Test,We as Track,et as TrackSlot,ke as UniformContextProvider,ue as isUsingUniformContext,L as onRouteChange,w as provideIsPersonalized,k as provideUniformContext,h as uniformContextInjectionKey,y as useIsPersonalized,rt 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 ue=Object.create;var w=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var ce=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var ye=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Pe=(e,t)=>{for(var o in t)w(e,o,{get:t[o],enumerable:!0})},K=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of le(t))!fe.call(e,i)&&i!==o&&w(e,i,{get:()=>t[i],enumerable:!(r=de(t,i))||r.enumerable});return e};var Ce=(e,t,o)=>(o=e!=null?ue(ce(e)):{},K(t||!e||!e.__esModule?w(o,"default",{value:e,enumerable:!0}):o,e)),Te=e=>K(w({},"__esModule",{value:!0}),e);var Q=ye(H=>{"use strict";H.parse=he;H.serialize=ge;var ve=Object.prototype.toString,E=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function he(e,t){if(typeof e!="string")throw new TypeError("argument str must be a string");for(var o={},r=t||{},i=r.decode||xe,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]=be(l,i)}a=s+1}return o}function ge(e,t,o){var r=o||{},i=r.encode||ze;if(typeof i!="function")throw new TypeError("option encode is invalid");if(!E.test(e))throw new TypeError("argument name is invalid");var a=i(t);if(a&&!E.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(!E.test(r.domain))throw new TypeError("option domain is invalid");n+="; Domain="+r.domain}if(r.path){if(!E.test(r.path))throw new TypeError("option path is invalid");n+="; Path="+r.path}if(r.expires){var p=r.expires;if(!Se(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 k=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(k){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 xe(e){return e.indexOf("%")!==-1?decodeURIComponent(e):e}function ze(e){return encodeURIComponent(e)}function Se(e){return ve.call(e)==="[object Date]"||e instanceof Date}function be(e,t){try{return t(e)}catch(o){return e}}});var Le={};Pe(Le,{Personalize:()=>ie,PersonalizeEdge:()=>M,Test:()=>Z,Track:()=>ae,TrackSlot:()=>se,UniformContextProvider:()=>ee,isUsingUniformContext:()=>$,onRouteChange:()=>_,provideIsPersonalized:()=>q,provideUniformContext:()=>U,uniformContextInjectionKey:()=>z,useIsPersonalized:()=>h,useQuirks:()=>pe,useScores:()=>N,useUniformContext:()=>m});module.exports=Te(Le);var v=require("vue-demi");var T=typeof window=="undefined";var O=require("vue-demi");var x=require("vue-demi");var J=Ce(Q()),z=Symbol("uniformContextInjectionKey"),U=({context:e,outputType:t="standard",trackRouteOnRender:o=!0,vueAppProvide:r=x.provide})=>{r(z,{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,x.inject)(z);if(!e)throw Error("Could not inject Uniform's Context, make sure you're using <UniformContextProvider /> or the Nuxt module.");return e};function $(){return Boolean((0,x.inject)(z))}var ke=(0,O.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,O.h)(e.component,{...o}):null}}),G=ke;var P=require("vue-demi"),S=require("@uniformdev/context");var W=require("@uniformdev/context"),X=require("vue-demi"),f=e=>(0,X.h)(W.EdgeNodeTagName,e);var Ve=(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:S.ScriptType.TestStart,domProps:{innerHTML:JSON.stringify(t)}}),e.variations.map(o=>[(0,P.h)(f,{dataType:S.ScriptType.ListItemSettings,domProps:{innerHTML:JSON.stringify({id:o.id})}}),(0,P.h)(f,{dataType:S.ScriptType.ListItem},()=>(0,P.h)(e.component,{...o}))]),(0,P.h)(f,{dataType:S.ScriptType.TestEnd})]}}),Y=Ve;var we=(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"?G:Y);return()=>(0,v.h)(o.value,{...e})}}),Z=we;var A=require("vue-demi");var Ee=(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 U(e),()=>(0,A.h)(t.slots.default)}}),ee=Ee;var g=require("vue-demi");var u=require("vue-demi");var R=require("vue-demi");var te=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(te.call(e,o)&&++r&&!te.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"),oe=Symbol("uniformIsPersonalized"),q=e=>{(0,L.provide)(oe,e)},h=()=>(0,L.inject)(oe,!1);var Ue=(0,I.defineComponent)({name:"PersonalizeStandard",inheritAttrs:!1,props:{personalized:Boolean},setup(e,t){return q(e.personalized),()=>(0,I.h)(t.slots.default,{...e})}}),re=Ue;var Oe=(0,u.defineComponent)({name:"PersonalizeStandard",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{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)(re,{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})})})}}),ne=Oe;var b=require("@uniformdev/context");var C=require("vue-demi"),Ae=(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:b.ScriptType.ListStart}),e.variations.map(t=>[(0,C.h)(f,{dataType:b.ScriptType.ListItemSettings,domProps:{innerHTML:JSON.stringify({id:t.id,pz:t.pz||null})}}),(0,C.h)(f,{dataType:b.ScriptType.ListItem},()=>(0,C.h)(e.component,{personalizationResult:{variation:t,personalizationOccurred:!1},...t}))]),(0,C.h)(f,{dataType:b.ScriptType.ListEnd})]}}),M=Ae;var je=(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"?ne:M);return()=>(0,g.h)(o.value,{...e})}}),ie=je;var d=require("vue-demi");var Re=(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 F;let l=!e.behavior||Array.isArray(e.behavior)&&!e.behavior.length;if(i||l||!s.value)return;let me=Array.isArray(e.behavior)?e.behavior:[e.behavior],B=()=>{var c;n.value||(r.update({enrichments:me}),n.value=!1,(c=p.value)==null||c.call(p))};if(e.disableVisibilityTrigger)B();else{(F=p.value)==null||F.call(p);let c=new IntersectionObserver(([V])=>{V.isIntersecting&&B()},{threshold:e.threshold});c.observe(s.value),p.value=()=>{var V;return(V=c.disconnect)==null?void 0:V.call(c)}}return()=>{var c;(c=p.value)==null||c.call(p)}}),()=>(0,d.h)(e.tagName,{ref:s,...t.attrs},t.slots.default())}}),ae=Re;var y=require("vue-demi");var Ne=(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 k=Array.isArray(e.behavior)?e.behavior:[e.behavior];r.update({enrichments:k}),n.value=!0})()}),()=>(0,y.h)(t.slots.default,{...t.attrs})}}),se=Ne;var D=require("vue-demi");var pe=()=>{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,isUsingUniformContext,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 $=Object.create;var A=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var Z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ee=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of W(t))!Y.call(e,i)&&i!==o&&A(e,i,{get:()=>t[i],enumerable:!(r=G(t,i))||r.enumerable});return e};var te=(e,t,o)=>(o=e!=null?$(X(e)):{},ee(t||!e||!e.__esModule?A(o,"default",{value:e,enumerable:!0}):o,e));var j=Z(b=>{"use strict";b.parse=re;b.serialize=ne;var oe=Object.prototype.toString,v=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function re(e,t){if(typeof e!="string")throw new TypeError("argument str must be a string");for(var o={},r=t||{},i=r.decode||ie,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]=pe(u,i)}a=s+1}return o}function ne(e,t,o){var r=o||{},i=r.encode||ae;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(!se(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 ie(e){return e.indexOf("%")!==-1?decodeURIComponent(e):e}function ae(e){return encodeURIComponent(e)}function se(e){return oe.call(e)==="[object Date]"||e instanceof Date}function pe(e,t){try{return t(e)}catch(o){return e}}});import{defineComponent as Te,h as ve,computed as he}from"vue-demi";var c=typeof window=="undefined";import{defineComponent as de,h as le}from"vue-demi";import{inject as R,provide as me}from"vue-demi";var N=te(j()),h=Symbol("uniformContextInjectionKey"),k=({context:e,outputType:t="standard",trackRouteOnRender:o=!0,vueAppProvide:r=me})=>{r(h,{context:e,outputType:t}),!c&&o&&L(e)};function L(e){e.update({url:new URL(window.location.href),cookies:N.default.parse(document.cookie)})}var m=()=>{let e=R(h);if(!e)throw Error("Could not inject Uniform's Context, make sure you're using <UniformContextProvider /> or the Nuxt module.");return e};function ue(){return Boolean(R(h))}var ce=de({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?()=>le(e.component,{...o}):null}}),q=ce;import{defineComponent as Pe,h as f}from"vue-demi";import{ScriptType as g}from"@uniformdev/context";import{EdgeNodeTagName as fe}from"@uniformdev/context";import{h as ye}from"vue-demi";var l=e=>ye(fe,e);var Ce=Pe({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:g.TestStart,domProps:{innerHTML:JSON.stringify(t)}}),e.variations.map(o=>[f(l,{dataType:g.ListItemSettings,domProps:{innerHTML:JSON.stringify({id:o.id})}}),f(l,{dataType:g.ListItem},()=>f(e.component,{...o}))]),f(l,{dataType:g.TestEnd})]}}),I=Ce;var ge=Te({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=he(()=>!c||t==="standard"?q:I);return()=>ve(o.value,{...e})}}),xe=ge;import{defineComponent as ze,h as Se}from"vue-demi";var be=ze({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),()=>Se(t.slots.default)}}),ke=be;import{defineComponent as _e,h as Be,computed as Fe}from"vue-demi";import{defineComponent as Re,ref as Ne,watch as Le,h as _,onServerPrefetch as qe,onMounted as Ie}from"vue-demi";import{ref as Ve,watchEffect as we}from"vue-demi";var M=Object.prototype.hasOwnProperty;function x(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--&&x(e[r],t[r]););return r===-1}if(!o||typeof e=="object"){r=0;for(o in e)if(M.call(e,o)&&++r&&!M.call(t,o)||!(o in t)||!x(e[o],t[o]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var V=()=>{let{context:e}=m(),t=Ve(e.scores);return we(()=>{let o=i=>t.value=i,r=e.scores;return x(t.value,r)||(t.value=r),e.events.on("scoresUpdated",o),()=>{e.events.off("scoresUpdated",o)}}),t};import{defineComponent as Oe,h as Ae}from"vue-demi";import{provide as Ee,inject as Ue}from"vue-demi";var D=Symbol("uniformIsPersonalized"),w=e=>{Ee(D,e)},y=()=>Ue(D,!1);var je=Oe({name:"PersonalizeStandard",inheritAttrs:!1,props:{personalized:Boolean},setup(e,t){return w(e.personalized),()=>Ae(t.slots.default,{...e})}}),H=je;var Me=Re({name:"PersonalizeStandard",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{context:t}=m(),o=V(),r=()=>t.personalize({name:e.name,variations:e.variations,take:e.count}),i=Ne();return qe(async()=>{i.value=r()}),Ie(async()=>{i.value||(i.value=r())}),Le([o,()=>e.name,()=>e.variations,()=>e.count],()=>{i.value=r()}),()=>_(H,{personalized:!0},()=>{var a;return(a=i.value)==null?void 0:a.variations.map(n=>{var s;return _(e.component,{key:n.id,personalizationResult:{variation:n,personalizationOccurred:(s=i.value)==null?void 0:s.personalized},...n})})})}}),B=Me;import{ScriptType as z}from"@uniformdev/context";import{defineComponent as De,h as P}from"vue-demi";var He=De({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:z.ListStart}),e.variations.map(t=>[P(l,{dataType:z.ListItemSettings,domProps:{innerHTML:JSON.stringify({id:t.id,pz:t.pz||null})}}),P(l,{dataType:z.ListItem},()=>P(e.component,{personalizationResult:{variation:t,personalizationOccurred:!1},...t}))]),P(l,{dataType:z.ListEnd})]}}),E=He;var Ke=_e({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"?B:E);return()=>Be(o.value,{...e})}}),Qe=Ke;import{defineComponent as Je,watchEffect as F,ref as S,h as $e}from"vue-demi";var Ge=Je({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=S(""),n=S(!1),s=S(),p=S();return F(()=>{a.value!==o&&(a.value=o,n.value=!1)}),F(()=>{var O;let u=!e.behavior||Array.isArray(e.behavior)&&!e.behavior.length;if(i||u||!s.value)return;let J=Array.isArray(e.behavior)?e.behavior:[e.behavior],U=()=>{var d;n.value||(r.update({enrichments:J}),n.value=!1,(d=p.value)==null||d.call(p))};if(e.disableVisibilityTrigger)U();else{(O=p.value)==null||O.call(p);let d=new IntersectionObserver(([T])=>{T.isIntersecting&&U()},{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)}}),()=>$e(e.tagName,{ref:s,...t.attrs},t.slots.default())}}),We=Ge;import{defineComponent as Xe,ref as K,watchEffect as Q,h as Ye}from"vue-demi";var Ze=Xe({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=K(),n=K(!1);return Q(()=>{a.value!==o&&(a.value=o,n.value=!1)}),Q(()=>{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})()}),()=>Ye(t.slots.default,{...t.attrs})}}),et=Ze;import{ref as tt,watch as ot}from"vue-demi";var rt=()=>{let{context:e}=m(),t=tt(e.quirks),o=r=>{t.value=r};return ot(e,()=>(e.events.on("quirksUpdated",o),()=>{e.events.off("quirksUpdated",o)})),t};export{Qe as Personalize,E as PersonalizeEdge,xe as Test,We as Track,et as TrackSlot,ke as UniformContextProvider,ue as isUsingUniformContext,L as onRouteChange,w as provideIsPersonalized,k as provideUniformContext,h as uniformContextInjectionKey,y as useIsPersonalized,rt 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-
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "16.0.1-nuxt.149+df378f9ac",
|
|
4
|
+
"description": "Vue SDK for Uniform Context",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
|
-
"main": "./dist/index.
|
|
7
|
-
"module": "./dist/index.
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.esm.js",
|
|
8
8
|
"exports": {
|
|
9
|
-
"import":
|
|
10
|
-
|
|
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
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
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-
|
|
20
|
-
"
|
|
26
|
+
"@uniformdev/context": "^16.0.1-nuxt.149+df378f9ac",
|
|
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
|
-
"@
|
|
24
|
-
"@
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"vue-
|
|
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
|
-
"
|
|
61
|
+
"browserslist": [
|
|
62
|
+
"> 1%",
|
|
63
|
+
"last 2 versions",
|
|
64
|
+
"not dead"
|
|
65
|
+
],
|
|
66
|
+
"gitHead": "df378f9aceb4936066e0fbcaa76de8630f0fe654"
|
|
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;
|