You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1355 lines
46 KiB
JavaScript

define(
"DS/IPClassifyUtil/IPClassifyModelEvents",
["DS/CoreEvents/ModelEvents"],
function (e) {
"use strict";
var t = new e();
return {
getModelEvents: function () {
return t;
},
publish: function (e) {
return t.publish(e);
},
subscribe: function (e, n) {
return t.subscribe(e, n);
},
unsubscribe: function (e) {
return t.unsubscribe(e);
},
unsubscribeAll: function (e) {
return t.unsubscribeAll(e);
},
};
}
),
define(
"DS/IPClassifyUtil/bsd_utils/BSDDictionaryAccess",
["DS/PADServices/utils/DictionaryAccess"],
function (e) {
"use strict";
return e;
}
),
define(
"DS/IPClassifyUtil/bsd_utils/BSDConfiguration",
["UWA/Class", "DS/PADUtils/Configuration"],
function (e, t) {
"use strict";
return t;
}
),
define(
"DS/IPClassifyUtil/IPClassifyAlert",
[
"UWA/Class",
"DS/Notifications/NotificationsManagerUXMessages",
"DS/Notifications/NotificationsManagerViewOnScreen",
],
function (e, t, n) {
function i(e, t) {
let n = "";
return (
e && "string" == typeof e
? e.split("<br>").forEach((e, t) => {
0 != t && (n += "<br>"), (n += e.escapeHTML());
})
: t && "object" == typeof e && (n = e),
n
);
}
var r = e.singleton({
_notif_manager: null,
_debounceTimeout: {},
init: function () {},
_displayNotification: function (e) {
null === this._notif_manager &&
((this._notif_manager = t),
n.setNotificationManager(this._notif_manager),
n.setStackingPolicy(5));
var r = "info";
UWA.is(e.className) && "primary" !== e.className && (r = e.className);
let s = i(e.message, e.allowUnsafeHTML),
a = i(e.title, e.allowUnsafeHTML),
o = i(e.subtitle, e.allowUnsafeHTML);
e.messageHtml &&
((s = s ? s + "<br>" : s),
(s = UWA.createElement("div", { html: s })),
e.messageHtml.inject(s)),
this._notif_manager.addNotif({
allowUnsafeHTML: !0,
level: r,
title: a,
subtitle: o,
message: s,
sticky: !!e.sticky && e.sticky,
poNotifId: e.poNotifId,
});
},
displayNotification: function (e) {
var t = this;
if (!0 === e.debounce) {
if (
(e.id && this._debounceTimeout[e.id]
? clearTimeout(this._debounceTimeout[e.id])
: t._displayNotification(e),
e.id)
) {
var n = setTimeout(function () {
delete t._debounceTimeout[e.id];
}, 500);
this._debounceTimeout[e.id] = n;
}
} else t._displayNotification(e);
},
});
return { displayNotification: r.displayNotification.bind(r) };
}
),
define("DS/IPClassifyUtil/ZipUtils", ["DS/ZipJS/zip"], function (e) {
return {
unzip: function (t) {
return new Promise(function (n) {
var i = new e.BlobReader(t);
e.createReader(
i,
function (t) {
var i = t;
i.getEntries(function (t) {
var r = t.find(function (e) {
return e;
});
r &&
r.getData(new e.TextWriter(), function (e) {
try {
i.close(function () {
n(JSON.parse(e.target.result));
});
} catch (e) {
i.close(function () {
n(null);
});
}
});
});
},
function (e) {
console.log("zip error"), console.log(e), n(null);
}
);
});
},
};
}),
define(
"DS/IPClassifyUtil/bsd_utils/BSDContext",
["DS/PADUtils/PADContext"],
function (e) {
"use strict";
return e;
}
),
define(
"DS/IPClassifyUtil/IPClassifyCommunication",
["DS/WidgetServices/WidgetServices"],
function (e) {
"use strict";
var t = function (e, t) {
var n = JSON.stringify(t);
dscef.sendString(e + "=" + n);
},
n = function (e, t) {
"undefined" != typeof dscef &&
dscef.sendString(JSON.stringify({ event: e, content: t }));
};
return {
publish: function (i, r) {
if (e.isNatifEnvironnement())
return e.isWebInWinEnvironment() ? n(i, r) : t(i, r);
},
};
}
),
define(
"DS/IPClassifyUtil/bsd_utils/BSDPUWSAccess",
["DS/PADUtils/PADWSAccess"],
function (e) {
"use strict";
return e;
}
),
define(
"DS/IPClassifyUtil/bsd_utils/BSDPredicateNls",
["DS/PADUtils/PADPredicatesNls"],
function (e) {
"use strict";
return e;
}
),
define(
"DS/IPClassifyUtil/bsd_utils/BSDSession",
["UWA/Class", "DS/PADUtils/PADSession"],
function (e, t) {
"use strict";
return t;
}
),
define(
"DS/IPClassifyUtil/bsd_utils/BSDSettingsMgt",
["DS/PADUtils/PADSettingsMgt"],
function (e) {
"use strict";
return e;
}
),
define(
"DS/IPClassifyUtil/bsd_utils/BSDCommandProxy",
["DS/PADUtils/PADCommandProxy"],
function (e) {
"use strict";
return e;
}
),
define(
"DS/IPClassifyUtil/bsd_utils/BSDTransactionManager",
["UWA/Class", "DS/PADUtils/PADTransactionManager"],
function (e, t) {
"use strict";
return e.extend(t, {
name: "BSDTransactionManager",
init: function (e) {
this._parent(e);
},
});
}
),
define(
"DS/IPClassifyUtil/IPClassifyUtility",
[
"UWA/Utils",
"UWA/Core",
"DS/i3DXCompassPlatformServices/i3DXCompassPlatformServices",
"DS/PADUtils/PADSettingsMgt",
"DS/CfgAuthoringContextUX/scripts/CfgAuthoringContext",
"DS/WidgetServices/WidgetServices",
"DS/PADUtils/PADUtilsServices",
"DS/PADServices/utils/PADTrackerManager",
"DS/ZipJS/deflate",
"DS/ZipJS/inflate",
],
function (e, t, n, i, r, s, a, o) {
var c = null,
u = null,
l = null;
function f(e, t) {
var n,
i = t;
return (
Array.isArray(e) && Array.isArray(t)
? ((n = t), (i = e.concat(n)))
: "object" == typeof e &&
"object" == typeof t &&
(i = (function (e, t) {
for (var n in t) e[n] = f(e[n], t[n]);
return e;
})(e, t)),
UWA.clone(i)
);
}
function d(e, t, n) {
var i = !0,
r = !0;
return (
Array.isArray(e) && Array.isArray(t)
? (i = (function (e, t, n) {
var i = g(e.length, t.length);
if (e.length == t.length)
if (n && !0 === n.withoutOrder)
i = (function (e, t, n) {
for (
var i = !0, r = UWA.clone(e), s = t.length, a = 0;
a < s;
a++
) {
var o = t[a],
c = p(r, o, n);
if (c < 0) {
i = !1;
break;
}
r.splice(c, 1);
}
return i;
})(e, t, n);
else
for (var r = 0; r < e.length; r++)
i = d(e[r], t[r], n) && i;
return i;
})(e, t, n))
: "object" == typeof e && "object" == typeof t
? (i = (function (e, t, n) {
var i = e === t;
if (!i && e && t) {
var r = Object.keys(e),
s = Object.keys(t);
if ((i = g(r.length, s.length)))
for (var a in e) {
var o = e[a],
c = t[a];
i = d(o, c, n) && i;
}
}
return i;
})(e, t, n))
: typeof e == typeof t
? (i = g(e, t))
: (r = !1),
(i = i && !0 === r)
);
}
function p(e, t, n) {
var i = -1;
return (
e.every(function (e, r) {
return d(e, t, n) && (i = r), -1 === i;
}),
i
);
}
function g(e, t) {
return e === t;
}
return {
getUserId: function () {
if (void 0 === window.dsUserLogin)
try {
window.dsUserLogin = window.top.dsUserLogin;
} catch (e) {
window.dsUserLogin = "unknown";
}
return window.dsUserLogin;
},
promiseCatcher: function (e) {
e.catch((e) => {});
},
getWorkUnderHeaders: function () {
let e = r.get();
var t = UWA.is(e) && UWA.is(e.change.id) ? e.change.id : null;
return "" != t ? { "DS-Change-Authoring-Context": "pid:" + t } : {};
},
softJsonParser: function (e, t) {
let n = t ? [] : {};
try {
n = JSON.parse(e);
} catch (e) {
console.log(e);
}
return n;
},
stringEncode: function (e) {
var t = "";
if (e) for (var n = 0; n < e.length; ++n) t += e.charCodeAt(n);
return t;
},
jsonZip: function (t) {
if (t.length > 0 && "{" !== t[0] && "[" !== t[0]) return t;
for (
var n = new ArrayBuffer(t.length), i = new Uint8Array(n), r = 0;
r < t.length;
++r
)
i[r] = t.charCodeAt(r);
var s = new Deflater();
s.append(i);
var a = s.flush(),
o = String.fromCharCode.apply(null, a);
return e.base64Encode(o);
},
jsonUnzip: function (t) {
if (t.length > 0 && ("{" === t[0] || "[" === t[0])) return t;
var n = t;
try {
n = e.base64Decode(t);
} catch (e) {}
for (
var i = new ArrayBuffer(n.length), r = new Uint8Array(i), s = 0;
s < n.length;
++s
)
r[s] = n.charCodeAt(s);
var a = new Inflater(),
o = a.append(r);
return a.flush(), String.fromCharCode.apply(null, o);
},
isTouchDevice: function () {
return "ontouchstart" in document.documentElement;
},
isIndexedMode: function () {
return "index" === this.determineAuthoringMode();
},
determineAuthoringMode: function () {
if (!widget.getValue("useIndexAccleration")) return "authoring";
const e = widget.getValue("IPClassify_ModeInfo") || {};
if (UWA.is(e.state, "string") && UWA.is(e.last_editing, "number")) {
const t = new Date().getTime(),
n = parseInt(widget.getValue("intervalToSwitchMode"));
return "index" === e.state ||
("authoring" === e.state && e.last_editing + 1e3 * n < t && n)
? "index"
: "authoring";
}
return "index";
},
isCustomizedEnv: function () {
var e = this;
return (
void 0 === e._isCustomizedEnv &&
((e._isCustomizedEnv = !1),
n.getGrantedRoles(function (t) {
for (var n = 0; n < t.length; n++)
if ((t[n] && "InternalDS" === t[n].id) || "PAR" === t[n].id) {
e._isCustomizedEnv = !0;
break;
}
})),
e._isCustomizedEnv
);
},
getTenantId: function () {
if (s.isNatifEnvironnement() && !s.isWebInWinEnvironment()) {
var e =
dscef && dscef.getEnv ? dscef.getEnv("MX_ONLINE_INSTANCE") : "";
return (e && " " !== e && "" !== e) || (e = a.getPlatformId()), e;
}
if (s.isNatifEnvironnement() && s.isWebInWinEnvironment()) {
var t = window.library || window.bookmark;
return t && t.params && t.params.tenant && " " != t.params.tenant
? t.params.tenant
: a.getPlatformId();
}
return a.getPlatformId();
},
getTenantAwarePreferenceName: function (e) {
let t = this.getTenantId();
return t && "OnPremise" != t ? e + "_" + t : e;
},
isOnPremise: function () {
let e = this.getTenantId();
return !e || "OnPremise" == e;
},
_getSpaceUrl: function () {
var e = this;
return new Promise(function (t) {
s.get3DSpaceUrlAsync({
platformId: e.getTenantId(),
onComplete: function (e) {
t(e);
},
onFailure: function (e) {
t(a.get3DSpaceUrl());
},
});
});
},
get3DSpaceUrl: function () {
if (u) return u;
this._getSpaceUrl().then(function (e) {
u = e;
});
},
_getSearchUrl: function () {
var e = this;
return new Promise(function (t) {
s.get3DSearchUrlAsync({
platformId: e.getTenantId(),
onComplete: function (e) {
t(e);
},
onFailure: function (e) {
t(a.get3DSearchUrl());
},
});
});
},
get3DSearchUrl: function () {
if (c) return c;
this._getSearchUrl().then(function (e) {
c = e;
});
},
_getCompassUrl: function () {
var e = this;
return new Promise(function (t) {
s.getCompassUrlAsync({
platformId: e.getTenantId(),
onComplete: function (e) {
t(e);
},
onFailure: function (e) {
t(a.getPlatformURL("3DCompass"));
},
});
});
},
get3DCompassUrl: function () {
if (l) return l;
this._getCompassUrl().then(function (e) {
l = e;
});
},
initURLS: function () {
(c = u = l = null),
this.get3DSearchUrl(),
this.get3DSpaceUrl(),
this.get3DCompassUrl();
},
initURLSAsync: function () {
var e = this;
return (
(c = u = l = null),
new Promise(function (t) {
var n = [e._getSearchUrl(), e._getSpaceUrl(), e._getCompassUrl()];
Promise.all(n)
.then(function (e) {
(c = e[0]), (u = e[1]), (l = e[2]), t();
})
.catch(function (e) {
console.log("Error while initializing URLs: " + e);
});
})
);
},
isWidgetMaximized: function () {
return (
"enopad_odt_wgd" == widget.id ||
(t.Widgets &&
(e = t.Widgets.instances.filter(function (e) {
return !(
!t.is(e, "object") ||
("maximized" !== e.getView().type &&
"fullscreen" !== e.getView().type) ||
e.id !== widget.id
);
})),
e && e.length > 0)
);
var e;
},
arrayEquals: function (e, t) {
return (
Array.isArray(e) &&
Array.isArray(t) &&
e.length === t.length &&
e.every((e, n) => e === t[n])
);
},
setPCSEntry: function (e, t) {
if (!this.isOnPremise())
try {
if (t) window.top.performance.mark(e + "_Begin");
else {
var n = window.top.performance.getEntriesByName(e + "_Begin");
n &&
n.length > 0 &&
(window.top.performance.mark(e + "_End"),
window.top.performance.measure(e, e + "_Begin", e + "_End"));
}
} catch (e) {
console.log(e);
}
},
sendPCSTracketPageEvent: function (e, t, n) {
if (!this.isOnPremise())
try {
var i = o.getPADTracker({
eventCategory: "performance",
eventAction: e,
}),
r = window.top.performance.getEntriesByName(n).pop(),
s = 0;
r &&
(r.length > 0
? (s = void 0 !== r[0] ? r[0].duration : 0)
: r.duration && (s = r.duration)),
s &&
(i.setEventData({ eventLabel: t, eventValue: s }),
window.top.performance.clearMeasures()),
i.trackPageEvent();
} catch (e) {}
},
convertExpandV2toV1: function (e) {
if (e && !(e.length <= 0)) {
for (var t = 0, n = e.length; t < n; ++t) {
let n = e[t],
r = { attributes: [] };
if (n["ds6w:type"]) {
for (var i in n)
n.hasOwnProperty(i) &&
("icon" === i
? r.attributes.push({ name: "icons", value: n[i] })
: r.attributes.push({ name: i, value: n[i] }),
"resourceid" === i &&
(r.attributes.push({ name: "physicalid", value: n[i] }),
r.attributes.push({ name: "did", value: n[i] })));
e.push(r);
}
}
return e;
}
},
sendTrackerPageEvent: function (e, t) {
if (!this.isOnPremise())
try {
var n = o.getPADTracker({
eventCategory: "usage",
eventAction: e,
appID:
"ENOFOL4_AP" == widget.data.appId
? "ENOFOL3_AP"
: widget.data.appId,
});
n.setEventData({ eventLabel: t }), n.trackPageEvent();
} catch (e) {}
},
areSame: g,
concatJsonValue: f,
compareJsonValue: d,
};
}
),
define(
"DS/IPClassifyUtil/bsd_utils/BSDAttributeMgt",
["DS/PADServices/utils/AttributesMgtV2"],
function (e) {
"use strict";
return e;
}
),
define(
"DS/IPClassifyUtil/bsd_utils/BSDSelLevel",
["UWA/Class", "DS/PADUtils/views/PADLevelSel"],
function (e, t) {
"use strict";
return e.extend(t, {
name: "BSDSelLevel",
init: function (e) {
this._parent(e);
},
});
}
),
define(
"DS/IPClassifyUtil/service/IPClassifyUtilWebService",
[
"UWA/Core",
"DS/WAFData/WAFData",
"i18n!DS/IPClassifyUtil/assets/nls/IPClassifyUtil",
"DS/PADUtils/PADSettingsMgt",
"DS/IPClassifyUtil/IPClassifyUtility",
],
function (e, t, n, i, r) {
"use strict";
return {
getUserPreferences: function (e) {
var t = e;
if (!UWA.is(t, "object"))
throw new Error(
"Invalid inputs for LibraryEditorWebService.getUserPreferences"
);
var n =
r.get3DCompassUrl() + "/resources/AppsMngt/user/getPreferences";
return (
t.name && (n += "?name=" + t.name),
(t.method = "GET"),
(t.securityContextRequired = !1),
this._executeRequest(n, t, "getUserPreferences")
);
},
saveUserPreferences: function (e) {
var t = e;
if (!UWA.is(t, "object"))
throw new Error(
"Invalid inputs for LibraryEditorWebService.saveUserPreferences"
);
var n = r.get3DCompassUrl() + "/resources/AppsMngt/user/preference";
(t.method = "PUT"),
(t.headers = {
"Content-Type": "application/x-www-form-urlencoded",
}),
(t.data = { name: e.name, value: e.value }),
(t.securityContextRequired = !1),
this._executeRequest(n, t, "saveUserPreferences");
},
_executeRequest: function (e, r, s) {
var a = Math.round(1e3 * Math.random()).toString(),
o = widget.id + "_" + widget.getTitle() + "_";
window.top.performance.mark("libraryRequest_begin" + a);
var c = {};
if ((UWA.extend(c, r), !c.payload && e.indexOf("cvservlet") > -1)) {
c.payload = {};
var u = new Date();
c.payload.label = ("LibraryWidgetExecute_" + u.getTime())
.replace(new RegExp(" ", "g"), "_")
.replace(new RegExp(",", "g"), "")
.replace(new RegExp("/", "g"), "-");
}
UWA.is(c.onTimeout, "function") ||
((c.onTimeout = function () {
var e = {
type: "timeout",
toString: function () {
return n.msg_InfoAction_Timeout;
},
};
c.onFailure(e);
}),
(c.onComplete = function (e) {
window.top.performance.mark("libraryRequest_end" + a);
var t = window.top.performance.getEntriesByName(
"libraryRequest_begin" + a
);
t &&
1 === t.length &&
(window.top.performance.measure(
o + "_Request" + s,
"libraryRequest_begin" + a,
"libraryRequest_end" + a
),
window.top.performance.clearMarks("libraryRequest_end" + a),
window.top.performance.clearMarks("libraryRequest_begin" + a)),
r.onComplete(e);
}));
var l = {
Accept: "application/json",
"Accept-Language": r.acceptLang
? r.acceptLang
: widget.lang
? widget.lang
: widget.getValue("lang"),
};
return (
!1 !== c.securityContextRequired &&
(l.SecurityContext = i.getSetting("pad_security_ctx")),
r.headers
? (c.headers = UWA.extend(l, r.headers))
: (c.headers = l),
t.authenticatedRequest(e, c)
);
},
fetchClassPredicates: function (e) {
if (!UWA.is(e, "object"))
throw new Error(
"Invalid inputs for IPClassifyUtilWebService.fetchClassPredicates"
);
var t = {};
UWA.extend(t, e);
var n =
r.get3DSpaceUrl() +
"/resources/IPClassificationReuse/ClassAttribute/fetchDefinition";
return (
(t.method = "GET"),
this._executeRequest(n, t, "fetchClassPredicates")
);
},
fetchTypesInfo: function (e) {
var t = e;
if (!UWA.is(t, "object"))
throw new Error(
"Invalid inputs for IPClassifyUtility.fetchTypesInfo"
);
var n =
r.get3DSpaceUrl() +
"/resources/IPClassificationReuse/library/getTypesOnRelation";
return (
(t.method = "GET"), this._executeRequest(n, t, "fetchTypesInfo")
);
},
fetch: function (e) {
var t = {};
if ((UWA.extend(t, e), !UWA.is(t, "object")))
throw new Error("Invalid inputs for loadThumbnails");
var n = e.ids,
s = null;
if (n.length) {
var a = r.get3DSpaceUrl() + "/cvservlet/fetch/v2",
o = i.getSetting("pad_security_ctx");
a += "?SecurityContext=" + o;
var c = {
physicalid: n,
label: ("LibraryWidgetExecute_" + new Date().getTime())
.replace(new RegExp(" ", "g"), "_")
.replace(new RegExp(",", "g"), "")
.replace(new RegExp("/", "g"), "-"),
};
e.select_file && (c.select_file = e.select_file),
e.select_predicate && (c.select_predicate = e.select_predicate),
(t.query = {
tenant: i.getSetting("x3dPlatformId") || r.getTenantId(),
});
var u = widget.lang ? widget.lang : widget.getValue("lang");
(t.headers = {
Accept: "application/json",
"content-type": "application/json",
SecurityToken: window.top.dsUserLogin + "|" + o + "|preferred",
"Accept-Language": u,
}),
(t.method = "POST"),
(t.type = "json"),
(t.data = UWA.Json.encode(c)),
(s = this._executeRequest(a, t, "loadThumbnails"));
}
return s;
},
getAuthorizedValuesNls: function (e) {
var t = {};
UWA.extend(t, e);
var n = {};
(n.attribute = e.attribute),
(n.values = e.values.split(",")),
(n.type = e.type),
(t.method = "POST"),
(t.type = "json"),
(t.payload = UWA.Json.encode(n)),
(t.data = UWA.Json.encode(n)),
(t.headers = {
Accept: "application/json",
"content-type": "application/json",
});
var i =
r.get3DSpaceUrl() +
"/resources/IPClassificationReuse/ClassAttribute/getRangeNls",
s = this._executeRequest(i, t, "getAuthorizedValuesNls");
return console.log(s), s;
},
loadThumbnails: function (e) {
return (e.select_file = ["thumbnail_2d"]), this.fetch(e);
},
getPredicates: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() +
"/resources/6WVocab/access/6WPredicates?tenant=" +
e.tenant +
"&mappable=" +
e.mappable,
e,
"getPredicates"
);
},
getDimensionsInfos: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() + "/resources/dictionary/dimensions",
e,
"getDimensionsInfos"
);
},
updateClassAttributes: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() +
"/resources/dictionary/AttributeModify?tenant=" +
e.tenant +
"&package=" +
e.package,
e,
"updateClassAttributes"
);
},
attributeDeleteCheck: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() +
"/resources/IPClassificationReuse/ClassAttribute/hasClassifiedItems?tenant=" +
e.tenant,
e,
"attributeDeleteCheck"
);
},
removeClassificationInterfaces: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() +
"/resources/IPClassificationReuse/ClassAttribute/removeClassificationInterfaces?tenant=" +
e.tenant,
e,
"attributeDeleteCheck"
);
},
restoreSybolicNames: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() +
"/resources/IPClassificationReuse/ClassAttribute/restoreSybolicNames?tenant=" +
e.tenant +
"&package=" +
e.package,
e,
"restoreSybolicNames"
);
},
deleteAttributes: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() +
"/resources/dictionary/AttributeDelete?tenant=" +
e.tenant +
"&package=" +
e.package,
e,
"deleteAttributes"
);
},
createAttributes: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() +
"/resources/dictionary/AttributeCreate?tenant=" +
e.tenant +
"&package=" +
e.package,
e,
"createAttributes"
);
},
upgradeClassAttributes: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() +
"/resources/IPClassificationReuse/ClassAttribute/upgradeClassAttributes?tenant=" +
e.tenant,
e,
"upgradeClassAttributes"
);
},
reloadCache: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() +
"/resources/IPClassificationReuse/ClassAttribute/reloadCachedData?tenant=" +
e.tenant,
e,
"reloadCache"
);
},
updateAttributeInfos: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() +
"/resources/IPClassificationReuse/ClassAttribute/UpdateAttributeInfos?tenant=" +
e.tenant,
e,
"updateSearchIndex"
);
},
launchExport: function (e) {
var t =
r.get3DSpaceUrl() +
"/resources/dictionary/ExportData?tenant=" +
e.tenant +
"&package=" +
e.package;
return this._executeRequest(t, e, "launchExport");
},
launchImport: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() + "/resources/dictionary/ImportData",
e,
"launchImport"
);
},
massupdateAttributeInfos: function (e) {
return this._executeRequest(
r.get3DSpaceUrl() +
"/resources/IPClassificationReuse/ClassAttribute/MassUpdateAttrsInfos?tenant=" +
e.tenant,
e,
"massupdateAttributeInfos"
);
},
convertDimensionUnits: function (e) {
if (!UWA.is(e, "object"))
throw new Error("Invalid inputs for convertDimensionUnits");
var t =
r.get3DSpaceUrl() +
"/resources/dictionary/dimensions/convertValues",
n = {};
return (
UWA.extend(n, e),
(n.payload = e.data),
(n.method = "POST"),
(n.headers = {
Accept: "application/json",
"content-type": "application/json",
}),
(n.data = UWA.Json.encode(n.payload)),
this._executeRequest(t, n, "convertToPreferedUnit")
);
},
};
}
),
define(
"DS/IPClassifyUtil/DimensionUtils",
[
"UWA/Class",
"DS/IPClassifyUtil/service/IPClassifyUtilWebService",
"DS/IPClassifyUtil/IPClassifyUtility",
],
function (e, t, n) {
"use strict";
return e.singleton({
init: function (e) {},
setUnitPreferedMe: function (e) {
this.unitPreferedMe = e;
},
getUnitPreferedMe: function (e) {
return this.unitPreferedMe[e];
},
getUnitAndNLS: function (e, t) {
if (this._dimensions && e) {
let n = this._dimensions[e];
if (!n) return null;
let i = {};
return (
(i.unit = n.mksUnitDBName),
(i.nls = n.defaultUnit),
t && (i.manipulationNls = n[t]),
i
);
}
return null;
},
_dimensions: null,
getDimensions: function () {
var e = this;
return new Promise(function (i) {
e._dimensions
? i(e._dimensions)
: n.initURLSAsync().then(function () {
t.getDimensionsInfos({
method: "GET",
Accept: "application/json",
"content-type": "application/json",
onComplete: function (t) {
try {
t = "string" == typeof t ? JSON.parse(t) : t;
var n = {};
t.results.forEach(function (e) {
var t = {};
t.mksUnitDBName = e.MKSUnit;
e.Units.forEach(function (e) {
(t[e.Name] = e.NLSName),
t.mksUnitDBName == e.Name &&
(t.defaultUnit = e.NLSName);
}),
(n[e.Name] = t);
}),
(e._dimensions = n),
console.info("Dimensions Loaded ..."),
i(e._dimensions);
} catch (e) {
console.error(
"Unexpected error when fetching dimensions"
),
console.error(e),
i(null);
}
},
onFailure: function (e) {
console.error("Unable to get dimentions : "),
console.error(e),
i(null);
},
});
});
});
},
convertToPreferdUnits: function (e) {
return new Promise(function (i) {
n.initURLSAsync().then(function () {
t.convertDimensionUnits({
data: e,
onComplete: function (e) {
var t = (e = "string" == typeof e ? JSON.parse(e) : e)
.Response
? e.Response
: [];
i(t);
},
onFailure: function (e) {
console.error("Unable to convert dimentions units : "),
console.error(e),
i(null);
},
});
});
});
},
});
}
),
define(
"DS/IPClassifyUtil/OpenWithMenuBuilder",
[
"DS/i3DXCompassPlatformServices/OpenWith",
"UWA/Promise",
"DS/PADUtils/PADUtilsServices",
"DS/PADUtils/PADSettingsMgt",
"DS/WidgetServices/WidgetServices",
"DS/IPClassifyUtil/service/IPClassifyUtilWebService",
"DS/IPClassifyUtil/IPClassifyUtility",
],
function (e, t, n, i, r, s, a) {
function o(e) {
return new t((t) => {
var n = {};
e.forEach(function (e) {
n[e.options.type] = !0;
}),
require(["DS/PADUtils/PADTypesMgt"], function (e) {
e.retrieveHierarchy(Object.keys(n), function (e) {
t(e);
});
});
});
}
function c() {}
var u;
return (
(c.prototype = {
getTypeInheritance: o,
build3DXContent: function (e) {
return new t((a) => {
let c = o(e),
u = (function (e) {
return new t(function (t) {
let n = [],
i = {};
e.forEach((e) => {
let t = !1;
e.getAttributeValue &&
(t = !!e.getAttributeValue("ds6w:kind")),
t || (n.push(e.getID()), (i[e.getID()] = e));
}),
n.length > 0
? s.fetch({
ids: n,
select_predicate: ["ds6w:kind"],
onComplete: (e) => {
if (e && e.results && e.results.length > 0) {
for (var n = 0; n < e.results.length; ++n)
for (
var r = e.results[n],
s = [],
a = null,
o = 0;
o < r.attributes.length;
++o
)
"ds6w:kind" == r.attributes[o].name
? s.push(r.attributes[o].value)
: "resourceid" == r.attributes[o].name &&
(a = r.attributes[o].value);
if (a && s.length > 0) {
let e = i[a];
e && e.setAttribute("ds6w:kind", s);
}
}
t();
},
onFailure: function () {
t(),
console.log(
"Failure during object Kind retrieval"
);
},
})
: t();
});
})(e),
l = {};
e.forEach((e) => (l[e.getID()] = e)),
t.all([c, u]).then((t) => {
let s = t[0],
o = null;
s &&
((o = {
protocol: "3DXContent",
version: "2.1",
source:
widget && widget.getValue("x3dAppId")
? widget.getValue("x3dAppId")
: "ENOFOL3_AP",
widgetId: n.getWidgetId(),
data: { items: [] },
}),
e.forEach(function (e) {
!0 !== e.isGroupingNode &&
o.data.items.push(
(function (e, t) {
var n,
s = [e.options.type];
t &&
t[e.options.type] &&
(s = t[e.options.type]).length > 1 &&
s[0] === s[1] &&
s.shift(),
(n =
!0 === e.isRelationsObjectNode
? void 0
: e.getOccurencePathWithType
? e.getOccurencePathWithType()
: void 0);
let a = e.getAttributeValue("serviceId");
a = a || "3DSpace";
let o = e.getAttributeValue("i3dx"),
c = e.getAttributeValue("ds6w:kind");
(c = c || []), Array.isArray(c) || (c = [c]);
let u = {
envId: r.getTenantID("OnPremise"),
serviceId: a,
contextId: i.getSetting("pad_security_ctx")
? i.getSetting("pad_security_ctx")
: void 0,
objectId: e.getID(),
objectType: e.options.type,
objectTaxonomies: [...s, ...c],
displayName: e.options.display
? e.options.display
: e.getLabel(),
displayType: e.options.grid
? e.options.grid["ds6w:type"]
: e.options.type,
path: n,
};
return o && (u.i3dx = o), u;
})(e, s)
);
})),
a(o);
});
});
},
openWithApps: function (n, i, r) {
return new t(async (t, s) => {
let o = await this.build3DXContent(n);
var c = new e();
o && UWA.is(c.retrieveCompatibleApps, "function")
? (c.set3DXContent(o, !0 === i.overrideAppLaunch),
c.retrieveCompatibleApps(function (e) {
var n = [],
s = [];
if (
(e.forEach(function (e) {
var t = {
type: "PushItem",
title: e.text,
action: {
callback: () => {
r &&
a.sendTrackerPageEvent(
r,
"Open with " + e.text
),
e.handler();
},
},
};
e.icon
? (t.icon = "url(" + e.icon + ")")
: (t.fonticon = {
content:
"wux-ui-3ds wux-ui-3ds-1x wux-ui-3ds-" +
e.fonticon,
family: WUXManagedFontIcons.Font3DS,
}),
s.push(t);
}),
s.length > 0)
) {
var o = i.iconOpenWith;
"string" == typeof i.iconOpenWith &&
(o = "url(" + i.iconOpenWith + ")");
var c = {
type: "PushItem",
icon: o,
title: i.nlsOpenWith,
submenu: s,
};
n.push(c), n.push({ type: "SeparatorItem" });
}
t(n);
}))
: t([]);
});
},
}),
u || (u = new c()),
u
);
}
),
define(
"DS/IPClassifyUtil/IPClassifyPreference",
[
"UWA/Class",
"DS/IPClassifyUtil/service/IPClassifyUtilWebService",
"DS/IPClassifyUtil/IPClassifyUtility",
],
function (e, t, n) {
return e.singleton({
get: function (e, i, r, s) {
function a(e) {
if (e)
try {
s && (e = n.jsonUnzip(e)), (e = JSON.parse(e));
} catch (t) {
e = {};
}
else e = {};
return e;
}
if (((s = !1 !== s), (r = !1 !== r)))
if (window.dscef && window.dscef.loadValue)
window.dscef.loadValue
? window.dscef
.loadValue(e)
.then(function (e) {
(o = a(e)), i(o);
})
.catch(function (e) {
i({});
})
: i({});
else if (widget && widget.getValue) {
(o = a((o = widget.getValue(e)))), i(o);
} else {
var o;
(o = a((o = window.nonDsApps))), i(o);
}
else
t.getUserPreferences({
name: e,
onComplete: function (e) {
(o = a(e)), i(o);
},
onFailure: function (e) {
i();
},
});
},
set: function (e, i, r, s) {
i &&
((r = !1 !== r),
(s = !1 !== s),
(i = JSON.stringify(i)),
s && (i = n.jsonZip(i)),
r
? window.dscef && window.dscef.saveValue
? window.dscef.saveValue(e, i)
: widget && widget.setValue
? widget.setValue(e, i)
: (window.nonDsApps = i)
: t.saveUserPreferences({
name: e,
value: i,
onComplete: function () {},
onFailure: function (t) {
console.log("Error while saving userpreferences for " + e);
},
}));
},
});
}
);