@infuro/cms-core 1.0.54 → 1.0.56
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/admin.cjs +20 -11
- package/dist/admin.js +20 -11
- package/dist/api.cjs +32 -32
- package/dist/api.js +1 -1
- package/dist/{chunk-CJ2YAVCO.cjs → chunk-JGR4ZUON.cjs} +63 -8
- package/dist/{chunk-PDA4L2LS.js → chunk-LI3CUI54.js} +63 -8
- package/dist/index.cjs +264 -226
- package/dist/index.js +53 -15
- package/package.json +1 -1
package/dist/admin.cjs
CHANGED
|
@@ -887,7 +887,7 @@ var init_admin_config_context = __esm({
|
|
|
887
887
|
var CMS_VERSION;
|
|
888
888
|
var init_cms_version = __esm({
|
|
889
889
|
"src/lib/cms-version.ts"() {
|
|
890
|
-
CMS_VERSION = "1.0.
|
|
890
|
+
CMS_VERSION = "1.0.56" ;
|
|
891
891
|
}
|
|
892
892
|
});
|
|
893
893
|
function useCatalogCategories(enabled = true) {
|
|
@@ -33696,7 +33696,7 @@ function EventEditPage({ eventId }) {
|
|
|
33696
33696
|
setExhibitors(parseNamedListFromApi(data.exhibitors, "exhibitor"));
|
|
33697
33697
|
setPartners(parseNamedListFromApi(data.partners, "partner"));
|
|
33698
33698
|
setSpeakers(parseNamedListFromApi(data.speakers, "speaker"));
|
|
33699
|
-
setSortOrder(Number(data.sortOrder)
|
|
33699
|
+
setSortOrder(data.sortOrder != null ? Number(data.sortOrder) : 0);
|
|
33700
33700
|
setContactFormId(data.contactFormId != null && Number.isFinite(Number(data.contactFormId)) ? Number(data.contactFormId) : null);
|
|
33701
33701
|
const loadedDefault = String(data.defaultCurrency ?? DEFAULT_EVENT_CURRENCY).trim().toUpperCase() || DEFAULT_EVENT_CURRENCY;
|
|
33702
33702
|
setDefaultCurrency(loadedDefault);
|
|
@@ -33808,7 +33808,7 @@ function EventEditPage({ eventId }) {
|
|
|
33808
33808
|
exhibitors: namedListToPayload(exhibitors),
|
|
33809
33809
|
partners: namedListToPayload(partners),
|
|
33810
33810
|
speakers: namedListToPayload(speakers),
|
|
33811
|
-
sortOrder,
|
|
33811
|
+
sortOrder: sortOrder === "" ? 0 : sortOrder,
|
|
33812
33812
|
contactFormId
|
|
33813
33813
|
};
|
|
33814
33814
|
if (approvalOn) {
|
|
@@ -34075,8 +34075,19 @@ function EventEditPage({ eventId }) {
|
|
|
34075
34075
|
className: labelCls6
|
|
34076
34076
|
}, "Sort order"), /* @__PURE__ */ React.createElement("input", {
|
|
34077
34077
|
type: "number",
|
|
34078
|
+
min: 0,
|
|
34078
34079
|
value: sortOrder,
|
|
34079
|
-
onChange: /* @__PURE__ */ __name((e) =>
|
|
34080
|
+
onChange: /* @__PURE__ */ __name((e) => {
|
|
34081
|
+
const value = e.target.value;
|
|
34082
|
+
if (value === "") {
|
|
34083
|
+
setSortOrder("");
|
|
34084
|
+
return;
|
|
34085
|
+
}
|
|
34086
|
+
const number = Number(value);
|
|
34087
|
+
if (number >= 0) {
|
|
34088
|
+
setSortOrder(number);
|
|
34089
|
+
}
|
|
34090
|
+
}, "onChange"),
|
|
34080
34091
|
className: inputCls6
|
|
34081
34092
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
34082
34093
|
className: "sm:col-span-2"
|
|
@@ -34353,17 +34364,15 @@ function EventEditPage({ eventId }) {
|
|
|
34353
34364
|
}))))
|
|
34354
34365
|
}), /* @__PURE__ */ React.createElement("div", {
|
|
34355
34366
|
className: "flex items-center justify-between border-t border-gray-200 px-4 py-4 sm:px-6"
|
|
34356
|
-
}, /* @__PURE__ */ React.createElement("button", {
|
|
34367
|
+
}, activeTabIndex > 0 ? /* @__PURE__ */ React.createElement("button", {
|
|
34357
34368
|
type: "button",
|
|
34358
34369
|
onClick: goToPreviousTab,
|
|
34359
|
-
|
|
34360
|
-
|
|
34361
|
-
}, "Previous"), /* @__PURE__ */ React.createElement("button", {
|
|
34370
|
+
className: "rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50"
|
|
34371
|
+
}, "Previous") : /* @__PURE__ */ React.createElement("div", null), activeTabIndex < eventTabs.length - 1 ? /* @__PURE__ */ React.createElement("button", {
|
|
34362
34372
|
type: "button",
|
|
34363
34373
|
onClick: goToNextTab,
|
|
34364
|
-
|
|
34365
|
-
|
|
34366
|
-
}, "Next")), showEventProducts ? /* @__PURE__ */ React.createElement("div", {
|
|
34374
|
+
className: "rounded-md bg-gray-900 px-4 py-2 text-sm font-medium text-white hover:bg-gray-800"
|
|
34375
|
+
}, "Next") : /* @__PURE__ */ React.createElement("div", null)), showEventProducts ? /* @__PURE__ */ React.createElement("div", {
|
|
34367
34376
|
className: "border-t border-gray-200 px-4 py-4 sm:px-6"
|
|
34368
34377
|
}, /* @__PURE__ */ React.createElement(EventProductsSection, {
|
|
34369
34378
|
eventId: eventRecordId,
|
package/dist/admin.js
CHANGED
|
@@ -853,7 +853,7 @@ var init_admin_config_context = __esm({
|
|
|
853
853
|
var CMS_VERSION;
|
|
854
854
|
var init_cms_version = __esm({
|
|
855
855
|
"src/lib/cms-version.ts"() {
|
|
856
|
-
CMS_VERSION = "1.0.
|
|
856
|
+
CMS_VERSION = "1.0.56" ;
|
|
857
857
|
}
|
|
858
858
|
});
|
|
859
859
|
function useCatalogCategories(enabled = true) {
|
|
@@ -33662,7 +33662,7 @@ function EventEditPage({ eventId }) {
|
|
|
33662
33662
|
setExhibitors(parseNamedListFromApi(data.exhibitors, "exhibitor"));
|
|
33663
33663
|
setPartners(parseNamedListFromApi(data.partners, "partner"));
|
|
33664
33664
|
setSpeakers(parseNamedListFromApi(data.speakers, "speaker"));
|
|
33665
|
-
setSortOrder(Number(data.sortOrder)
|
|
33665
|
+
setSortOrder(data.sortOrder != null ? Number(data.sortOrder) : 0);
|
|
33666
33666
|
setContactFormId(data.contactFormId != null && Number.isFinite(Number(data.contactFormId)) ? Number(data.contactFormId) : null);
|
|
33667
33667
|
const loadedDefault = String(data.defaultCurrency ?? DEFAULT_EVENT_CURRENCY).trim().toUpperCase() || DEFAULT_EVENT_CURRENCY;
|
|
33668
33668
|
setDefaultCurrency(loadedDefault);
|
|
@@ -33774,7 +33774,7 @@ function EventEditPage({ eventId }) {
|
|
|
33774
33774
|
exhibitors: namedListToPayload(exhibitors),
|
|
33775
33775
|
partners: namedListToPayload(partners),
|
|
33776
33776
|
speakers: namedListToPayload(speakers),
|
|
33777
|
-
sortOrder,
|
|
33777
|
+
sortOrder: sortOrder === "" ? 0 : sortOrder,
|
|
33778
33778
|
contactFormId
|
|
33779
33779
|
};
|
|
33780
33780
|
if (approvalOn) {
|
|
@@ -34041,8 +34041,19 @@ function EventEditPage({ eventId }) {
|
|
|
34041
34041
|
className: labelCls6
|
|
34042
34042
|
}, "Sort order"), /* @__PURE__ */ React.createElement("input", {
|
|
34043
34043
|
type: "number",
|
|
34044
|
+
min: 0,
|
|
34044
34045
|
value: sortOrder,
|
|
34045
|
-
onChange: /* @__PURE__ */ __name((e) =>
|
|
34046
|
+
onChange: /* @__PURE__ */ __name((e) => {
|
|
34047
|
+
const value = e.target.value;
|
|
34048
|
+
if (value === "") {
|
|
34049
|
+
setSortOrder("");
|
|
34050
|
+
return;
|
|
34051
|
+
}
|
|
34052
|
+
const number = Number(value);
|
|
34053
|
+
if (number >= 0) {
|
|
34054
|
+
setSortOrder(number);
|
|
34055
|
+
}
|
|
34056
|
+
}, "onChange"),
|
|
34046
34057
|
className: inputCls6
|
|
34047
34058
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
34048
34059
|
className: "sm:col-span-2"
|
|
@@ -34319,17 +34330,15 @@ function EventEditPage({ eventId }) {
|
|
|
34319
34330
|
}))))
|
|
34320
34331
|
}), /* @__PURE__ */ React.createElement("div", {
|
|
34321
34332
|
className: "flex items-center justify-between border-t border-gray-200 px-4 py-4 sm:px-6"
|
|
34322
|
-
}, /* @__PURE__ */ React.createElement("button", {
|
|
34333
|
+
}, activeTabIndex > 0 ? /* @__PURE__ */ React.createElement("button", {
|
|
34323
34334
|
type: "button",
|
|
34324
34335
|
onClick: goToPreviousTab,
|
|
34325
|
-
|
|
34326
|
-
|
|
34327
|
-
}, "Previous"), /* @__PURE__ */ React.createElement("button", {
|
|
34336
|
+
className: "rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50"
|
|
34337
|
+
}, "Previous") : /* @__PURE__ */ React.createElement("div", null), activeTabIndex < eventTabs.length - 1 ? /* @__PURE__ */ React.createElement("button", {
|
|
34328
34338
|
type: "button",
|
|
34329
34339
|
onClick: goToNextTab,
|
|
34330
|
-
|
|
34331
|
-
|
|
34332
|
-
}, "Next")), showEventProducts ? /* @__PURE__ */ React.createElement("div", {
|
|
34340
|
+
className: "rounded-md bg-gray-900 px-4 py-2 text-sm font-medium text-white hover:bg-gray-800"
|
|
34341
|
+
}, "Next") : /* @__PURE__ */ React.createElement("div", null)), showEventProducts ? /* @__PURE__ */ React.createElement("div", {
|
|
34333
34342
|
className: "border-t border-gray-200 px-4 py-4 sm:px-6"
|
|
34334
34343
|
}, /* @__PURE__ */ React.createElement(EventProductsSection, {
|
|
34335
34344
|
eventId: eventRecordId,
|
package/dist/api.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJGR4ZUON_cjs = require('./chunk-JGR4ZUON.cjs');
|
|
4
4
|
require('./chunk-XQ3QUHWR.cjs');
|
|
5
5
|
require('./chunk-HY3AXLOI.cjs');
|
|
6
6
|
require('./chunk-JN4AFHZ4.cjs');
|
|
@@ -22,127 +22,127 @@ require('./chunk-USNT2KNT.cjs');
|
|
|
22
22
|
|
|
23
23
|
Object.defineProperty(exports, "createAnalyticsHandlers", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkJGR4ZUON_cjs.createAnalyticsHandlers; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "createBlogBySlugHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkJGR4ZUON_cjs.createBlogBySlugHandler; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "createChangePasswordHandler", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkJGR4ZUON_cjs.createChangePasswordHandler; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "createCmsApiHandler", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkJGR4ZUON_cjs.createCmsApiHandler; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "createCrudByIdHandler", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkJGR4ZUON_cjs.createCrudByIdHandler; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "createCrudHandler", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkJGR4ZUON_cjs.createCrudHandler; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "createDashboardStatsHandler", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkJGR4ZUON_cjs.createDashboardStatsHandler; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "createEcommerceAnalyticsHandler", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkJGR4ZUON_cjs.createEcommerceAnalyticsHandler; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "createForgotPasswordHandler", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkJGR4ZUON_cjs.createForgotPasswordHandler; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "createFormBySlugHandler", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkJGR4ZUON_cjs.createFormBySlugHandler; }
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(exports, "createInviteAcceptHandler", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunkJGR4ZUON_cjs.createInviteAcceptHandler; }
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(exports, "createJobScheduleHandlers", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunkJGR4ZUON_cjs.createJobScheduleHandlers; }
|
|
70
70
|
});
|
|
71
71
|
Object.defineProperty(exports, "createLlmAgentKnowledgeHandlers", {
|
|
72
72
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunkJGR4ZUON_cjs.createLlmAgentKnowledgeHandlers; }
|
|
74
74
|
});
|
|
75
75
|
Object.defineProperty(exports, "createMediaZipExtractHandler", {
|
|
76
76
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunkJGR4ZUON_cjs.createMediaZipExtractHandler; }
|
|
78
78
|
});
|
|
79
79
|
Object.defineProperty(exports, "createSetPasswordHandler", {
|
|
80
80
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunkJGR4ZUON_cjs.createSetPasswordHandler; }
|
|
82
82
|
});
|
|
83
83
|
Object.defineProperty(exports, "createSettingsApiHandlers", {
|
|
84
84
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunkJGR4ZUON_cjs.createSettingsApiHandlers; }
|
|
86
86
|
});
|
|
87
87
|
Object.defineProperty(exports, "createStorefrontApiHandler", {
|
|
88
88
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunkJGR4ZUON_cjs.createStorefrontApiHandler; }
|
|
90
90
|
});
|
|
91
91
|
Object.defineProperty(exports, "createUploadHandler", {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunkJGR4ZUON_cjs.createUploadHandler; }
|
|
94
94
|
});
|
|
95
95
|
Object.defineProperty(exports, "createUserAuthApiRouter", {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunkJGR4ZUON_cjs.createUserAuthApiRouter; }
|
|
98
98
|
});
|
|
99
99
|
Object.defineProperty(exports, "createUserAvatarHandler", {
|
|
100
100
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunkJGR4ZUON_cjs.createUserAvatarHandler; }
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(exports, "createUserProfileHandler", {
|
|
104
104
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunkJGR4ZUON_cjs.createUserProfileHandler; }
|
|
106
106
|
});
|
|
107
107
|
Object.defineProperty(exports, "createUsersApiHandlers", {
|
|
108
108
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunkJGR4ZUON_cjs.createUsersApiHandlers; }
|
|
110
110
|
});
|
|
111
111
|
Object.defineProperty(exports, "createVendorDashboardHandler", {
|
|
112
112
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunkJGR4ZUON_cjs.createVendorDashboardHandler; }
|
|
114
114
|
});
|
|
115
115
|
Object.defineProperty(exports, "createVendorOnboardHandlers", {
|
|
116
116
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunkJGR4ZUON_cjs.createVendorOnboardHandlers; }
|
|
118
118
|
});
|
|
119
119
|
Object.defineProperty(exports, "getPublicSettingsGroup", {
|
|
120
120
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunkJGR4ZUON_cjs.getPublicSettingsGroup; }
|
|
122
122
|
});
|
|
123
123
|
Object.defineProperty(exports, "mergeGuardrailsIntoSystemPrompt", {
|
|
124
124
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunkJGR4ZUON_cjs.mergeGuardrailsIntoSystemPrompt; }
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "parseLlmAgentValidationRules", {
|
|
128
128
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunkJGR4ZUON_cjs.parseLlmAgentValidationRules; }
|
|
130
130
|
});
|
|
131
131
|
Object.defineProperty(exports, "simpleDecrypt", {
|
|
132
132
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunkJGR4ZUON_cjs.simpleDecrypt; }
|
|
134
134
|
});
|
|
135
135
|
Object.defineProperty(exports, "simpleEncrypt", {
|
|
136
136
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
137
|
+
get: function () { return chunkJGR4ZUON_cjs.simpleEncrypt; }
|
|
138
138
|
});
|
|
139
139
|
Object.defineProperty(exports, "validateUserMessageAgainstAgentRules", {
|
|
140
140
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunkJGR4ZUON_cjs.validateUserMessageAgainstAgentRules; }
|
|
142
142
|
});
|
|
143
143
|
Object.defineProperty(exports, "validateUserMessageAgainstStructuredRules", {
|
|
144
144
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunkJGR4ZUON_cjs.validateUserMessageAgainstStructuredRules; }
|
|
146
146
|
});
|
|
147
147
|
Object.defineProperty(exports, "createCmsAuthBundle", {
|
|
148
148
|
enumerable: true,
|
package/dist/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createAnalyticsHandlers, createBlogBySlugHandler, createChangePasswordHandler, createCmsApiHandler, createCrudByIdHandler, createCrudHandler, createDashboardStatsHandler, createEcommerceAnalyticsHandler, createForgotPasswordHandler, createFormBySlugHandler, createInviteAcceptHandler, createJobScheduleHandlers, createLlmAgentKnowledgeHandlers, createMediaZipExtractHandler, createSetPasswordHandler, createSettingsApiHandlers, createStorefrontApiHandler, createUploadHandler, createUserAuthApiRouter, createUserAvatarHandler, createUserProfileHandler, createUsersApiHandlers, createVendorDashboardHandler, createVendorOnboardHandlers, getPublicSettingsGroup, mergeGuardrailsIntoSystemPrompt, parseLlmAgentValidationRules, simpleDecrypt, simpleEncrypt, validateUserMessageAgainstAgentRules, validateUserMessageAgainstStructuredRules } from './chunk-
|
|
1
|
+
export { createAnalyticsHandlers, createBlogBySlugHandler, createChangePasswordHandler, createCmsApiHandler, createCrudByIdHandler, createCrudHandler, createDashboardStatsHandler, createEcommerceAnalyticsHandler, createForgotPasswordHandler, createFormBySlugHandler, createInviteAcceptHandler, createJobScheduleHandlers, createLlmAgentKnowledgeHandlers, createMediaZipExtractHandler, createSetPasswordHandler, createSettingsApiHandlers, createStorefrontApiHandler, createUploadHandler, createUserAuthApiRouter, createUserAvatarHandler, createUserProfileHandler, createUsersApiHandlers, createVendorDashboardHandler, createVendorOnboardHandlers, getPublicSettingsGroup, mergeGuardrailsIntoSystemPrompt, parseLlmAgentValidationRules, simpleDecrypt, simpleEncrypt, validateUserMessageAgainstAgentRules, validateUserMessageAgainstStructuredRules } from './chunk-LI3CUI54.js';
|
|
2
2
|
import './chunk-GO7PPYNU.js';
|
|
3
3
|
import './chunk-3K5AIEIZ.js';
|
|
4
4
|
import './chunk-CTXBYO2J.js';
|
|
@@ -33465,17 +33465,48 @@ function createStorefrontApiHandler(config) {
|
|
|
33465
33465
|
if (!contact) return json({
|
|
33466
33466
|
orders: []
|
|
33467
33467
|
});
|
|
33468
|
-
|
|
33469
|
-
|
|
33470
|
-
|
|
33471
|
-
|
|
33472
|
-
|
|
33473
|
-
|
|
33468
|
+
let linkedCustomerContactIds = [];
|
|
33469
|
+
if (entityMap.customer && entityMap.customer_contacts) {
|
|
33470
|
+
const rows = await dataSource.query(`SELECT cc.id
|
|
33471
|
+
FROM customer_contacts cc
|
|
33472
|
+
JOIN customer c ON c.id = cc."customerId"
|
|
33473
|
+
WHERE c."userId" = $1`, [
|
|
33474
|
+
uid
|
|
33475
|
+
]);
|
|
33476
|
+
linkedCustomerContactIds = rows.map((row) => Number(row.id)).filter((id) => Number.isFinite(id) && id > 0);
|
|
33477
|
+
}
|
|
33478
|
+
const visibleOrders = await orderRepo().find({
|
|
33479
|
+
where: [
|
|
33480
|
+
{
|
|
33481
|
+
contactId: contact.id,
|
|
33482
|
+
deleted: false,
|
|
33483
|
+
orderKind: "sale"
|
|
33484
|
+
},
|
|
33485
|
+
...linkedCustomerContactIds.length ? [
|
|
33486
|
+
{
|
|
33487
|
+
customerContactId: typeorm.In(linkedCustomerContactIds),
|
|
33488
|
+
deleted: false,
|
|
33489
|
+
orderKind: "sale"
|
|
33490
|
+
}
|
|
33491
|
+
] : []
|
|
33492
|
+
],
|
|
33474
33493
|
order: {
|
|
33475
33494
|
createdAt: "DESC"
|
|
33476
33495
|
},
|
|
33477
33496
|
take: 50
|
|
33478
33497
|
});
|
|
33498
|
+
const orders = visibleOrders.filter((o) => {
|
|
33499
|
+
const row = o;
|
|
33500
|
+
const orderContactId = Number(row.contactId);
|
|
33501
|
+
const customerContactId = Number(row.customerContactId);
|
|
33502
|
+
if (Number.isFinite(orderContactId) && orderContactId > 0 && orderContactId === Number(contact.id)) {
|
|
33503
|
+
return true;
|
|
33504
|
+
}
|
|
33505
|
+
if (Number.isFinite(customerContactId) && customerContactId > 0) {
|
|
33506
|
+
return linkedCustomerContactIds.includes(customerContactId);
|
|
33507
|
+
}
|
|
33508
|
+
return false;
|
|
33509
|
+
});
|
|
33479
33510
|
const orderIds = orders.map((o) => o.id);
|
|
33480
33511
|
const previewByOrder = {};
|
|
33481
33512
|
if (orderIds.length) {
|
|
@@ -33568,10 +33599,19 @@ function createStorefrontApiHandler(config) {
|
|
|
33568
33599
|
status: 404
|
|
33569
33600
|
});
|
|
33570
33601
|
const orderId = parseInt(path2[1], 10);
|
|
33602
|
+
let linkedCustomerContactIds = [];
|
|
33603
|
+
if (entityMap.customer && entityMap.customer_contacts) {
|
|
33604
|
+
const rows = await dataSource.query(`SELECT cc.id
|
|
33605
|
+
FROM customer_contacts cc
|
|
33606
|
+
JOIN customer c ON c.id = cc."customerId"
|
|
33607
|
+
WHERE c."userId" = $1`, [
|
|
33608
|
+
uid
|
|
33609
|
+
]);
|
|
33610
|
+
linkedCustomerContactIds = rows.map((row) => Number(row.id)).filter((id) => Number.isFinite(id) && id > 0);
|
|
33611
|
+
}
|
|
33571
33612
|
let order = await orderRepo().findOne({
|
|
33572
33613
|
where: {
|
|
33573
33614
|
id: orderId,
|
|
33574
|
-
contactId: contact.id,
|
|
33575
33615
|
deleted: false
|
|
33576
33616
|
},
|
|
33577
33617
|
relations: [
|
|
@@ -33584,13 +33624,20 @@ function createStorefrontApiHandler(config) {
|
|
|
33584
33624
|
}, {
|
|
33585
33625
|
status: 404
|
|
33586
33626
|
});
|
|
33627
|
+
const orderContactId = Number(order.contactId);
|
|
33628
|
+
const orderCustomerContactId = Number(order.customerContactId);
|
|
33629
|
+
const isOwner = Number.isFinite(orderContactId) && orderContactId > 0 && orderContactId === Number(contact.id) || Number.isFinite(orderCustomerContactId) && orderCustomerContactId > 0 && linkedCustomerContactIds.includes(orderCustomerContactId);
|
|
33630
|
+
if (!isOwner) return json({
|
|
33631
|
+
error: "Not found"
|
|
33632
|
+
}, {
|
|
33633
|
+
status: 404
|
|
33634
|
+
});
|
|
33587
33635
|
if (getCms) {
|
|
33588
33636
|
const cms = await getCms();
|
|
33589
33637
|
await tryRefreshOrderFromErpForStorefront(cms, dataSource, entityMap, order);
|
|
33590
33638
|
order = await orderRepo().findOne({
|
|
33591
33639
|
where: {
|
|
33592
33640
|
id: orderId,
|
|
33593
|
-
contactId: contact.id,
|
|
33594
33641
|
deleted: false
|
|
33595
33642
|
},
|
|
33596
33643
|
relations: [
|
|
@@ -33604,6 +33651,14 @@ function createStorefrontApiHandler(config) {
|
|
|
33604
33651
|
}, {
|
|
33605
33652
|
status: 404
|
|
33606
33653
|
});
|
|
33654
|
+
const refreshedOrderContactId = Number(order.contactId);
|
|
33655
|
+
const refreshedCustomerContactId = Number(order.customerContactId);
|
|
33656
|
+
const isOwnerAfterRefresh = Number.isFinite(refreshedOrderContactId) && refreshedOrderContactId > 0 && refreshedOrderContactId === Number(contact.id) || Number.isFinite(refreshedCustomerContactId) && refreshedCustomerContactId > 0 && linkedCustomerContactIds.includes(refreshedCustomerContactId);
|
|
33657
|
+
if (!isOwnerAfterRefresh) return json({
|
|
33658
|
+
error: "Not found"
|
|
33659
|
+
}, {
|
|
33660
|
+
status: 404
|
|
33661
|
+
});
|
|
33607
33662
|
const o = order;
|
|
33608
33663
|
const lines = (o.items || []).map((line) => {
|
|
33609
33664
|
const p = line.product;
|
|
@@ -33455,17 +33455,48 @@ function createStorefrontApiHandler(config) {
|
|
|
33455
33455
|
if (!contact) return json({
|
|
33456
33456
|
orders: []
|
|
33457
33457
|
});
|
|
33458
|
-
|
|
33459
|
-
|
|
33460
|
-
|
|
33461
|
-
|
|
33462
|
-
|
|
33463
|
-
|
|
33458
|
+
let linkedCustomerContactIds = [];
|
|
33459
|
+
if (entityMap.customer && entityMap.customer_contacts) {
|
|
33460
|
+
const rows = await dataSource.query(`SELECT cc.id
|
|
33461
|
+
FROM customer_contacts cc
|
|
33462
|
+
JOIN customer c ON c.id = cc."customerId"
|
|
33463
|
+
WHERE c."userId" = $1`, [
|
|
33464
|
+
uid
|
|
33465
|
+
]);
|
|
33466
|
+
linkedCustomerContactIds = rows.map((row) => Number(row.id)).filter((id) => Number.isFinite(id) && id > 0);
|
|
33467
|
+
}
|
|
33468
|
+
const visibleOrders = await orderRepo().find({
|
|
33469
|
+
where: [
|
|
33470
|
+
{
|
|
33471
|
+
contactId: contact.id,
|
|
33472
|
+
deleted: false,
|
|
33473
|
+
orderKind: "sale"
|
|
33474
|
+
},
|
|
33475
|
+
...linkedCustomerContactIds.length ? [
|
|
33476
|
+
{
|
|
33477
|
+
customerContactId: In(linkedCustomerContactIds),
|
|
33478
|
+
deleted: false,
|
|
33479
|
+
orderKind: "sale"
|
|
33480
|
+
}
|
|
33481
|
+
] : []
|
|
33482
|
+
],
|
|
33464
33483
|
order: {
|
|
33465
33484
|
createdAt: "DESC"
|
|
33466
33485
|
},
|
|
33467
33486
|
take: 50
|
|
33468
33487
|
});
|
|
33488
|
+
const orders = visibleOrders.filter((o) => {
|
|
33489
|
+
const row = o;
|
|
33490
|
+
const orderContactId = Number(row.contactId);
|
|
33491
|
+
const customerContactId = Number(row.customerContactId);
|
|
33492
|
+
if (Number.isFinite(orderContactId) && orderContactId > 0 && orderContactId === Number(contact.id)) {
|
|
33493
|
+
return true;
|
|
33494
|
+
}
|
|
33495
|
+
if (Number.isFinite(customerContactId) && customerContactId > 0) {
|
|
33496
|
+
return linkedCustomerContactIds.includes(customerContactId);
|
|
33497
|
+
}
|
|
33498
|
+
return false;
|
|
33499
|
+
});
|
|
33469
33500
|
const orderIds = orders.map((o) => o.id);
|
|
33470
33501
|
const previewByOrder = {};
|
|
33471
33502
|
if (orderIds.length) {
|
|
@@ -33558,10 +33589,19 @@ function createStorefrontApiHandler(config) {
|
|
|
33558
33589
|
status: 404
|
|
33559
33590
|
});
|
|
33560
33591
|
const orderId = parseInt(path2[1], 10);
|
|
33592
|
+
let linkedCustomerContactIds = [];
|
|
33593
|
+
if (entityMap.customer && entityMap.customer_contacts) {
|
|
33594
|
+
const rows = await dataSource.query(`SELECT cc.id
|
|
33595
|
+
FROM customer_contacts cc
|
|
33596
|
+
JOIN customer c ON c.id = cc."customerId"
|
|
33597
|
+
WHERE c."userId" = $1`, [
|
|
33598
|
+
uid
|
|
33599
|
+
]);
|
|
33600
|
+
linkedCustomerContactIds = rows.map((row) => Number(row.id)).filter((id) => Number.isFinite(id) && id > 0);
|
|
33601
|
+
}
|
|
33561
33602
|
let order = await orderRepo().findOne({
|
|
33562
33603
|
where: {
|
|
33563
33604
|
id: orderId,
|
|
33564
|
-
contactId: contact.id,
|
|
33565
33605
|
deleted: false
|
|
33566
33606
|
},
|
|
33567
33607
|
relations: [
|
|
@@ -33574,13 +33614,20 @@ function createStorefrontApiHandler(config) {
|
|
|
33574
33614
|
}, {
|
|
33575
33615
|
status: 404
|
|
33576
33616
|
});
|
|
33617
|
+
const orderContactId = Number(order.contactId);
|
|
33618
|
+
const orderCustomerContactId = Number(order.customerContactId);
|
|
33619
|
+
const isOwner = Number.isFinite(orderContactId) && orderContactId > 0 && orderContactId === Number(contact.id) || Number.isFinite(orderCustomerContactId) && orderCustomerContactId > 0 && linkedCustomerContactIds.includes(orderCustomerContactId);
|
|
33620
|
+
if (!isOwner) return json({
|
|
33621
|
+
error: "Not found"
|
|
33622
|
+
}, {
|
|
33623
|
+
status: 404
|
|
33624
|
+
});
|
|
33577
33625
|
if (getCms) {
|
|
33578
33626
|
const cms = await getCms();
|
|
33579
33627
|
await tryRefreshOrderFromErpForStorefront(cms, dataSource, entityMap, order);
|
|
33580
33628
|
order = await orderRepo().findOne({
|
|
33581
33629
|
where: {
|
|
33582
33630
|
id: orderId,
|
|
33583
|
-
contactId: contact.id,
|
|
33584
33631
|
deleted: false
|
|
33585
33632
|
},
|
|
33586
33633
|
relations: [
|
|
@@ -33594,6 +33641,14 @@ function createStorefrontApiHandler(config) {
|
|
|
33594
33641
|
}, {
|
|
33595
33642
|
status: 404
|
|
33596
33643
|
});
|
|
33644
|
+
const refreshedOrderContactId = Number(order.contactId);
|
|
33645
|
+
const refreshedCustomerContactId = Number(order.customerContactId);
|
|
33646
|
+
const isOwnerAfterRefresh = Number.isFinite(refreshedOrderContactId) && refreshedOrderContactId > 0 && refreshedOrderContactId === Number(contact.id) || Number.isFinite(refreshedCustomerContactId) && refreshedCustomerContactId > 0 && linkedCustomerContactIds.includes(refreshedCustomerContactId);
|
|
33647
|
+
if (!isOwnerAfterRefresh) return json({
|
|
33648
|
+
error: "Not found"
|
|
33649
|
+
}, {
|
|
33650
|
+
status: 404
|
|
33651
|
+
});
|
|
33597
33652
|
const o = order;
|
|
33598
33653
|
const lines = (o.items || []).map((line) => {
|
|
33599
33654
|
const p = line.product;
|