labellife-design-tool 2.5.4 → 2.5.5
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 +59 -29
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/config.js +9 -23
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/index.js +71 -49
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/side-panel/index.js +12 -20
- package/dist/cjs/side-panel/index.js.map +1 -1
- package/dist/cjs/side-panel/side-panel.js +12 -20
- 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 +59 -29
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/config.js +8 -20
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/index.js +71 -49
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/side-panel/index.js +12 -20
- package/dist/esm/side-panel/index.js.map +1 -1
- package/dist/esm/side-panel/side-panel.js +12 -20
- 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,22 +426,15 @@ function t(key, defaultValue) {
|
|
|
426
426
|
return defaultValue || key;
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
// ──
|
|
430
|
-
// Window-level
|
|
429
|
+
// ── Backend API base URL (used by background-panel.js's Unsplash proxy calls) ─
|
|
430
|
+
// Window-level singleton, 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
|
-
|
|
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] || '';
|
|
435
|
+
var API_BASE_URL_KEY = '__labellife_api_base_url__';
|
|
436
|
+
function getApiBaseUrl() {
|
|
437
|
+
return typeof window !== 'undefined' && window[API_BASE_URL_KEY] || '';
|
|
445
438
|
}
|
|
446
439
|
|
|
447
440
|
// ── Input Fields Dialog Config ───────────────────────────────────────
|
|
@@ -1034,18 +1027,17 @@ var TextSection = {
|
|
|
1034
1027
|
// labellife backend (see labellifeBackendRepo's UnsplashBackgroundSearchView /
|
|
1035
1028
|
// UnsplashTrackDownloadView). Deliberately has no internal imports so it can be unit-tested
|
|
1036
1029
|
// 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.
|
|
1040
1030
|
|
|
1041
1031
|
var UNSPLASH_UTM_SOURCE = 'labellife';
|
|
1042
|
-
function buildUnsplashSearchUrl(
|
|
1032
|
+
function buildUnsplashSearchUrl(apiBaseUrl, query) {
|
|
1043
1033
|
var page = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1044
1034
|
var perPage = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 20;
|
|
1045
1035
|
var trimmed = query && String(query).trim();
|
|
1046
1036
|
var q = trimmed || 'gradient';
|
|
1047
|
-
|
|
1048
|
-
|
|
1037
|
+
return "".concat(apiBaseUrl, "/api/polotno/unsplash/search/?query=").concat(encodeURIComponent(q), "&per_page=").concat(perPage, "&page=").concat(page);
|
|
1038
|
+
}
|
|
1039
|
+
function buildUnsplashTrackDownloadUrl(apiBaseUrl) {
|
|
1040
|
+
return "".concat(apiBaseUrl, "/api/polotno/unsplash/track-download/");
|
|
1049
1041
|
}
|
|
1050
1042
|
|
|
1051
1043
|
// Unsplash API Guidelines require attribution links back to unsplash.com and to the
|
|
@@ -1728,7 +1720,7 @@ var BackgroundPanelContent = mobxReactLite.observer(function (_ref5) {
|
|
|
1728
1720
|
_context.p = 2;
|
|
1729
1721
|
q = query || 'gradient';
|
|
1730
1722
|
_context.n = 3;
|
|
1731
|
-
return fetch(buildUnsplashSearchUrl(
|
|
1723
|
+
return fetch(buildUnsplashSearchUrl(getApiBaseUrl(), q, pg, 20));
|
|
1732
1724
|
case 3:
|
|
1733
1725
|
res = _context.v;
|
|
1734
1726
|
_context.n = 4;
|
|
@@ -1990,7 +1982,7 @@ var BackgroundPanelContent = mobxReactLite.observer(function (_ref5) {
|
|
|
1990
1982
|
// Unsplash API Guidelines require registering a "download" whenever a photo is used.
|
|
1991
1983
|
// Best-effort: don't block or fail background-setting if this ping fails.
|
|
1992
1984
|
if ((_photo$links = photo.links) !== null && _photo$links !== void 0 && _photo$links.download_location) {
|
|
1993
|
-
fetch(
|
|
1985
|
+
fetch(buildUnsplashTrackDownloadUrl(getApiBaseUrl()), {
|
|
1994
1986
|
method: 'POST',
|
|
1995
1987
|
headers: {
|
|
1996
1988
|
'Content-Type': 'application/json'
|