@pxp-nd/flow 1.0.91 → 1.0.93

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.
@@ -187,6 +187,12 @@ let Flow = class Flow extends core_1.Controller {
187
187
  if (dataFlow.status == 'on') {
188
188
  throw new core_1.PxpError(400, 'Your flow is on. It is not possible to change the name');
189
189
  }
190
+ if (dataFlow.type == 'template') {
191
+ dataFlow.code = params.code;
192
+ dataFlow.description = params.description;
193
+ dataFlow.icon = params.icon;
194
+ dataFlow.flowType = params.flowType;
195
+ }
190
196
  dataFlow.name = params.name;
191
197
  dataFlow.modifiedAt = new Date();
192
198
  dataFlow.modifiedBy = this.user.username;
@@ -211,11 +217,14 @@ let Flow = class Flow extends core_1.Controller {
211
217
  let flowDataClone;
212
218
  //if we have a vendoId as parameter the origin is a template
213
219
  if (params.vendorId) {
220
+ console.log("con vendor:", flowToClone);
214
221
  flowDataClone = await manager.save(Flow_1.default, { ...flowToClone, name: `${params.name}`, vendorId: params.vendorId, type: 'custom' });
215
222
  }
216
223
  else {
224
+ console.log("sin vendore:", flowToClone);
217
225
  flowDataClone = await manager.save(Flow_1.default, { ...flowToClone, name: `${flowData.name} Copy` });
218
226
  }
227
+ console.log("el clonado:::", flowDataClone);
219
228
  const dataNode = await Node_1.default.findOne({ where: { flowId: params.flowId, isInit: 'Y', isActive: true }, order: { nodeId: "ASC" } });
220
229
  dataNode && await this.copyNode(dataNode, flowDataClone.flowId, manager, true);
221
230
  return { success: true, flowId: flowDataClone.flowId };
@@ -380,7 +389,12 @@ let Flow = class Flow extends core_1.Controller {
380
389
  .getOne();
381
390
  let cond = " and 0=0";
382
391
  if (!totalNodes) {
383
- cond = " and at.name= 'EVENT' ";
392
+ if (flow.templateType == 'funnel') {
393
+ cond = " and a.name='Opt-In Page' ";
394
+ }
395
+ else {
396
+ cond = " and at.name= 'EVENT' ";
397
+ }
384
398
  }
385
399
  else {
386
400
  const oName = (_a = totalNodes === null || totalNodes === void 0 ? void 0 : totalNodes.action) === null || _a === void 0 ? void 0 : _a.originName;
@@ -391,6 +405,7 @@ let Flow = class Flow extends core_1.Controller {
391
405
  cond = `and (at.name != 'EVENT' and at.name!='PAGE') and (a.originName is null or a.originName = '${oName}')`;
392
406
  }
393
407
  }
408
+ console.log("condicion es:", cond);
394
409
  let actions = await (0, typeorm_1.getManager)()
395
410
  .createQueryBuilder(Action_1.default, "a")
396
411
  .select([
@@ -404,6 +419,7 @@ let Flow = class Flow extends core_1.Controller {
404
419
  .innerJoin("a.actionType", "at")
405
420
  .where(`a.isActive = 1 and a.hidden = 'N'` + cond)
406
421
  .getMany();
422
+ console.log("actions:", actions);
407
423
  const connections = await (0, typeorm_1.getManager)()
408
424
  .createQueryBuilder(NodeConnection_1.default, "nc")
409
425
  .select([
@@ -4,7 +4,7 @@ import { PxpEntity } from '@pxp-nd/common';
4
4
  export default class Flow extends PxpEntity {
5
5
  flowId: number;
6
6
  vendorId: number;
7
- code: number;
7
+ code: string;
8
8
  name: string;
9
9
  description: string;
10
10
  enabled: string;
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
24
24
  * ----------- ----------- -------------- ------------------------------------
25
25
  * 04-Sep-2023 SP08SEP23 Rensi Arteaga add modified at and by
26
26
  * 06-Dec-2024 8001237262 Mercedes Zambrana add flow_type
27
+ * 31-Jan-2025 8035304698 Mercedes Zambrana Change code to string
27
28
  ****************************************************************************/
28
29
  const typeorm_1 = require("typeorm");
29
30
  const FlowInstance_1 = __importDefault(require("./FlowInstance"));
@@ -40,8 +41,8 @@ __decorate([
40
41
  __metadata("design:type", Number)
41
42
  ], Flow.prototype, "vendorId", void 0);
42
43
  __decorate([
43
- (0, typeorm_1.Column)({ type: 'int', nullable: false }),
44
- __metadata("design:type", Number)
44
+ (0, typeorm_1.Column)({ type: 'varchar', nullable: false, length: 20 }),
45
+ __metadata("design:type", String)
45
46
  ], Flow.prototype, "code", void 0);
46
47
  __decorate([
47
48
  (0, typeorm_1.Column)({ type: 'varchar', nullable: false, length: 100 }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxp-nd/flow",
3
- "version": "1.0.91",
3
+ "version": "1.0.93",
4
4
  "description": "Workflow module for pxp-nd framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",