@builder.io/sdk-qwik 0.0.12 → 0.0.13
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/.yarn/cache/@builder.io-qwik-npm-0.0.103-bdc7786a46-98363e9103.zip +0 -0
- package/.yarn/cache/@gar-promisify-npm-1.1.3-ac1a325862-4059f790e2.zip +0 -0
- package/.yarn/cache/@npmcli-fs-npm-2.1.2-08d434e77b-405074965e.zip +0 -0
- package/.yarn/cache/@npmcli-move-file-npm-2.0.1-b593d8f741-52dc02259d.zip +0 -0
- package/.yarn/cache/@tootallnate-once-npm-2.0.0-e36cf4f140-ad87447820.zip +0 -0
- package/.yarn/cache/@types-node-npm-18.7.6-c1eafa3d9a-5122988c32.zip +0 -0
- package/.yarn/cache/abbrev-npm-1.1.1-3659247eab-a4a97ec07d.zip +0 -0
- package/.yarn/cache/agent-base-npm-6.0.2-428f325a93-f52b6872cc.zip +0 -0
- package/.yarn/cache/agentkeepalive-npm-4.2.1-b86a9fb343-39cb49ed8c.zip +0 -0
- package/.yarn/cache/aggregate-error-npm-3.1.0-415a406f4e-1101a33f21.zip +0 -0
- package/.yarn/cache/ansi-regex-npm-5.0.1-c963a48615-2aa4bb54ca.zip +0 -0
- package/.yarn/cache/aproba-npm-2.0.0-8716bcfde6-5615cadcfb.zip +0 -0
- package/.yarn/cache/are-we-there-yet-npm-3.0.1-3395b1512f-52590c2486.zip +0 -0
- package/.yarn/cache/balanced-match-npm-1.0.2-a53c126459-9706c088a2.zip +0 -0
- package/.yarn/cache/brace-expansion-npm-1.1.11-fb95eb05ad-faf34a7bb0.zip +0 -0
- package/.yarn/cache/brace-expansion-npm-2.0.1-17aa2616f9-a61e7cd2e8.zip +0 -0
- package/.yarn/cache/cacache-npm-16.1.2-0d36d1aaf1-defe1d6f55.zip +0 -0
- package/.yarn/cache/chownr-npm-2.0.0-638f1c9c61-c57cf9dd07.zip +0 -0
- package/.yarn/cache/clean-stack-npm-2.2.0-a8ce435a5c-2ac8cd2b2f.zip +0 -0
- package/.yarn/cache/color-support-npm-1.1.3-3be5c53455-9b73568176.zip +0 -0
- package/.yarn/cache/concat-map-npm-0.0.1-85a921b7ee-902a9f5d89.zip +0 -0
- package/.yarn/cache/console-control-strings-npm-1.1.0-e3160e5275-8755d76787.zip +0 -0
- package/.yarn/cache/debug-npm-4.3.4-4513954577-3dbad3f94e.zip +0 -0
- package/.yarn/cache/delegates-npm-1.0.0-9b1942d75f-a51744d9b5.zip +0 -0
- package/.yarn/cache/depd-npm-1.1.2-b0c8414da7-6b406620d2.zip +0 -0
- package/.yarn/cache/emoji-regex-npm-8.0.0-213764015c-d4c5c39d5a.zip +0 -0
- package/.yarn/cache/encoding-npm-0.1.13-82a1837d30-bb98632f8f.zip +0 -0
- package/.yarn/cache/env-paths-npm-2.2.1-7c7577428c-65b5df55a8.zip +0 -0
- package/.yarn/cache/err-code-npm-2.0.3-082e0ff9a7-8b7b1be20d.zip +0 -0
- package/.yarn/cache/esbuild-darwin-arm64-npm-0.14.54-ec53803fa6-8.zip +0 -0
- package/.yarn/cache/esbuild-npm-0.14.54-b3dcd8a41e-49e360b118.zip +0 -0
- package/.yarn/cache/fs-minipass-npm-2.1.0-501ef87306-1b8d128dae.zip +0 -0
- package/.yarn/cache/fs.realpath-npm-1.0.0-c8f05d8126-99ddea01a7.zip +0 -0
- package/.yarn/cache/fsevents-npm-2.3.2-a881d6ac9f-97ade64e75.zip +0 -0
- package/.yarn/cache/fsevents-patch-3340e2eb10-8.zip +0 -0
- package/.yarn/cache/function-bind-npm-1.1.1-b56b322ae9-b32fbaebb3.zip +0 -0
- package/.yarn/cache/gauge-npm-4.0.4-8f878385e9-788b6bfe52.zip +0 -0
- package/.yarn/cache/glob-npm-7.2.3-2d866d17a5-29452e97b3.zip +0 -0
- package/.yarn/cache/glob-npm-8.0.3-750f909025-50bcdea19d.zip +0 -0
- package/.yarn/cache/graceful-fs-npm-4.2.10-79c70989ca-3f109d70ae.zip +0 -0
- package/.yarn/cache/has-npm-1.0.3-b7f00631c1-b9ad53d53b.zip +0 -0
- package/.yarn/cache/has-unicode-npm-2.0.1-893adb4747-1eab07a743.zip +0 -0
- package/.yarn/cache/http-cache-semantics-npm-4.1.0-860520a31f-974de94a81.zip +0 -0
- package/.yarn/cache/http-proxy-agent-npm-5.0.0-7f1f121b83-e2ee1ff165.zip +0 -0
- package/.yarn/cache/https-proxy-agent-npm-5.0.1-42d65f358e-571fccdf38.zip +0 -0
- package/.yarn/cache/humanize-ms-npm-1.2.1-e942bd7329-9c7a74a282.zip +0 -0
- package/.yarn/cache/iconv-lite-npm-0.6.3-24b8aae27e-3f60d47a5c.zip +0 -0
- package/.yarn/cache/imurmurhash-npm-0.1.4-610c5068a0-7cae75c8cd.zip +0 -0
- package/.yarn/cache/indent-string-npm-4.0.0-7b717435b2-824cfb9929.zip +0 -0
- package/.yarn/cache/infer-owner-npm-1.0.4-685ac3d2af-181e732764.zip +0 -0
- package/.yarn/cache/inflight-npm-1.0.6-ccedb4b908-f4f76aa072.zip +0 -0
- package/.yarn/cache/inherits-npm-2.0.4-c66b3957a0-4a48a73384.zip +0 -0
- package/.yarn/cache/ip-npm-2.0.0-204facb3cc-cfcfac6b87.zip +0 -0
- package/.yarn/cache/is-core-module-npm-2.10.0-6dff9310aa-0f3f77811f.zip +0 -0
- package/.yarn/cache/is-fullwidth-code-point-npm-3.0.0-1ecf4ebee5-44a30c2945.zip +0 -0
- package/.yarn/cache/is-lambda-npm-1.0.1-7ab55bc8a8-93a32f0194.zip +0 -0
- package/.yarn/cache/isexe-npm-2.0.0-b58870bd2e-26bf6c5480.zip +0 -0
- package/.yarn/cache/lru-cache-npm-6.0.0-b4c8668fe1-f97f499f89.zip +0 -0
- package/.yarn/cache/lru-cache-npm-7.14.0-354cf654ec-efdd329f2c.zip +0 -0
- package/.yarn/cache/make-fetch-happen-npm-10.2.1-f1cc7cd2df-2332eb9a8e.zip +0 -0
- package/.yarn/cache/minimatch-npm-3.1.2-9405269906-c154e56640.zip +0 -0
- package/.yarn/cache/minimatch-npm-5.1.0-34f6240621-15ce53d31a.zip +0 -0
- package/.yarn/cache/minipass-collect-npm-1.0.2-3b4676eab5-14df761028.zip +0 -0
- package/.yarn/cache/minipass-fetch-npm-2.1.1-c4a8efdb09-1aae0c2240.zip +0 -0
- package/.yarn/cache/minipass-flush-npm-1.0.5-efe79d9826-56269a0b22.zip +0 -0
- package/.yarn/cache/minipass-npm-3.3.5-a555b091e7-f89f02bcaa.zip +0 -0
- package/.yarn/cache/minipass-pipeline-npm-1.2.4-5924cb077f-b14240dac0.zip +0 -0
- package/.yarn/cache/minipass-sized-npm-1.0.3-306d86f432-79076749fc.zip +0 -0
- package/.yarn/cache/minizlib-npm-2.1.2-ea89cd0cfb-f1fdeac0b0.zip +0 -0
- package/.yarn/cache/mkdirp-npm-1.0.4-37f6ef56b9-a96865108c.zip +0 -0
- package/.yarn/cache/ms-npm-2.1.2-ec0c1512ff-673cdb2c31.zip +0 -0
- package/.yarn/cache/ms-npm-2.1.3-81ff3cfac1-aa92de6080.zip +0 -0
- package/.yarn/cache/nanoid-npm-3.3.4-3d250377d6-2fddd6dee9.zip +0 -0
- package/.yarn/cache/negotiator-npm-0.6.3-9d50e36171-b8ffeb1e26.zip +0 -0
- package/.yarn/cache/node-gyp-npm-9.1.0-2091059b31-1437fa4a87.zip +0 -0
- package/.yarn/cache/nopt-npm-5.0.0-304b40fbfe-d35fdec187.zip +0 -0
- package/.yarn/cache/npmlog-npm-6.0.2-e0e69455c7-ae238cd264.zip +0 -0
- package/.yarn/cache/once-npm-1.4.0-ccf03ef07a-cd0a885013.zip +0 -0
- package/.yarn/cache/p-map-npm-4.0.0-4677ae07c7-cb0ab21ec0.zip +0 -0
- package/.yarn/cache/path-is-absolute-npm-1.0.1-31bc695ffd-060840f92c.zip +0 -0
- package/.yarn/cache/path-parse-npm-1.0.7-09564527b7-49abf3d811.zip +0 -0
- package/.yarn/cache/picocolors-npm-1.0.0-d81e0b1927-a2e8092dd8.zip +0 -0
- package/.yarn/cache/postcss-npm-8.4.16-7367383579-10eee25efd.zip +0 -0
- package/.yarn/cache/promise-inflight-npm-1.0.1-5bb925afac-2274948309.zip +0 -0
- package/.yarn/cache/promise-retry-npm-2.0.1-871f0b01b7-f96a3f6d90.zip +0 -0
- package/.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-d4ea81502d.zip +0 -0
- package/.yarn/cache/resolve-npm-1.22.1-3980488690-07af5fc1e8.zip +0 -0
- package/.yarn/cache/resolve-patch-46f9469d0d-5656f4d0be.zip +0 -0
- package/.yarn/cache/retry-npm-0.12.0-72ac7fb4cc-623bd7d2e5.zip +0 -0
- package/.yarn/cache/rimraf-npm-3.0.2-2cb7dac69a-87f4164e39.zip +0 -0
- package/.yarn/cache/rollup-npm-2.78.0-09284f4c78-01b5a7ae08.zip +0 -0
- package/.yarn/cache/safe-buffer-npm-5.2.1-3481c8aa9b-b99c4b41fd.zip +0 -0
- package/.yarn/cache/safer-buffer-npm-2.1.2-8d5c0b705e-cab8f25ae6.zip +0 -0
- package/.yarn/cache/semver-npm-7.3.7-3bfe704194-2fa3e87756.zip +0 -0
- package/.yarn/cache/set-blocking-npm-2.0.0-49e2cffa24-6e65a05f7c.zip +0 -0
- package/.yarn/cache/signal-exit-npm-3.0.7-bd270458a3-a2f098f247.zip +0 -0
- package/.yarn/cache/smart-buffer-npm-4.2.0-5ac3f668bb-b5167a7142.zip +0 -0
- package/.yarn/cache/socks-npm-2.7.0-cc1cb019db-0b5d94e2b3.zip +0 -0
- package/.yarn/cache/socks-proxy-agent-npm-7.0.0-7aacf32ea0-7205543701.zip +0 -0
- package/.yarn/cache/source-map-js-npm-1.0.2-ee4f9f9b30-c049a7fc4d.zip +0 -0
- package/.yarn/cache/ssri-npm-9.0.1-33ce27f4f8-fb58f5e46b.zip +0 -0
- package/.yarn/cache/string-width-npm-4.2.3-2c27177bae-e52c10dc3f.zip +0 -0
- package/.yarn/cache/string_decoder-npm-1.3.0-2422117fd0-8417646695.zip +0 -0
- package/.yarn/cache/strip-ansi-npm-6.0.1-caddc7cb40-f3cd25890a.zip +0 -0
- package/.yarn/cache/supports-preserve-symlinks-flag-npm-1.0.0-f17c4d0028-53b1e247e6.zip +0 -0
- package/.yarn/cache/tar-npm-6.1.11-e6ac3cba9c-a04c07bb9e.zip +0 -0
- package/.yarn/cache/typescript-npm-4.7.4-65aa6ffb42-5750181b1c.zip +0 -0
- package/.yarn/cache/typescript-patch-ae154b3216-96d3030cb0.zip +0 -0
- package/.yarn/cache/unique-filename-npm-1.1.1-c885c5095b-cf4998c922.zip +0 -0
- package/.yarn/cache/unique-slug-npm-2.0.2-f6ba1ddeb7-5b6876a645.zip +0 -0
- package/.yarn/cache/util-deprecate-npm-1.0.2-e3fe1a219c-474acf1146.zip +0 -0
- package/.yarn/cache/vite-npm-3.0.2-a17ab24a12-10aebec0df.zip +0 -0
- package/.yarn/cache/which-npm-2.0.2-320ddf72f7-1a5c563d3c.zip +0 -0
- package/.yarn/cache/wide-align-npm-1.1.5-889d77e592-d5fc37cd56.zip +0 -0
- package/.yarn/cache/wrappy-npm-1.0.2-916de4d4b3-159da4805f.zip +0 -0
- package/.yarn/cache/yallist-npm-4.0.0-b493d9e907-343617202a.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/README.md +7 -3
- package/lib/index.qwik.cjs +421 -186
- package/lib/index.qwik.mjs +421 -186
- package/package.json +4 -3
- package/src/blocks/button/button.jsx +7 -2
- package/src/blocks/columns/columns.jsx +7 -3
- package/src/blocks/form/builder-blocks.jsx +1 -1
- package/src/blocks/symbol/symbol.jsx +1 -3
- package/src/components/render-block/block-styles.jsx +1 -1
- package/src/components/render-block/render-block.jsx +2 -3
- package/src/components/render-block/render-repeated-block.jsx +4 -1
- package/src/components/render-content/render-content.jsx +14 -5
- package/src/components/render-inlined-styles.jsx +4 -3
- package/src/functions/get-processed-block.js +10 -6
- package/src/functions/get-processed-block.test.js +1 -1
- package/src/functions/track.js +71 -2
- package/src/helpers/cookie.js +59 -0
- package/src/helpers/localStorage.js +34 -0
- package/src/helpers/nullable.js +4 -0
- package/src/helpers/sessionId.js +26 -0
- package/src/helpers/time.js +5 -0
- package/src/helpers/url.js +10 -0
- package/src/helpers/url.test.js +15 -0
- package/src/helpers/uuid.js +13 -0
- package/src/helpers/visitorId.js +33 -0
- package/src/types/can-track.js +0 -0
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-qwik",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Builder.io Qwik SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.qwik.cjs",
|
|
7
7
|
"module": "./lib/index.qwik.mjs",
|
|
8
8
|
"qwik": "./lib/index.qwik.mjs",
|
|
9
|
+
"types": "./types.d.ts",
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
11
12
|
"import": "./lib/index.qwik.mjs",
|
|
@@ -17,12 +18,12 @@
|
|
|
17
18
|
"release:dev": "npm version prerelease --no-git-tag-version && npm publish --tag latest --access public"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
|
-
"@builder.io/qwik": "0.0.
|
|
21
|
+
"@builder.io/qwik": "0.0.103",
|
|
21
22
|
"@types/node": "latest",
|
|
22
23
|
"typescript": "4.7.4",
|
|
23
24
|
"vite": "3.0.2"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
26
|
-
"@builder.io/qwik": "
|
|
27
|
+
"@builder.io/qwik": "0.0.103"
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// GENERATED BY MITOSIS
|
|
2
2
|
|
|
3
|
-
import { Fragment, component$, h } from "@builder.io/qwik";
|
|
3
|
+
import { Fragment, component$, h, useStylesScoped$ } from "@builder.io/qwik";
|
|
4
4
|
export const Button = component$((props) => {
|
|
5
|
+
useStylesScoped$(STYLES);
|
|
5
6
|
return (
|
|
6
7
|
<Fragment>
|
|
7
8
|
{props.link ? (
|
|
@@ -14,9 +15,13 @@ export const Button = component$((props) => {
|
|
|
14
15
|
{props.text}
|
|
15
16
|
</a>
|
|
16
17
|
) : (
|
|
17
|
-
<
|
|
18
|
+
<button class="button-Button" {...props.attributes}>
|
|
19
|
+
{props.text}
|
|
20
|
+
</button>
|
|
18
21
|
)}
|
|
19
22
|
</Fragment>
|
|
20
23
|
);
|
|
21
24
|
});
|
|
22
25
|
export default Button;
|
|
26
|
+
export const STYLES = `.button-Button {
|
|
27
|
+
all: unset; }`;
|
|
@@ -76,7 +76,11 @@ export const Columns = component$((props) => {
|
|
|
76
76
|
}}
|
|
77
77
|
key={index}
|
|
78
78
|
>
|
|
79
|
-
<RenderBlocks
|
|
79
|
+
<RenderBlocks
|
|
80
|
+
blocks={column.blocks}
|
|
81
|
+
path={`component.options.columns.${index}.blocks`}
|
|
82
|
+
parent={props.builderBlock.id}
|
|
83
|
+
></RenderBlocks>
|
|
80
84
|
</div>
|
|
81
85
|
);
|
|
82
86
|
})}
|
|
@@ -87,10 +91,10 @@ export default Columns;
|
|
|
87
91
|
export const STYLES = `.div-Columns {
|
|
88
92
|
display: flex;
|
|
89
93
|
align-items: stretch;
|
|
90
|
-
line-height: normal; }@media (max-width:
|
|
94
|
+
line-height: normal; }@media (max-width: 991px) { .div-Columns {
|
|
91
95
|
flex-direction: var(--flex-dir-tablet); } }@media (max-width: 639px) { .div-Columns {
|
|
92
96
|
flex-direction: var(--flex-dir); } }.div-Columns-2 {
|
|
93
|
-
flex-grow: 1; }@media (max-width:
|
|
97
|
+
flex-grow: 1; }@media (max-width: 991px) { .div-Columns-2 {
|
|
94
98
|
width: var(--column-width-tablet) !important;
|
|
95
99
|
margin-left: var(--column-margin-left-tablet) !important; } }@media (max-width: 639px) { .div-Columns-2 {
|
|
96
100
|
width: var(--column-width) !important;
|
|
@@ -4,7 +4,7 @@ import { Fragment, component$, h } from "@builder.io/qwik";
|
|
|
4
4
|
export const BuilderBlocks = component$((props) => {
|
|
5
5
|
return (
|
|
6
6
|
<Fragment>
|
|
7
|
-
NOT YET IMPLEMENTED: <code>BuilderBlocks</code>
|
|
7
|
+
NOT YET IMPLEMENTED: <code>BuilderBlocks {JSON.stringify(props)}</code>
|
|
8
8
|
</Fragment>
|
|
9
9
|
);
|
|
10
10
|
});
|
|
@@ -19,9 +19,7 @@ export const Symbol = component$((props) => {
|
|
|
19
19
|
state.content = props.symbol?.content;
|
|
20
20
|
});
|
|
21
21
|
useWatch$(({ track }) => {
|
|
22
|
-
props
|
|
23
|
-
props.symbol && track(props.symbol, "model");
|
|
24
|
-
props.symbol && track(props.symbol, "entry");
|
|
22
|
+
props && track(props, "symbol");
|
|
25
23
|
state && track(state, "content");
|
|
26
24
|
const symbolToUse = props.symbol;
|
|
27
25
|
/**
|
|
@@ -11,7 +11,7 @@ export const useBlock = function useBlock(props, state) {
|
|
|
11
11
|
block: props.block,
|
|
12
12
|
state: props.context.state,
|
|
13
13
|
context: props.context.context,
|
|
14
|
-
|
|
14
|
+
shouldEvaluateBindings: true,
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
export const css = function css(props, state) {
|
|
@@ -17,7 +17,7 @@ export const component = function component(props, state) {
|
|
|
17
17
|
block: props.block,
|
|
18
18
|
state: props.context.state,
|
|
19
19
|
context: props.context.context,
|
|
20
|
-
|
|
20
|
+
shouldEvaluateBindings: false,
|
|
21
21
|
}).component?.name;
|
|
22
22
|
|
|
23
23
|
if (!componentName) {
|
|
@@ -57,7 +57,7 @@ export const useBlock = function useBlock(props, state) {
|
|
|
57
57
|
block: props.block,
|
|
58
58
|
state: props.context.state,
|
|
59
59
|
context: props.context.context,
|
|
60
|
-
|
|
60
|
+
shouldEvaluateBindings: true,
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
63
|
export const attributes = function attributes(props, state) {
|
|
@@ -173,7 +173,6 @@ export const RenderBlock = (props) => {
|
|
|
173
173
|
key={index}
|
|
174
174
|
repeatContext={data.context}
|
|
175
175
|
block={data.block}
|
|
176
|
-
context={props.context}
|
|
177
176
|
></RenderRepeatedBlock>
|
|
178
177
|
);
|
|
179
178
|
})
|
|
@@ -31,7 +31,10 @@ export const RenderRepeatedBlock = component$((props) => {
|
|
|
31
31
|
})
|
|
32
32
|
);
|
|
33
33
|
return (
|
|
34
|
-
<RenderBlock
|
|
34
|
+
<RenderBlock
|
|
35
|
+
block={props.block}
|
|
36
|
+
context={props.repeatContext}
|
|
37
|
+
></RenderBlock>
|
|
35
38
|
);
|
|
36
39
|
});
|
|
37
40
|
export default RenderRepeatedBlock;
|
|
@@ -44,6 +44,9 @@ export const useContent = function useContent(props, state, elementRef) {
|
|
|
44
44
|
};
|
|
45
45
|
return mergedContent;
|
|
46
46
|
};
|
|
47
|
+
export const canTrackToUse = function canTrackToUse(props, state, elementRef) {
|
|
48
|
+
return props.canTrack || true;
|
|
49
|
+
};
|
|
47
50
|
export const contentState = function contentState(props, state, elementRef) {
|
|
48
51
|
return {
|
|
49
52
|
...props.content?.data?.state,
|
|
@@ -131,9 +134,12 @@ export const httpReqsData = function httpReqsData(props, state, elementRef) {
|
|
|
131
134
|
return {};
|
|
132
135
|
};
|
|
133
136
|
export const onClick = function onClick(props, state, elementRef, _event) {
|
|
134
|
-
if (useContent(props, state, elementRef)
|
|
135
|
-
track(
|
|
137
|
+
if (useContent(props, state, elementRef)) {
|
|
138
|
+
track({
|
|
139
|
+
type: "click",
|
|
140
|
+
canTrack: canTrackToUse(props, state, elementRef),
|
|
136
141
|
contentId: useContent(props, state, elementRef).id,
|
|
142
|
+
orgId: props.apiKey,
|
|
137
143
|
});
|
|
138
144
|
}
|
|
139
145
|
};
|
|
@@ -244,7 +250,7 @@ export const RenderContent = component$((props) => {
|
|
|
244
250
|
useClientEffect$(() => {
|
|
245
251
|
if (isBrowser()) {
|
|
246
252
|
if (isEditing()) {
|
|
247
|
-
state.forceReRenderCount
|
|
253
|
+
state.forceReRenderCount = state.forceReRenderCount + 1;
|
|
248
254
|
_useMutableProps(elementRef.current, true);
|
|
249
255
|
|
|
250
256
|
registerInsertMenu();
|
|
@@ -265,9 +271,12 @@ export const RenderContent = component$((props) => {
|
|
|
265
271
|
);
|
|
266
272
|
}
|
|
267
273
|
|
|
268
|
-
if (useContent(props, state, elementRef)
|
|
269
|
-
track(
|
|
274
|
+
if (useContent(props, state, elementRef)) {
|
|
275
|
+
track({
|
|
276
|
+
type: "impression",
|
|
277
|
+
canTrack: canTrackToUse(props, state, elementRef),
|
|
270
278
|
contentId: useContent(props, state, elementRef).id,
|
|
279
|
+
orgId: props.apiKey,
|
|
271
280
|
});
|
|
272
281
|
} // override normal content in preview mode
|
|
273
282
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// GENERATED BY MITOSIS
|
|
2
2
|
|
|
3
3
|
import { TARGET } from "../constants/target.js";
|
|
4
|
-
import { Fragment,
|
|
4
|
+
import { Fragment, h } from "@builder.io/qwik";
|
|
5
5
|
export const injectedStyleScript = function injectedStyleScript(props, state) {
|
|
6
6
|
return `<${tagName(props, state)}>${props.styles}</${tagName(props, state)}>`;
|
|
7
7
|
};
|
|
@@ -10,8 +10,9 @@ export const tagName = function tagName(props, state) {
|
|
|
10
10
|
// https://github.com/sveltejs/vite-plugin-svelte/issues/315#issuecomment-1109000027
|
|
11
11
|
return "sty" + "le";
|
|
12
12
|
};
|
|
13
|
-
export const RenderInlinedStyles =
|
|
13
|
+
export const RenderInlinedStyles = (props) => {
|
|
14
14
|
const state = {};
|
|
15
|
+
state.tagName = tagName(props, state);
|
|
15
16
|
return (
|
|
16
17
|
<>
|
|
17
18
|
{TARGET === "svelte" ? (
|
|
@@ -21,5 +22,5 @@ export const RenderInlinedStyles = component$((props) => {
|
|
|
21
22
|
)}
|
|
22
23
|
</>
|
|
23
24
|
);
|
|
24
|
-
}
|
|
25
|
+
};
|
|
25
26
|
export default RenderInlinedStyles;
|
|
@@ -39,13 +39,17 @@ const evaluateBindings = ({
|
|
|
39
39
|
}
|
|
40
40
|
return copied;
|
|
41
41
|
};
|
|
42
|
-
function getProcessedBlock(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
function getProcessedBlock({
|
|
43
|
+
block,
|
|
44
|
+
context,
|
|
45
|
+
shouldEvaluateBindings,
|
|
46
|
+
state
|
|
47
|
+
}) {
|
|
48
|
+
const transformedBlock = transformBlock(block);
|
|
49
|
+
if (shouldEvaluateBindings) {
|
|
50
|
+
return evaluateBindings({ block: transformedBlock, state, context });
|
|
47
51
|
} else {
|
|
48
|
-
return
|
|
52
|
+
return transformedBlock;
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
export {
|
|
@@ -21,7 +21,7 @@ test("Can process bindings", () => {
|
|
|
21
21
|
block,
|
|
22
22
|
context: {},
|
|
23
23
|
state: { test: "hello" },
|
|
24
|
-
|
|
24
|
+
shouldEvaluateBindings: true
|
|
25
25
|
});
|
|
26
26
|
expect(processed).not.toEqual(block);
|
|
27
27
|
expect((_a = processed.properties) == null ? void 0 : _a.foo).toEqual("baz");
|
package/src/functions/track.js
CHANGED
|
@@ -1,7 +1,74 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
1
32
|
import { TARGET } from "../constants/target.js";
|
|
33
|
+
import { getSessionId } from "../helpers/sessionId.js";
|
|
34
|
+
import { getVisitorId } from "../helpers/visitorId.js";
|
|
2
35
|
import { isBrowser } from "./is-browser.js";
|
|
3
36
|
import { isEditing } from "./is-editing.js";
|
|
4
|
-
|
|
37
|
+
const getTrackingEventData = ({ canTrack }) => {
|
|
38
|
+
if (!canTrack) {
|
|
39
|
+
return { visitorId: void 0, sessionId: void 0 };
|
|
40
|
+
}
|
|
41
|
+
const sessionId = getSessionId({ canTrack });
|
|
42
|
+
const visitorId = getVisitorId({ canTrack });
|
|
43
|
+
return {
|
|
44
|
+
sessionId,
|
|
45
|
+
visitorId
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
const createEvent = (_a) => {
|
|
49
|
+
var _b = _a, {
|
|
50
|
+
type: eventType,
|
|
51
|
+
canTrack,
|
|
52
|
+
orgId,
|
|
53
|
+
contentId
|
|
54
|
+
} = _b, properties = __objRest(_b, [
|
|
55
|
+
"type",
|
|
56
|
+
"canTrack",
|
|
57
|
+
"orgId",
|
|
58
|
+
"contentId"
|
|
59
|
+
]);
|
|
60
|
+
return {
|
|
61
|
+
type: eventType,
|
|
62
|
+
data: __spreadProps(__spreadValues(__spreadValues({}, properties), getTrackingEventData({ canTrack })), {
|
|
63
|
+
ownerId: orgId,
|
|
64
|
+
contentId
|
|
65
|
+
})
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
function track(eventProps) {
|
|
69
|
+
if (!eventProps.canTrack) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
5
72
|
if (isEditing()) {
|
|
6
73
|
return;
|
|
7
74
|
}
|
|
@@ -10,7 +77,9 @@ function track(event, properties) {
|
|
|
10
77
|
}
|
|
11
78
|
return fetch(`https://builder.io/api/v1/track`, {
|
|
12
79
|
method: "POST",
|
|
13
|
-
body: JSON.stringify({
|
|
80
|
+
body: JSON.stringify({
|
|
81
|
+
events: [createEvent(eventProps)]
|
|
82
|
+
}),
|
|
14
83
|
headers: {
|
|
15
84
|
"content-type": "application/json"
|
|
16
85
|
},
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { isBrowser } from "../functions/is-browser";
|
|
2
|
+
import { getTopLevelDomain } from "./url";
|
|
3
|
+
const getCookie = ({
|
|
4
|
+
name,
|
|
5
|
+
canTrack
|
|
6
|
+
}) => {
|
|
7
|
+
var _a;
|
|
8
|
+
try {
|
|
9
|
+
if (!canTrack) {
|
|
10
|
+
return void 0;
|
|
11
|
+
}
|
|
12
|
+
return (_a = document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))) == null ? void 0 : _a.split("=")[1];
|
|
13
|
+
} catch (err) {
|
|
14
|
+
console.debug("[COOKIE] GET error: ", err);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const stringifyCookie = (cookie) => cookie.map(([key, value]) => value ? `${key}=${value}` : key).join("; ");
|
|
18
|
+
const SECURE_CONFIG = [
|
|
19
|
+
["secure", ""],
|
|
20
|
+
["SameSite", "None"]
|
|
21
|
+
];
|
|
22
|
+
const createCookieString = ({
|
|
23
|
+
name,
|
|
24
|
+
value,
|
|
25
|
+
expires
|
|
26
|
+
}) => {
|
|
27
|
+
const secure = isBrowser() ? location.protocol === "https:" : true;
|
|
28
|
+
const secureObj = secure ? SECURE_CONFIG : [[]];
|
|
29
|
+
const expiresObj = expires ? [["expires", expires.toUTCString()]] : [[]];
|
|
30
|
+
const cookieValue = [
|
|
31
|
+
[name, value],
|
|
32
|
+
...expiresObj,
|
|
33
|
+
["path", "/"],
|
|
34
|
+
["domain", getTopLevelDomain(window.location.hostname)],
|
|
35
|
+
...secureObj
|
|
36
|
+
];
|
|
37
|
+
const cookie = stringifyCookie(cookieValue);
|
|
38
|
+
return cookie;
|
|
39
|
+
};
|
|
40
|
+
const setCookie = ({
|
|
41
|
+
name,
|
|
42
|
+
value,
|
|
43
|
+
expires,
|
|
44
|
+
canTrack
|
|
45
|
+
}) => {
|
|
46
|
+
try {
|
|
47
|
+
if (!canTrack) {
|
|
48
|
+
return void 0;
|
|
49
|
+
}
|
|
50
|
+
const cookie = createCookieString({ name, value, expires });
|
|
51
|
+
document.cookie = cookie;
|
|
52
|
+
} catch (err) {
|
|
53
|
+
console.warn("[COOKIE] SET error: ", err);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
getCookie,
|
|
58
|
+
setCookie
|
|
59
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isBrowser } from "../functions/is-browser";
|
|
2
|
+
const getLocalStorage = () => isBrowser() && typeof localStorage !== "undefined" ? localStorage : void 0;
|
|
3
|
+
const getLocalStorageItem = ({
|
|
4
|
+
key,
|
|
5
|
+
canTrack
|
|
6
|
+
}) => {
|
|
7
|
+
var _a;
|
|
8
|
+
try {
|
|
9
|
+
if (canTrack) {
|
|
10
|
+
return (_a = getLocalStorage()) == null ? void 0 : _a.getItem(key);
|
|
11
|
+
}
|
|
12
|
+
return void 0;
|
|
13
|
+
} catch (err) {
|
|
14
|
+
console.debug("[LocalStorage] GET error: ", err);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const setLocalStorageItem = ({
|
|
18
|
+
key,
|
|
19
|
+
canTrack,
|
|
20
|
+
value
|
|
21
|
+
}) => {
|
|
22
|
+
var _a;
|
|
23
|
+
try {
|
|
24
|
+
if (canTrack) {
|
|
25
|
+
(_a = getLocalStorage()) == null ? void 0 : _a.setItem(key, value);
|
|
26
|
+
}
|
|
27
|
+
} catch (err) {
|
|
28
|
+
console.debug("[LocalStorage] SET error: ", err);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
getLocalStorageItem,
|
|
33
|
+
setLocalStorageItem
|
|
34
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getCookie, setCookie } from "./cookie";
|
|
2
|
+
import { checkIsDefined } from "./nullable";
|
|
3
|
+
import { uuid } from "./uuid";
|
|
4
|
+
const SESSION_LOCAL_STORAGE_KEY = "builderSessionId";
|
|
5
|
+
const getSessionId = ({ canTrack }) => {
|
|
6
|
+
if (!canTrack) {
|
|
7
|
+
return void 0;
|
|
8
|
+
}
|
|
9
|
+
const sessionId = getCookie({ name: SESSION_LOCAL_STORAGE_KEY, canTrack });
|
|
10
|
+
if (checkIsDefined(sessionId)) {
|
|
11
|
+
return sessionId;
|
|
12
|
+
} else {
|
|
13
|
+
const newSessionId = createSessionId();
|
|
14
|
+
setSessionId({ id: newSessionId, canTrack });
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const createSessionId = () => uuid();
|
|
18
|
+
const setSessionId = ({
|
|
19
|
+
id,
|
|
20
|
+
canTrack
|
|
21
|
+
}) => setCookie({ name: SESSION_LOCAL_STORAGE_KEY, value: id, canTrack });
|
|
22
|
+
export {
|
|
23
|
+
createSessionId,
|
|
24
|
+
getSessionId,
|
|
25
|
+
setSessionId
|
|
26
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getTopLevelDomain } from "./url.js";
|
|
2
|
+
describe("getTopLevelDomain", () => {
|
|
3
|
+
test("handles root domain", () => {
|
|
4
|
+
const output = getTopLevelDomain("example.com");
|
|
5
|
+
expect(output).toBe("example.com");
|
|
6
|
+
});
|
|
7
|
+
test("handles subdomain", () => {
|
|
8
|
+
const output = getTopLevelDomain("wwww.example.com");
|
|
9
|
+
expect(output).toBe("example.com");
|
|
10
|
+
});
|
|
11
|
+
test("handles subdomain with long suffix", () => {
|
|
12
|
+
const output = getTopLevelDomain("www.example.co.uk");
|
|
13
|
+
expect(output).toBe("example.co.uk");
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function uuidv4() {
|
|
2
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
3
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
|
4
|
+
return v.toString(16);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
function uuid() {
|
|
8
|
+
return uuidv4().replace(/-/g, "");
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
uuid,
|
|
12
|
+
uuidv4
|
|
13
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getLocalStorageItem, setLocalStorageItem } from "./localStorage";
|
|
2
|
+
import { checkIsDefined } from "./nullable";
|
|
3
|
+
import { uuid } from "./uuid";
|
|
4
|
+
const VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
|
|
5
|
+
const getVisitorId = ({ canTrack }) => {
|
|
6
|
+
if (!canTrack) {
|
|
7
|
+
return void 0;
|
|
8
|
+
}
|
|
9
|
+
const visitorId = getLocalStorageItem({
|
|
10
|
+
key: VISITOR_LOCAL_STORAGE_KEY,
|
|
11
|
+
canTrack
|
|
12
|
+
});
|
|
13
|
+
if (checkIsDefined(visitorId)) {
|
|
14
|
+
return visitorId;
|
|
15
|
+
} else {
|
|
16
|
+
const newVisitorId = createVisitorId();
|
|
17
|
+
setVisitorId({ id: newVisitorId, canTrack });
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const createVisitorId = () => uuid();
|
|
21
|
+
const setVisitorId = ({
|
|
22
|
+
id,
|
|
23
|
+
canTrack
|
|
24
|
+
}) => setLocalStorageItem({
|
|
25
|
+
key: VISITOR_LOCAL_STORAGE_KEY,
|
|
26
|
+
value: id,
|
|
27
|
+
canTrack
|
|
28
|
+
});
|
|
29
|
+
export {
|
|
30
|
+
createVisitorId,
|
|
31
|
+
getVisitorId,
|
|
32
|
+
setVisitorId
|
|
33
|
+
};
|
|
File without changes
|