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
|
@@ -421,22 +421,15 @@ function t(key, defaultValue) {
|
|
|
421
421
|
return defaultValue || key;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
// ──
|
|
425
|
-
// Window-level
|
|
424
|
+
// ── Backend API base URL (used by background-panel.js's Unsplash proxy calls) ─
|
|
425
|
+
// Window-level singleton, 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
|
-
|
|
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] || '';
|
|
430
|
+
var API_BASE_URL_KEY = '__labellife_api_base_url__';
|
|
431
|
+
function getApiBaseUrl() {
|
|
432
|
+
return typeof window !== 'undefined' && window[API_BASE_URL_KEY] || '';
|
|
440
433
|
}
|
|
441
434
|
|
|
442
435
|
// ── Input Fields Dialog Config ───────────────────────────────────────
|
|
@@ -1029,18 +1022,17 @@ var TextSection = {
|
|
|
1029
1022
|
// labellife backend (see labellifeBackendRepo's UnsplashBackgroundSearchView /
|
|
1030
1023
|
// UnsplashTrackDownloadView). Deliberately has no internal imports so it can be unit-tested
|
|
1031
1024
|
// 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.
|
|
1035
1025
|
|
|
1036
1026
|
var UNSPLASH_UTM_SOURCE = 'labellife';
|
|
1037
|
-
function buildUnsplashSearchUrl(
|
|
1027
|
+
function buildUnsplashSearchUrl(apiBaseUrl, query) {
|
|
1038
1028
|
var page = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1039
1029
|
var perPage = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 20;
|
|
1040
1030
|
var trimmed = query && String(query).trim();
|
|
1041
1031
|
var q = trimmed || 'gradient';
|
|
1042
|
-
|
|
1043
|
-
|
|
1032
|
+
return "".concat(apiBaseUrl, "/api/polotno/unsplash/search/?query=").concat(encodeURIComponent(q), "&per_page=").concat(perPage, "&page=").concat(page);
|
|
1033
|
+
}
|
|
1034
|
+
function buildUnsplashTrackDownloadUrl(apiBaseUrl) {
|
|
1035
|
+
return "".concat(apiBaseUrl, "/api/polotno/unsplash/track-download/");
|
|
1044
1036
|
}
|
|
1045
1037
|
|
|
1046
1038
|
// Unsplash API Guidelines require attribution links back to unsplash.com and to the
|
|
@@ -1723,7 +1715,7 @@ var BackgroundPanelContent = mobxReactLite.observer(function (_ref5) {
|
|
|
1723
1715
|
_context.p = 2;
|
|
1724
1716
|
q = query || 'gradient';
|
|
1725
1717
|
_context.n = 3;
|
|
1726
|
-
return fetch(buildUnsplashSearchUrl(
|
|
1718
|
+
return fetch(buildUnsplashSearchUrl(getApiBaseUrl(), q, pg, 20));
|
|
1727
1719
|
case 3:
|
|
1728
1720
|
res = _context.v;
|
|
1729
1721
|
_context.n = 4;
|
|
@@ -1985,7 +1977,7 @@ var BackgroundPanelContent = mobxReactLite.observer(function (_ref5) {
|
|
|
1985
1977
|
// Unsplash API Guidelines require registering a "download" whenever a photo is used.
|
|
1986
1978
|
// Best-effort: don't block or fail background-setting if this ping fails.
|
|
1987
1979
|
if ((_photo$links = photo.links) !== null && _photo$links !== void 0 && _photo$links.download_location) {
|
|
1988
|
-
fetch(
|
|
1980
|
+
fetch(buildUnsplashTrackDownloadUrl(getApiBaseUrl()), {
|
|
1989
1981
|
method: 'POST',
|
|
1990
1982
|
headers: {
|
|
1991
1983
|
'Content-Type': 'application/json'
|