@builder.io/sdk-qwik 0.14.3 → 0.14.4
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/lib/browser/index.qwik.cjs +22 -14
- package/lib/browser/index.qwik.mjs +22 -14
- package/lib/edge/index.qwik.cjs +22 -14
- package/lib/edge/index.qwik.mjs +22 -14
- package/lib/node/index.qwik.cjs +22 -14
- package/lib/node/index.qwik.mjs +22 -14
- package/package.json +1 -1
- package/types/src/constants/sdk-version.d.ts +1 -1
- package/types/src/functions/get-builder-search-params/index.d.ts +1 -4
- package/types/src/functions/is-editing.d.ts +2 -1
- package/types/src/functions/is-previewing.d.ts +2 -1
- package/types/src/helpers/search/search.d.ts +5 -0
- package/types/src/index.d.ts +5 -2
|
@@ -105,11 +105,26 @@ const logger = {
|
|
|
105
105
|
function isBrowser() {
|
|
106
106
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
107
107
|
}
|
|
108
|
+
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
109
|
+
const options = {};
|
|
110
|
+
searchParams.forEach((value, key) => {
|
|
111
|
+
options[key] = value;
|
|
112
|
+
});
|
|
113
|
+
return options;
|
|
114
|
+
};
|
|
115
|
+
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
116
|
+
const getSearchString = (search) => {
|
|
117
|
+
if (typeof search === "string")
|
|
118
|
+
return search;
|
|
119
|
+
else if (search instanceof URLSearchParams)
|
|
120
|
+
return search.toString();
|
|
121
|
+
return new URLSearchParams(search).toString();
|
|
122
|
+
};
|
|
108
123
|
function isIframe() {
|
|
109
124
|
return isBrowser() && window.self !== window.top;
|
|
110
125
|
}
|
|
111
|
-
function isEditing() {
|
|
112
|
-
return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
126
|
+
function isEditing(search) {
|
|
127
|
+
return isIframe() && getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
|
|
113
128
|
}
|
|
114
129
|
const getLocation = () => {
|
|
115
130
|
if (isBrowser()) {
|
|
@@ -4004,13 +4019,6 @@ function flatten(object, path = null, separator = ".") {
|
|
|
4004
4019
|
const DEFAULT_API_VERSION = "v3";
|
|
4005
4020
|
const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
|
|
4006
4021
|
const BUILDER_OPTIONS_PREFIX = "options.";
|
|
4007
|
-
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
4008
|
-
const options = {};
|
|
4009
|
-
searchParams.forEach((value, key) => {
|
|
4010
|
-
options[key] = value;
|
|
4011
|
-
});
|
|
4012
|
-
return options;
|
|
4013
|
-
};
|
|
4014
4022
|
const getBuilderSearchParams = (_options) => {
|
|
4015
4023
|
if (!_options)
|
|
4016
4024
|
return {};
|
|
@@ -4030,7 +4038,6 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
4030
4038
|
const searchParams = new URLSearchParams(window.location.search);
|
|
4031
4039
|
return getBuilderSearchParams(searchParams);
|
|
4032
4040
|
};
|
|
4033
|
-
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
4034
4041
|
const isPositiveNumber = (thing) => typeof thing === "number" && !isNaN(thing) && thing >= 0;
|
|
4035
4042
|
const generateContentUrl = (options) => {
|
|
4036
4043
|
const { limit = 30, userAttributes, query, model, apiKey, enrich, locale, apiVersion = DEFAULT_API_VERSION, fields, omit, offset, cacheSeconds, staleCacheSeconds, sort, includeUnpublished } = options;
|
|
@@ -4140,12 +4147,13 @@ async function fetchEntries(options) {
|
|
|
4140
4147
|
return null;
|
|
4141
4148
|
}
|
|
4142
4149
|
}
|
|
4143
|
-
function isPreviewing() {
|
|
4150
|
+
function isPreviewing(search) {
|
|
4144
4151
|
if (!isBrowser())
|
|
4145
4152
|
return false;
|
|
4146
|
-
|
|
4153
|
+
const normalizedSearch = getSearchString(search || window.location.search);
|
|
4154
|
+
if (isEditing(normalizedSearch))
|
|
4147
4155
|
return false;
|
|
4148
|
-
return Boolean(
|
|
4156
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
4149
4157
|
}
|
|
4150
4158
|
function uuidv4() {
|
|
4151
4159
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -4350,7 +4358,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4350
4358
|
const url = new URL(e.origin), hostname = url.hostname;
|
|
4351
4359
|
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
4352
4360
|
}
|
|
4353
|
-
const SDK_VERSION = "0.14.
|
|
4361
|
+
const SDK_VERSION = "0.14.4";
|
|
4354
4362
|
const registry = {};
|
|
4355
4363
|
function register(type, info) {
|
|
4356
4364
|
let typeList = registry[type];
|
|
@@ -103,11 +103,26 @@ const logger = {
|
|
|
103
103
|
function isBrowser() {
|
|
104
104
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
105
105
|
}
|
|
106
|
+
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
107
|
+
const options = {};
|
|
108
|
+
searchParams.forEach((value, key) => {
|
|
109
|
+
options[key] = value;
|
|
110
|
+
});
|
|
111
|
+
return options;
|
|
112
|
+
};
|
|
113
|
+
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
114
|
+
const getSearchString = (search) => {
|
|
115
|
+
if (typeof search === "string")
|
|
116
|
+
return search;
|
|
117
|
+
else if (search instanceof URLSearchParams)
|
|
118
|
+
return search.toString();
|
|
119
|
+
return new URLSearchParams(search).toString();
|
|
120
|
+
};
|
|
106
121
|
function isIframe() {
|
|
107
122
|
return isBrowser() && window.self !== window.top;
|
|
108
123
|
}
|
|
109
|
-
function isEditing() {
|
|
110
|
-
return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
124
|
+
function isEditing(search) {
|
|
125
|
+
return isIframe() && getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
|
|
111
126
|
}
|
|
112
127
|
const getLocation = () => {
|
|
113
128
|
if (isBrowser()) {
|
|
@@ -4002,13 +4017,6 @@ function flatten(object, path = null, separator = ".") {
|
|
|
4002
4017
|
const DEFAULT_API_VERSION = "v3";
|
|
4003
4018
|
const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
|
|
4004
4019
|
const BUILDER_OPTIONS_PREFIX = "options.";
|
|
4005
|
-
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
4006
|
-
const options = {};
|
|
4007
|
-
searchParams.forEach((value, key) => {
|
|
4008
|
-
options[key] = value;
|
|
4009
|
-
});
|
|
4010
|
-
return options;
|
|
4011
|
-
};
|
|
4012
4020
|
const getBuilderSearchParams = (_options) => {
|
|
4013
4021
|
if (!_options)
|
|
4014
4022
|
return {};
|
|
@@ -4028,7 +4036,6 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
4028
4036
|
const searchParams = new URLSearchParams(window.location.search);
|
|
4029
4037
|
return getBuilderSearchParams(searchParams);
|
|
4030
4038
|
};
|
|
4031
|
-
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
4032
4039
|
const isPositiveNumber = (thing) => typeof thing === "number" && !isNaN(thing) && thing >= 0;
|
|
4033
4040
|
const generateContentUrl = (options) => {
|
|
4034
4041
|
const { limit = 30, userAttributes, query, model, apiKey, enrich, locale, apiVersion = DEFAULT_API_VERSION, fields, omit, offset, cacheSeconds, staleCacheSeconds, sort, includeUnpublished } = options;
|
|
@@ -4138,12 +4145,13 @@ async function fetchEntries(options) {
|
|
|
4138
4145
|
return null;
|
|
4139
4146
|
}
|
|
4140
4147
|
}
|
|
4141
|
-
function isPreviewing() {
|
|
4148
|
+
function isPreviewing(search) {
|
|
4142
4149
|
if (!isBrowser())
|
|
4143
4150
|
return false;
|
|
4144
|
-
|
|
4151
|
+
const normalizedSearch = getSearchString(search || window.location.search);
|
|
4152
|
+
if (isEditing(normalizedSearch))
|
|
4145
4153
|
return false;
|
|
4146
|
-
return Boolean(
|
|
4154
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
4147
4155
|
}
|
|
4148
4156
|
function uuidv4() {
|
|
4149
4157
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -4348,7 +4356,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4348
4356
|
const url = new URL(e.origin), hostname = url.hostname;
|
|
4349
4357
|
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
4350
4358
|
}
|
|
4351
|
-
const SDK_VERSION = "0.14.
|
|
4359
|
+
const SDK_VERSION = "0.14.4";
|
|
4352
4360
|
const registry = {};
|
|
4353
4361
|
function register(type, info) {
|
|
4354
4362
|
let typeList = registry[type];
|
package/lib/edge/index.qwik.cjs
CHANGED
|
@@ -105,11 +105,26 @@ const logger = {
|
|
|
105
105
|
function isBrowser() {
|
|
106
106
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
107
107
|
}
|
|
108
|
+
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
109
|
+
const options = {};
|
|
110
|
+
searchParams.forEach((value, key) => {
|
|
111
|
+
options[key] = value;
|
|
112
|
+
});
|
|
113
|
+
return options;
|
|
114
|
+
};
|
|
115
|
+
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
116
|
+
const getSearchString = (search) => {
|
|
117
|
+
if (typeof search === "string")
|
|
118
|
+
return search;
|
|
119
|
+
else if (search instanceof URLSearchParams)
|
|
120
|
+
return search.toString();
|
|
121
|
+
return new URLSearchParams(search).toString();
|
|
122
|
+
};
|
|
108
123
|
function isIframe() {
|
|
109
124
|
return isBrowser() && window.self !== window.top;
|
|
110
125
|
}
|
|
111
|
-
function isEditing() {
|
|
112
|
-
return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
126
|
+
function isEditing(search) {
|
|
127
|
+
return isIframe() && getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
|
|
113
128
|
}
|
|
114
129
|
const getLocation = () => {
|
|
115
130
|
if (isBrowser()) {
|
|
@@ -7235,13 +7250,6 @@ function flatten(object, path = null, separator = ".") {
|
|
|
7235
7250
|
const DEFAULT_API_VERSION = "v3";
|
|
7236
7251
|
const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
|
|
7237
7252
|
const BUILDER_OPTIONS_PREFIX = "options.";
|
|
7238
|
-
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
7239
|
-
const options = {};
|
|
7240
|
-
searchParams.forEach((value, key) => {
|
|
7241
|
-
options[key] = value;
|
|
7242
|
-
});
|
|
7243
|
-
return options;
|
|
7244
|
-
};
|
|
7245
7253
|
const getBuilderSearchParams = (_options) => {
|
|
7246
7254
|
if (!_options)
|
|
7247
7255
|
return {};
|
|
@@ -7261,7 +7269,6 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
7261
7269
|
const searchParams = new URLSearchParams(window.location.search);
|
|
7262
7270
|
return getBuilderSearchParams(searchParams);
|
|
7263
7271
|
};
|
|
7264
|
-
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
7265
7272
|
const isPositiveNumber = (thing) => typeof thing === "number" && !isNaN(thing) && thing >= 0;
|
|
7266
7273
|
const generateContentUrl = (options) => {
|
|
7267
7274
|
const { limit = 30, userAttributes, query, model, apiKey, enrich, locale, apiVersion = DEFAULT_API_VERSION, fields, omit, offset, cacheSeconds, staleCacheSeconds, sort, includeUnpublished } = options;
|
|
@@ -7371,12 +7378,13 @@ async function fetchEntries(options) {
|
|
|
7371
7378
|
return null;
|
|
7372
7379
|
}
|
|
7373
7380
|
}
|
|
7374
|
-
function isPreviewing() {
|
|
7381
|
+
function isPreviewing(search) {
|
|
7375
7382
|
if (!isBrowser())
|
|
7376
7383
|
return false;
|
|
7377
|
-
|
|
7384
|
+
const normalizedSearch = getSearchString(search || window.location.search);
|
|
7385
|
+
if (isEditing(normalizedSearch))
|
|
7378
7386
|
return false;
|
|
7379
|
-
return Boolean(
|
|
7387
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
7380
7388
|
}
|
|
7381
7389
|
function uuidv4() {
|
|
7382
7390
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -7581,7 +7589,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
7581
7589
|
const url = new URL(e.origin), hostname = url.hostname;
|
|
7582
7590
|
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
7583
7591
|
}
|
|
7584
|
-
const SDK_VERSION = "0.14.
|
|
7592
|
+
const SDK_VERSION = "0.14.4";
|
|
7585
7593
|
const registry = {};
|
|
7586
7594
|
function register(type, info) {
|
|
7587
7595
|
let typeList = registry[type];
|
package/lib/edge/index.qwik.mjs
CHANGED
|
@@ -103,11 +103,26 @@ const logger = {
|
|
|
103
103
|
function isBrowser() {
|
|
104
104
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
105
105
|
}
|
|
106
|
+
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
107
|
+
const options = {};
|
|
108
|
+
searchParams.forEach((value, key) => {
|
|
109
|
+
options[key] = value;
|
|
110
|
+
});
|
|
111
|
+
return options;
|
|
112
|
+
};
|
|
113
|
+
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
114
|
+
const getSearchString = (search) => {
|
|
115
|
+
if (typeof search === "string")
|
|
116
|
+
return search;
|
|
117
|
+
else if (search instanceof URLSearchParams)
|
|
118
|
+
return search.toString();
|
|
119
|
+
return new URLSearchParams(search).toString();
|
|
120
|
+
};
|
|
106
121
|
function isIframe() {
|
|
107
122
|
return isBrowser() && window.self !== window.top;
|
|
108
123
|
}
|
|
109
|
-
function isEditing() {
|
|
110
|
-
return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
124
|
+
function isEditing(search) {
|
|
125
|
+
return isIframe() && getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
|
|
111
126
|
}
|
|
112
127
|
const getLocation = () => {
|
|
113
128
|
if (isBrowser()) {
|
|
@@ -7233,13 +7248,6 @@ function flatten(object, path = null, separator = ".") {
|
|
|
7233
7248
|
const DEFAULT_API_VERSION = "v3";
|
|
7234
7249
|
const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
|
|
7235
7250
|
const BUILDER_OPTIONS_PREFIX = "options.";
|
|
7236
|
-
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
7237
|
-
const options = {};
|
|
7238
|
-
searchParams.forEach((value, key) => {
|
|
7239
|
-
options[key] = value;
|
|
7240
|
-
});
|
|
7241
|
-
return options;
|
|
7242
|
-
};
|
|
7243
7251
|
const getBuilderSearchParams = (_options) => {
|
|
7244
7252
|
if (!_options)
|
|
7245
7253
|
return {};
|
|
@@ -7259,7 +7267,6 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
7259
7267
|
const searchParams = new URLSearchParams(window.location.search);
|
|
7260
7268
|
return getBuilderSearchParams(searchParams);
|
|
7261
7269
|
};
|
|
7262
|
-
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
7263
7270
|
const isPositiveNumber = (thing) => typeof thing === "number" && !isNaN(thing) && thing >= 0;
|
|
7264
7271
|
const generateContentUrl = (options) => {
|
|
7265
7272
|
const { limit = 30, userAttributes, query, model, apiKey, enrich, locale, apiVersion = DEFAULT_API_VERSION, fields, omit, offset, cacheSeconds, staleCacheSeconds, sort, includeUnpublished } = options;
|
|
@@ -7369,12 +7376,13 @@ async function fetchEntries(options) {
|
|
|
7369
7376
|
return null;
|
|
7370
7377
|
}
|
|
7371
7378
|
}
|
|
7372
|
-
function isPreviewing() {
|
|
7379
|
+
function isPreviewing(search) {
|
|
7373
7380
|
if (!isBrowser())
|
|
7374
7381
|
return false;
|
|
7375
|
-
|
|
7382
|
+
const normalizedSearch = getSearchString(search || window.location.search);
|
|
7383
|
+
if (isEditing(normalizedSearch))
|
|
7376
7384
|
return false;
|
|
7377
|
-
return Boolean(
|
|
7385
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
7378
7386
|
}
|
|
7379
7387
|
function uuidv4() {
|
|
7380
7388
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -7579,7 +7587,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
7579
7587
|
const url = new URL(e.origin), hostname = url.hostname;
|
|
7580
7588
|
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
7581
7589
|
}
|
|
7582
|
-
const SDK_VERSION = "0.14.
|
|
7590
|
+
const SDK_VERSION = "0.14.4";
|
|
7583
7591
|
const registry = {};
|
|
7584
7592
|
function register(type, info) {
|
|
7585
7593
|
let typeList = registry[type];
|
package/lib/node/index.qwik.cjs
CHANGED
|
@@ -107,11 +107,26 @@ const logger = {
|
|
|
107
107
|
function isBrowser() {
|
|
108
108
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
109
109
|
}
|
|
110
|
+
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
111
|
+
const options = {};
|
|
112
|
+
searchParams.forEach((value, key) => {
|
|
113
|
+
options[key] = value;
|
|
114
|
+
});
|
|
115
|
+
return options;
|
|
116
|
+
};
|
|
117
|
+
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
118
|
+
const getSearchString = (search) => {
|
|
119
|
+
if (typeof search === "string")
|
|
120
|
+
return search;
|
|
121
|
+
else if (search instanceof URLSearchParams)
|
|
122
|
+
return search.toString();
|
|
123
|
+
return new URLSearchParams(search).toString();
|
|
124
|
+
};
|
|
110
125
|
function isIframe() {
|
|
111
126
|
return isBrowser() && window.self !== window.top;
|
|
112
127
|
}
|
|
113
|
-
function isEditing() {
|
|
114
|
-
return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
128
|
+
function isEditing(search) {
|
|
129
|
+
return isIframe() && getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
|
|
115
130
|
}
|
|
116
131
|
const getLocation = () => {
|
|
117
132
|
if (isBrowser()) {
|
|
@@ -4106,13 +4121,6 @@ function flatten(object, path = null, separator = ".") {
|
|
|
4106
4121
|
const DEFAULT_API_VERSION = "v3";
|
|
4107
4122
|
const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
|
|
4108
4123
|
const BUILDER_OPTIONS_PREFIX = "options.";
|
|
4109
|
-
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
4110
|
-
const options = {};
|
|
4111
|
-
searchParams.forEach((value, key) => {
|
|
4112
|
-
options[key] = value;
|
|
4113
|
-
});
|
|
4114
|
-
return options;
|
|
4115
|
-
};
|
|
4116
4124
|
const getBuilderSearchParams = (_options) => {
|
|
4117
4125
|
if (!_options)
|
|
4118
4126
|
return {};
|
|
@@ -4132,7 +4140,6 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
4132
4140
|
const searchParams = new URLSearchParams(window.location.search);
|
|
4133
4141
|
return getBuilderSearchParams(searchParams);
|
|
4134
4142
|
};
|
|
4135
|
-
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
4136
4143
|
const isPositiveNumber = (thing) => typeof thing === "number" && !isNaN(thing) && thing >= 0;
|
|
4137
4144
|
const generateContentUrl = (options) => {
|
|
4138
4145
|
const { limit = 30, userAttributes, query, model, apiKey, enrich, locale, apiVersion = DEFAULT_API_VERSION, fields, omit, offset, cacheSeconds, staleCacheSeconds, sort, includeUnpublished } = options;
|
|
@@ -4242,12 +4249,13 @@ async function fetchEntries(options) {
|
|
|
4242
4249
|
return null;
|
|
4243
4250
|
}
|
|
4244
4251
|
}
|
|
4245
|
-
function isPreviewing() {
|
|
4252
|
+
function isPreviewing(search) {
|
|
4246
4253
|
if (!isBrowser())
|
|
4247
4254
|
return false;
|
|
4248
|
-
|
|
4255
|
+
const normalizedSearch = getSearchString(search || window.location.search);
|
|
4256
|
+
if (isEditing(normalizedSearch))
|
|
4249
4257
|
return false;
|
|
4250
|
-
return Boolean(
|
|
4258
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
4251
4259
|
}
|
|
4252
4260
|
function uuidv4() {
|
|
4253
4261
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -4452,7 +4460,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4452
4460
|
const url = new URL(e.origin), hostname = url.hostname;
|
|
4453
4461
|
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
4454
4462
|
}
|
|
4455
|
-
const SDK_VERSION = "0.14.
|
|
4463
|
+
const SDK_VERSION = "0.14.4";
|
|
4456
4464
|
const registry = {};
|
|
4457
4465
|
function register(type, info) {
|
|
4458
4466
|
let typeList = registry[type];
|
package/lib/node/index.qwik.mjs
CHANGED
|
@@ -105,11 +105,26 @@ const logger = {
|
|
|
105
105
|
function isBrowser() {
|
|
106
106
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
107
107
|
}
|
|
108
|
+
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
109
|
+
const options = {};
|
|
110
|
+
searchParams.forEach((value, key) => {
|
|
111
|
+
options[key] = value;
|
|
112
|
+
});
|
|
113
|
+
return options;
|
|
114
|
+
};
|
|
115
|
+
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
116
|
+
const getSearchString = (search) => {
|
|
117
|
+
if (typeof search === "string")
|
|
118
|
+
return search;
|
|
119
|
+
else if (search instanceof URLSearchParams)
|
|
120
|
+
return search.toString();
|
|
121
|
+
return new URLSearchParams(search).toString();
|
|
122
|
+
};
|
|
108
123
|
function isIframe() {
|
|
109
124
|
return isBrowser() && window.self !== window.top;
|
|
110
125
|
}
|
|
111
|
-
function isEditing() {
|
|
112
|
-
return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
126
|
+
function isEditing(search) {
|
|
127
|
+
return isIframe() && getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
|
|
113
128
|
}
|
|
114
129
|
const getLocation = () => {
|
|
115
130
|
if (isBrowser()) {
|
|
@@ -4104,13 +4119,6 @@ function flatten(object, path = null, separator = ".") {
|
|
|
4104
4119
|
const DEFAULT_API_VERSION = "v3";
|
|
4105
4120
|
const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
|
|
4106
4121
|
const BUILDER_OPTIONS_PREFIX = "options.";
|
|
4107
|
-
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
4108
|
-
const options = {};
|
|
4109
|
-
searchParams.forEach((value, key) => {
|
|
4110
|
-
options[key] = value;
|
|
4111
|
-
});
|
|
4112
|
-
return options;
|
|
4113
|
-
};
|
|
4114
4122
|
const getBuilderSearchParams = (_options) => {
|
|
4115
4123
|
if (!_options)
|
|
4116
4124
|
return {};
|
|
@@ -4130,7 +4138,6 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
4130
4138
|
const searchParams = new URLSearchParams(window.location.search);
|
|
4131
4139
|
return getBuilderSearchParams(searchParams);
|
|
4132
4140
|
};
|
|
4133
|
-
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
4134
4141
|
const isPositiveNumber = (thing) => typeof thing === "number" && !isNaN(thing) && thing >= 0;
|
|
4135
4142
|
const generateContentUrl = (options) => {
|
|
4136
4143
|
const { limit = 30, userAttributes, query, model, apiKey, enrich, locale, apiVersion = DEFAULT_API_VERSION, fields, omit, offset, cacheSeconds, staleCacheSeconds, sort, includeUnpublished } = options;
|
|
@@ -4240,12 +4247,13 @@ async function fetchEntries(options) {
|
|
|
4240
4247
|
return null;
|
|
4241
4248
|
}
|
|
4242
4249
|
}
|
|
4243
|
-
function isPreviewing() {
|
|
4250
|
+
function isPreviewing(search) {
|
|
4244
4251
|
if (!isBrowser())
|
|
4245
4252
|
return false;
|
|
4246
|
-
|
|
4253
|
+
const normalizedSearch = getSearchString(search || window.location.search);
|
|
4254
|
+
if (isEditing(normalizedSearch))
|
|
4247
4255
|
return false;
|
|
4248
|
-
return Boolean(
|
|
4256
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
4249
4257
|
}
|
|
4250
4258
|
function uuidv4() {
|
|
4251
4259
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -4450,7 +4458,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4450
4458
|
const url = new URL(e.origin), hostname = url.hostname;
|
|
4451
4459
|
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
4452
4460
|
}
|
|
4453
|
-
const SDK_VERSION = "0.14.
|
|
4461
|
+
const SDK_VERSION = "0.14.4";
|
|
4454
4462
|
const registry = {};
|
|
4455
4463
|
function register(type, info) {
|
|
4456
4464
|
let typeList = registry[type];
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.14.
|
|
1
|
+
export declare const SDK_VERSION = "0.14.4";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
type QueryObject
|
|
2
|
-
export declare const convertSearchParamsToQueryObject: (searchParams: URLSearchParams) => QueryObject;
|
|
1
|
+
import type { QueryObject } from '../../helpers/search/search.js';
|
|
3
2
|
/**
|
|
4
3
|
* Receives a `URLSearchParams` object or a regular query object, and returns the subset of query params that are
|
|
5
4
|
* relevant to the Builder SDK.
|
|
@@ -8,5 +7,3 @@ export declare const convertSearchParamsToQueryObject: (searchParams: URLSearchP
|
|
|
8
7
|
*/
|
|
9
8
|
export declare const getBuilderSearchParams: (_options: QueryObject | URLSearchParams | undefined) => QueryObject;
|
|
10
9
|
export declare const getBuilderSearchParamsFromWindow: () => QueryObject;
|
|
11
|
-
export declare const normalizeSearchParams: (searchParams: QueryObject | URLSearchParams) => QueryObject;
|
|
12
|
-
export {};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type Search } from '../helpers/search/search.js';
|
|
2
|
+
export declare function isEditing(search?: Search): boolean;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Search } from '../helpers/search/search.js';
|
|
2
|
+
export declare function isPreviewing(search?: Search): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type QueryObject = Record<string, string | string[]>;
|
|
2
|
+
export declare const convertSearchParamsToQueryObject: (searchParams: URLSearchParams) => QueryObject;
|
|
3
|
+
export declare const normalizeSearchParams: (searchParams: QueryObject | URLSearchParams) => QueryObject;
|
|
4
|
+
export type Search = URLSearchParams | string | QueryObject;
|
|
5
|
+
export declare const getSearchString: (search: Search) => string;
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * from './index-helpers/top-of-file.js';
|
|
2
|
+
/**
|
|
3
|
+
* In the React SDK, this file is marked with `use client`.
|
|
4
|
+
*/
|
|
2
5
|
export * from './index-helpers/blocks-exports.js';
|
|
3
6
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
7
|
+
* In the React SDK, this file is not marked with `use client`, to allow
|
|
8
|
+
* NextJS App Directory to use the SDK helper functions without issues.
|
|
6
9
|
*/
|
|
7
10
|
export * from './server-index.js';
|