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