blixify-ui-web 1.1.4 → 1.1.9
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/lib/components/chat/chatBase/index.d.ts +1 -0
- package/lib/components/chat/chatBase/index.d.ts.map +1 -1
- package/lib/components/chat/chatBase/index.js +20 -2
- package/lib/components/chat/chatBase/index.js.map +1 -1
- package/lib/components/chat/chatDashboard/index.d.ts +12 -1
- package/lib/components/chat/chatDashboard/index.d.ts.map +1 -1
- package/lib/components/chat/chatDashboard/index.js +92 -3
- package/lib/components/chat/chatDashboard/index.js.map +1 -1
- package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/index.js +113 -77
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/model.d.ts +1 -0
- package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
- package/lib/tail.css +1 -1
- package/package.json +1 -1
|
@@ -2991,13 +2991,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
2991
2991
|
});
|
|
2992
2992
|
}); };
|
|
2993
2993
|
var handleSubmitData = function (type, rowId, columnId, data, offlineId, isOfflineUpdate, isDraft) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2994
|
-
var selectedId_2, id, createSelectedData_1, uniqueDataStructure, uniqueColumnId, res, offlineDataResp, offlineData, tempData, err_19, offlineDataResp, tempData, selectedIndex_3, offlineData, err_20,
|
|
2994
|
+
var selectedId_2, id, createSelectedData_1, uniqueDataStructure, uniqueColumnId, res, offlineDataResp, offlineData, tempData, err_19, offlineDataResp, tempData, selectedIndex_3, offlineData, err_20, dataToSubmit_2, changedAttributeIds, operationType, selectedIndex_4, dataId, err_21;
|
|
2995
2995
|
var _a, _b;
|
|
2996
|
-
var _c, _d, _e, _f, _g, _h;
|
|
2997
|
-
return __generator(this, function (
|
|
2998
|
-
switch (
|
|
2996
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2997
|
+
return __generator(this, function (_o) {
|
|
2998
|
+
switch (_o.label) {
|
|
2999
2999
|
case 0:
|
|
3000
|
-
|
|
3000
|
+
_o.trys.push([0, 35, , 36]);
|
|
3001
3001
|
selectedId_2 = "";
|
|
3002
3002
|
if (type === "update")
|
|
3003
3003
|
selectedId_2 = rowId !== null && rowId !== void 0 ? rowId : "";
|
|
@@ -3027,8 +3027,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3027
3027
|
return [3 /*break*/, 3];
|
|
3028
3028
|
case 1: return [4 /*yield*/, handleUploadImage(id, data)];
|
|
3029
3029
|
case 2:
|
|
3030
|
-
createSelectedData_1 =
|
|
3031
|
-
|
|
3030
|
+
createSelectedData_1 = _o.sent();
|
|
3031
|
+
_o.label = 3;
|
|
3032
3032
|
case 3:
|
|
3033
3033
|
uniqueDataStructure = structure.filter(function (eachStructure) {
|
|
3034
3034
|
return eachStructure.unique;
|
|
@@ -3042,18 +3042,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3042
3042
|
});
|
|
3043
3043
|
}
|
|
3044
3044
|
res = "";
|
|
3045
|
-
if (!(selectedId_2 === "new")) return [3 /*break*/,
|
|
3045
|
+
if (!(selectedId_2 === "new")) return [3 /*break*/, 16];
|
|
3046
3046
|
if (!showId)
|
|
3047
3047
|
createSelectedData_1[serverId] = id;
|
|
3048
3048
|
if (isDraft)
|
|
3049
3049
|
createSelectedData_1["baseDraft"] = true;
|
|
3050
3050
|
if (!isOffline) return [3 /*break*/, 9];
|
|
3051
|
-
|
|
3051
|
+
_o.label = 4;
|
|
3052
3052
|
case 4:
|
|
3053
|
-
|
|
3053
|
+
_o.trys.push([4, 7, , 8]);
|
|
3054
3054
|
return [4 /*yield*/, indexedDb_1.indexedDb.getValue("local", props.collectionId)];
|
|
3055
3055
|
case 5:
|
|
3056
|
-
offlineDataResp =
|
|
3056
|
+
offlineDataResp = _o.sent();
|
|
3057
3057
|
offlineData = (_e = offlineDataResp === null || offlineDataResp === void 0 ? void 0 : offlineDataResp.data) !== null && _e !== void 0 ? _e : [];
|
|
3058
3058
|
tempData = (0, updateModule_1.handleParseOfflineWrite)(selectedData, structure);
|
|
3059
3059
|
offlineData.push(tempData);
|
|
@@ -3062,14 +3062,25 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3062
3062
|
type: props.collectionId,
|
|
3063
3063
|
})];
|
|
3064
3064
|
case 6:
|
|
3065
|
-
|
|
3065
|
+
_o.sent();
|
|
3066
3066
|
res = true;
|
|
3067
3067
|
return [3 /*break*/, 8];
|
|
3068
3068
|
case 7:
|
|
3069
|
-
err_19 =
|
|
3069
|
+
err_19 = _o.sent();
|
|
3070
3070
|
return [3 /*break*/, 8];
|
|
3071
|
-
case 8: return [3 /*break*/,
|
|
3071
|
+
case 8: return [3 /*break*/, 15];
|
|
3072
3072
|
case 9:
|
|
3073
|
+
if (!((idField && selectedData[idField]) ||
|
|
3074
|
+
((_f = props.bareSettings) === null || _f === void 0 ? void 0 : _f.bareUpsertPartialUpdate))) return [3 /*break*/, 11];
|
|
3075
|
+
return [4 /*yield*/, writeServerQuery.call("update", {
|
|
3076
|
+
id: id,
|
|
3077
|
+
data: createSelectedData_1,
|
|
3078
|
+
upsert: true,
|
|
3079
|
+
})];
|
|
3080
|
+
case 10:
|
|
3081
|
+
res = _o.sent();
|
|
3082
|
+
return [3 /*break*/, 15];
|
|
3083
|
+
case 11:
|
|
3073
3084
|
// INFO: stepper create guard — if a create is already in-flight, queue this
|
|
3074
3085
|
// draft save and return early. It will be replayed as an update once the
|
|
3075
3086
|
// in-flight create resolves.
|
|
@@ -3085,39 +3096,39 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3085
3096
|
data: createSelectedData_1,
|
|
3086
3097
|
unique: uniqueColumnId,
|
|
3087
3098
|
})];
|
|
3088
|
-
case
|
|
3099
|
+
case 12:
|
|
3089
3100
|
//INFO: [CREATE] Create new data
|
|
3090
|
-
res =
|
|
3091
|
-
if (!(selectedId_2 === "new")) return [3 /*break*/,
|
|
3101
|
+
res = _o.sent();
|
|
3102
|
+
if (!(selectedId_2 === "new")) return [3 /*break*/, 15];
|
|
3092
3103
|
isCreatingRef.current = false;
|
|
3093
|
-
if (!pendingDraftSaveRef.current) return [3 /*break*/,
|
|
3104
|
+
if (!pendingDraftSaveRef.current) return [3 /*break*/, 14];
|
|
3094
3105
|
pendingDraftSaveRef.current = false;
|
|
3095
3106
|
// INFO: replay as update — inflightIdRef.current holds the real _id
|
|
3096
3107
|
return [4 /*yield*/, writeServerQuery.call("update", {
|
|
3097
3108
|
id: inflightIdRef.current,
|
|
3098
3109
|
data: __assign(__assign({}, createSelectedData_1), { baseDraft: true }),
|
|
3099
3110
|
})];
|
|
3100
|
-
case
|
|
3111
|
+
case 13:
|
|
3101
3112
|
// INFO: replay as update — inflightIdRef.current holds the real _id
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
case 12:
|
|
3105
|
-
inflightIdRef.current = "";
|
|
3106
|
-
_j.label = 13;
|
|
3107
|
-
case 13: return [3 /*break*/, 22];
|
|
3113
|
+
_o.sent();
|
|
3114
|
+
_o.label = 14;
|
|
3108
3115
|
case 14:
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
case 15:
|
|
3113
|
-
_j.trys.push([15, 18, , 19]);
|
|
3114
|
-
return [4 /*yield*/, indexedDb_1.indexedDb.getValue("local", props.collectionId)];
|
|
3116
|
+
inflightIdRef.current = "";
|
|
3117
|
+
_o.label = 15;
|
|
3118
|
+
case 15: return [3 /*break*/, 24];
|
|
3115
3119
|
case 16:
|
|
3116
|
-
|
|
3120
|
+
if (!selectedId_2) return [3 /*break*/, 24];
|
|
3121
|
+
if (!(isOffline && !offlineId)) return [3 /*break*/, 22];
|
|
3122
|
+
_o.label = 17;
|
|
3123
|
+
case 17:
|
|
3124
|
+
_o.trys.push([17, 20, , 21]);
|
|
3125
|
+
return [4 /*yield*/, indexedDb_1.indexedDb.getValue("local", props.collectionId)];
|
|
3126
|
+
case 18:
|
|
3127
|
+
offlineDataResp = _o.sent();
|
|
3117
3128
|
tempData = (0, updateModule_1.handleParseOfflineWrite)(selectedData, structure);
|
|
3118
3129
|
tempData[serverId] = selectedId_2;
|
|
3119
3130
|
selectedIndex_3 = -1;
|
|
3120
|
-
offlineData = (
|
|
3131
|
+
offlineData = (_g = offlineDataResp === null || offlineDataResp === void 0 ? void 0 : offlineDataResp.data) !== null && _g !== void 0 ? _g : [];
|
|
3121
3132
|
offlineData.map(function (eachOfflineData, index) {
|
|
3122
3133
|
var offlineDataId = eachOfflineData[serverId];
|
|
3123
3134
|
if (selectedId_2 === offlineDataId)
|
|
@@ -3130,27 +3141,43 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3130
3141
|
data: offlineData,
|
|
3131
3142
|
type: props.collectionId,
|
|
3132
3143
|
})];
|
|
3133
|
-
case
|
|
3134
|
-
|
|
3144
|
+
case 19:
|
|
3145
|
+
_o.sent();
|
|
3135
3146
|
res = true;
|
|
3136
|
-
return [3 /*break*/,
|
|
3137
|
-
case 18:
|
|
3138
|
-
err_20 = _j.sent();
|
|
3139
|
-
return [3 /*break*/, 19];
|
|
3140
|
-
case 19: return [3 /*break*/, 22];
|
|
3147
|
+
return [3 /*break*/, 21];
|
|
3141
3148
|
case 20:
|
|
3142
|
-
|
|
3149
|
+
err_20 = _o.sent();
|
|
3150
|
+
return [3 /*break*/, 21];
|
|
3151
|
+
case 21: return [3 /*break*/, 24];
|
|
3152
|
+
case 22:
|
|
3143
3153
|
if (type === "update" && columnId) {
|
|
3144
|
-
|
|
3154
|
+
dataToSubmit_2 = (_a = {},
|
|
3145
3155
|
_a[columnId] = createSelectedData_1[columnId],
|
|
3146
3156
|
_a);
|
|
3147
3157
|
}
|
|
3158
|
+
else if ((_h = props.bareSettings) === null || _h === void 0 ? void 0 : _h.bareUpsertPartialUpdate) {
|
|
3159
|
+
changedAttributeIds = (0, updateModule_1.compareUpdatedFields)((_j = previousSelectedData.current) !== null && _j !== void 0 ? _j : {}, createSelectedData_1).changedAttributeIds;
|
|
3160
|
+
// INFO: if nothing changed, skip the write entirely — sending an
|
|
3161
|
+
// empty payload would be a no-op at best and an error at worst.
|
|
3162
|
+
if (changedAttributeIds.length === 0)
|
|
3163
|
+
return [2 /*return*/, id];
|
|
3164
|
+
dataToSubmit_2 = {};
|
|
3165
|
+
changedAttributeIds.forEach(function (key) {
|
|
3166
|
+
dataToSubmit_2[key] = createSelectedData_1[key];
|
|
3167
|
+
});
|
|
3168
|
+
if (isDraft)
|
|
3169
|
+
dataToSubmit_2["baseDraft"] = true;
|
|
3170
|
+
else
|
|
3171
|
+
dataToSubmit_2["baseDraft"] = false; // INFO: clear draft flag on final save
|
|
3172
|
+
if (offlineId)
|
|
3173
|
+
dataToSubmit_2[serverId] = offlineId;
|
|
3174
|
+
}
|
|
3148
3175
|
else {
|
|
3149
|
-
|
|
3176
|
+
dataToSubmit_2 = __assign(__assign({}, createSelectedData_1), { baseDraft: false });
|
|
3150
3177
|
if (isDraft)
|
|
3151
|
-
|
|
3178
|
+
dataToSubmit_2["baseDraft"] = true;
|
|
3152
3179
|
if (offlineId)
|
|
3153
|
-
|
|
3180
|
+
dataToSubmit_2[serverId] = offlineId;
|
|
3154
3181
|
}
|
|
3155
3182
|
operationType = isOfflineUpdate
|
|
3156
3183
|
? "update"
|
|
@@ -3159,17 +3186,26 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3159
3186
|
: "update";
|
|
3160
3187
|
return [4 /*yield*/, writeServerQuery.call(operationType, {
|
|
3161
3188
|
id: selectedId_2,
|
|
3162
|
-
data:
|
|
3189
|
+
data: dataToSubmit_2,
|
|
3163
3190
|
unique: uniqueColumnId,
|
|
3191
|
+
// INFO: bareUpsertPartialUpdate — upsert so the doc is created if it
|
|
3192
|
+
// doesn't exist yet (covers deterministicId passed directly as props.id).
|
|
3193
|
+
// Scoped away from offline paths: offlineId uses operationType="create"
|
|
3194
|
+
// and isOfflineUpdate is a separate flow — upsert is not meaningful there.
|
|
3195
|
+
upsert: ((_k = props.bareSettings) === null || _k === void 0 ? void 0 : _k.bareUpsertPartialUpdate) &&
|
|
3196
|
+
!offlineId &&
|
|
3197
|
+
!isOfflineUpdate
|
|
3198
|
+
? true
|
|
3199
|
+
: undefined,
|
|
3164
3200
|
})];
|
|
3165
|
-
case
|
|
3166
|
-
res =
|
|
3167
|
-
|
|
3168
|
-
case
|
|
3169
|
-
if (!(type === "update" || type === "create")) return [3 /*break*/,
|
|
3170
|
-
if (!res) return [3 /*break*/,
|
|
3171
|
-
if (!(type === "update")) return [3 /*break*/,
|
|
3172
|
-
if (!columnId) return [3 /*break*/,
|
|
3201
|
+
case 23:
|
|
3202
|
+
res = _o.sent();
|
|
3203
|
+
_o.label = 24;
|
|
3204
|
+
case 24:
|
|
3205
|
+
if (!(type === "update" || type === "create")) return [3 /*break*/, 32];
|
|
3206
|
+
if (!res) return [3 /*break*/, 31];
|
|
3207
|
+
if (!(type === "update")) return [3 /*break*/, 27];
|
|
3208
|
+
if (!columnId) return [3 /*break*/, 26];
|
|
3173
3209
|
selectedIndex_4 = -1;
|
|
3174
3210
|
tableData.map(function (eachData, index) {
|
|
3175
3211
|
if (eachData.id === rowId || eachData._id === rowId) {
|
|
@@ -3179,26 +3215,26 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3179
3215
|
return null;
|
|
3180
3216
|
});
|
|
3181
3217
|
return [4 /*yield*/, handleGetListData({ data: tableData[selectedIndex_4] }, "update", rowId)];
|
|
3182
|
-
case
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
case
|
|
3186
|
-
case
|
|
3187
|
-
case 26:
|
|
3188
|
-
_j.sent();
|
|
3189
|
-
_j.label = 27;
|
|
3190
|
-
case 27:
|
|
3191
|
-
if (!((_g = props.bareSettings) === null || _g === void 0 ? void 0 : _g.bareUpdateHandlePostComplete)) return [3 /*break*/, 29];
|
|
3192
|
-
return [4 /*yield*/, props.bareSettings.bareUpdateHandlePostComplete(__assign((_b = {}, _b[serverId] = id, _b), createSelectedData_1))];
|
|
3218
|
+
case 25:
|
|
3219
|
+
_o.sent();
|
|
3220
|
+
_o.label = 26;
|
|
3221
|
+
case 26: return [3 /*break*/, 29];
|
|
3222
|
+
case 27: return [4 /*yield*/, handleGetListData({ data: [createSelectedData_1] }, "create")];
|
|
3193
3223
|
case 28:
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
case 29:
|
|
3224
|
+
_o.sent();
|
|
3225
|
+
_o.label = 29;
|
|
3226
|
+
case 29:
|
|
3227
|
+
if (!((_l = props.bareSettings) === null || _l === void 0 ? void 0 : _l.bareUpdateHandlePostComplete)) return [3 /*break*/, 31];
|
|
3228
|
+
return [4 /*yield*/, props.bareSettings.bareUpdateHandlePostComplete(__assign((_b = {}, _b[serverId] = id, _b), createSelectedData_1))];
|
|
3197
3229
|
case 30:
|
|
3230
|
+
_o.sent();
|
|
3231
|
+
_o.label = 31;
|
|
3232
|
+
case 31: return [3 /*break*/, 34];
|
|
3233
|
+
case 32:
|
|
3198
3234
|
createSelectedData_1[serverId] = id;
|
|
3199
3235
|
return [4 /*yield*/, handleGetListData({ data: [createSelectedData_1] }, selectedId_2 === "new" ? "create" : "update", id)];
|
|
3200
|
-
case
|
|
3201
|
-
|
|
3236
|
+
case 33:
|
|
3237
|
+
_o.sent();
|
|
3202
3238
|
setNotification({
|
|
3203
3239
|
type: true,
|
|
3204
3240
|
title: props.id === "new"
|
|
@@ -3208,12 +3244,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3208
3244
|
? "Data sucessfully created"
|
|
3209
3245
|
: "Data sucessfully updated",
|
|
3210
3246
|
});
|
|
3211
|
-
|
|
3212
|
-
case
|
|
3247
|
+
_o.label = 34;
|
|
3248
|
+
case 34:
|
|
3213
3249
|
dataId = res ? id : "";
|
|
3214
3250
|
return [2 /*return*/, dataId];
|
|
3215
|
-
case
|
|
3216
|
-
err_21 =
|
|
3251
|
+
case 35:
|
|
3252
|
+
err_21 = _o.sent();
|
|
3217
3253
|
console.log("error", err_21);
|
|
3218
3254
|
// INFO: clear in-flight guard on failure so the next save retries as a create
|
|
3219
3255
|
if (isCreatingRef.current) {
|
|
@@ -3222,7 +3258,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3222
3258
|
inflightIdRef.current = "";
|
|
3223
3259
|
}
|
|
3224
3260
|
if (err_21.response && err_21.response.status === 400) {
|
|
3225
|
-
if (typeof ((
|
|
3261
|
+
if (typeof ((_m = err_21.response.data) === null || _m === void 0 ? void 0 : _m.err) === "string")
|
|
3226
3262
|
setNotification({
|
|
3227
3263
|
type: false,
|
|
3228
3264
|
title: "Error",
|
|
@@ -3235,8 +3271,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3235
3271
|
msg: "Please contact our administrator for assistance or try your request again later. We apologize for any inconvenience",
|
|
3236
3272
|
});
|
|
3237
3273
|
}
|
|
3238
|
-
return [3 /*break*/,
|
|
3239
|
-
case
|
|
3274
|
+
return [3 /*break*/, 36];
|
|
3275
|
+
case 36: return [2 /*return*/];
|
|
3240
3276
|
}
|
|
3241
3277
|
});
|
|
3242
3278
|
}); };
|