labellife-design-tool 2.5.3 → 2.5.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/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/config.js +23 -9
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/index.js +20 -12
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/side-panel/index.js +20 -12
- package/dist/cjs/side-panel/index.js.map +1 -1
- package/dist/cjs/side-panel/side-panel.js +20 -12
- package/dist/cjs/side-panel/side-panel.js.map +1 -1
- package/dist/cjs/toolbar/toolbar.js.map +1 -1
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/config.js +20 -8
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/index.js +20 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/side-panel/index.js +20 -12
- package/dist/esm/side-panel/index.js.map +1 -1
- package/dist/esm/side-panel/side-panel.js +20 -12
- package/dist/esm/side-panel/side-panel.js.map +1 -1
- package/dist/esm/toolbar/toolbar.js.map +1 -1
- package/package.json +1 -1
|
@@ -426,15 +426,22 @@ function t(key, defaultValue) {
|
|
|
426
426
|
return defaultValue || key;
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
// ──
|
|
430
|
-
// Window-level
|
|
429
|
+
// ── Unsplash backend endpoint URLs (used by background-panel.js's Unsplash proxy calls) ─
|
|
430
|
+
// Window-level singletons, same reasoning as translations/input-fields config above:
|
|
431
431
|
// each Rollup output bundle (index, side-panel, toolbar, canvas...) gets its own copy
|
|
432
432
|
// of this module, so a plain closure variable set from one bundle (e.g. via the host
|
|
433
433
|
// app's top-level `labellife-design-tool/config` import) would never be seen by another
|
|
434
434
|
// bundle (e.g. background-panel.js, built into the side-panel bundle).
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
435
|
+
//
|
|
436
|
+
// The host app owns the full endpoint URL (host + path); this lib only ever appends the
|
|
437
|
+
// query string for the search endpoint and uses the track-download URL as given.
|
|
438
|
+
var UNSPLASH_SEARCH_URL_KEY = '__labellife_unsplash_search_url__';
|
|
439
|
+
var UNSPLASH_TRACK_DOWNLOAD_URL_KEY = '__labellife_unsplash_track_download_url__';
|
|
440
|
+
function getUnsplashSearchUrl() {
|
|
441
|
+
return typeof window !== 'undefined' && window[UNSPLASH_SEARCH_URL_KEY] || '';
|
|
442
|
+
}
|
|
443
|
+
function getUnsplashTrackDownloadUrl() {
|
|
444
|
+
return typeof window !== 'undefined' && window[UNSPLASH_TRACK_DOWNLOAD_URL_KEY] || '';
|
|
438
445
|
}
|
|
439
446
|
|
|
440
447
|
// ── Input Fields Dialog Config ───────────────────────────────────────
|
|
@@ -1027,17 +1034,18 @@ var TextSection = {
|
|
|
1027
1034
|
// labellife backend (see labellifeBackendRepo's UnsplashBackgroundSearchView /
|
|
1028
1035
|
// UnsplashTrackDownloadView). Deliberately has no internal imports so it can be unit-tested
|
|
1029
1036
|
// with plain `node`, following the same convention as ./fonts.js.
|
|
1037
|
+
//
|
|
1038
|
+
// The host app owns the full endpoint URL (via setUnsplashSearchUrl/setUnsplashTrackDownloadUrl
|
|
1039
|
+
// in ../config) — this module only ever appends the search query string onto it.
|
|
1030
1040
|
|
|
1031
1041
|
var UNSPLASH_UTM_SOURCE = 'labellife';
|
|
1032
|
-
function buildUnsplashSearchUrl(
|
|
1042
|
+
function buildUnsplashSearchUrl(searchUrl, query) {
|
|
1033
1043
|
var page = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1034
1044
|
var perPage = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 20;
|
|
1035
1045
|
var trimmed = query && String(query).trim();
|
|
1036
1046
|
var q = trimmed || 'gradient';
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
function buildUnsplashTrackDownloadUrl(apiBaseUrl) {
|
|
1040
|
-
return "".concat(apiBaseUrl, "/api/polotno/unsplash/track-download/");
|
|
1047
|
+
var separator = searchUrl.includes('?') ? '&' : '?';
|
|
1048
|
+
return "".concat(searchUrl).concat(separator, "query=").concat(encodeURIComponent(q), "&per_page=").concat(perPage, "&page=").concat(page);
|
|
1041
1049
|
}
|
|
1042
1050
|
|
|
1043
1051
|
// Unsplash API Guidelines require attribution links back to unsplash.com and to the
|
|
@@ -1720,7 +1728,7 @@ var BackgroundPanelContent = mobxReactLite.observer(function (_ref5) {
|
|
|
1720
1728
|
_context.p = 2;
|
|
1721
1729
|
q = query || 'gradient';
|
|
1722
1730
|
_context.n = 3;
|
|
1723
|
-
return fetch(buildUnsplashSearchUrl(
|
|
1731
|
+
return fetch(buildUnsplashSearchUrl(getUnsplashSearchUrl(), q, pg, 20));
|
|
1724
1732
|
case 3:
|
|
1725
1733
|
res = _context.v;
|
|
1726
1734
|
_context.n = 4;
|
|
@@ -1982,7 +1990,7 @@ var BackgroundPanelContent = mobxReactLite.observer(function (_ref5) {
|
|
|
1982
1990
|
// Unsplash API Guidelines require registering a "download" whenever a photo is used.
|
|
1983
1991
|
// Best-effort: don't block or fail background-setting if this ping fails.
|
|
1984
1992
|
if ((_photo$links = photo.links) !== null && _photo$links !== void 0 && _photo$links.download_location) {
|
|
1985
|
-
fetch(
|
|
1993
|
+
fetch(getUnsplashTrackDownloadUrl(), {
|
|
1986
1994
|
method: 'POST',
|
|
1987
1995
|
headers: {
|
|
1988
1996
|
'Content-Type': 'application/json'
|