@redonvn/zalo-ads-sdk 0.2.18 → 0.2.19

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/index.mjs CHANGED
@@ -6350,6 +6350,127 @@ function validateSearchInstantPagesRequest(input) {
6350
6350
  data: errors.length === 0 ? data : void 0
6351
6351
  };
6352
6352
  }
6353
+ function sanitizeCanvasKeys(data) {
6354
+ const cleanData = {};
6355
+ for (const [key, value] of Object.entries(data)) {
6356
+ const cleanKey = key.replace(/^["']+|["']+$/g, "").trim();
6357
+ if (value && typeof value === "object" && !Array.isArray(value)) {
6358
+ const valObj = value;
6359
+ const sanitizedSub = { ...valObj };
6360
+ if (sanitizedSub.images && typeof sanitizedSub.images === "object" && !Array.isArray(sanitizedSub.images)) {
6361
+ sanitizedSub.images = sanitizeCanvasKeys(sanitizedSub.images);
6362
+ }
6363
+ if (sanitizedSub.videos && typeof sanitizedSub.videos === "object" && !Array.isArray(sanitizedSub.videos)) {
6364
+ sanitizedSub.videos = sanitizeCanvasKeys(sanitizedSub.videos);
6365
+ }
6366
+ cleanData[cleanKey] = sanitizedSub;
6367
+ } else {
6368
+ cleanData[cleanKey] = value;
6369
+ }
6370
+ }
6371
+ return cleanData;
6372
+ }
6373
+ function validateInstantPageCanvas(input, isPublishing = false) {
6374
+ const errors = [];
6375
+ if (!input) {
6376
+ return { isValid: false, errors: ["Canvas Instant Page kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng."] };
6377
+ }
6378
+ let canvasObj;
6379
+ if (typeof input === "string") {
6380
+ if (input.trim() === "") {
6381
+ return { isValid: false, errors: ["Chu\u1ED7i Canvas JSON kh\xF4ng \u0111\u01B0\u1EE3c r\u1ED7ng."] };
6382
+ }
6383
+ try {
6384
+ canvasObj = JSON.parse(input);
6385
+ } catch (e) {
6386
+ return { isValid: false, errors: [`Canvas JSON kh\xF4ng h\u1EE3p l\u1EC7: ${e.message}`] };
6387
+ }
6388
+ } else if (typeof input === "object" && input !== null) {
6389
+ canvasObj = input;
6390
+ } else {
6391
+ return { isValid: false, errors: ["Canvas ph\u1EA3i l\xE0 \u0111\u1ED1i t\u01B0\u1EE3ng (Object) ho\u1EB7c chu\u1ED7i JSON h\u1EE3p l\u1EC7."] };
6392
+ }
6393
+ if (!canvasObj.renderList || !Array.isArray(canvasObj.renderList)) {
6394
+ errors.push("Canvas b\u1EAFt bu\u1ED9c ph\u1EA3i c\xF3 m\u1EA3ng 'renderList' \u0111\u1ECBnh ngh\u0129a th\u1EE9 t\u1EF1 hi\u1EC3n th\u1ECB c\xE1c kh\u1ED1i giao di\u1EC7n (v\xED d\u1EE5: ['0', '1', '2']). Kh\xF4ng \u0111\u01B0\u1EE3c d\xF9ng { blocks: [] }.");
6395
+ } else if (canvasObj.renderList.length === 0) {
6396
+ errors.push("M\u1EA3ng 'renderList' kh\xF4ng \u0111\u01B0\u1EE3c r\u1ED7ng, ph\u1EA3i ch\u1EE9a \xEDt nh\u1EA5t 1 ID kh\u1ED1i giao di\u1EC7n.");
6397
+ }
6398
+ if (!canvasObj.data || typeof canvasObj.data !== "object" || Array.isArray(canvasObj.data)) {
6399
+ errors.push("Canvas b\u1EAFt bu\u1ED9c ph\u1EA3i c\xF3 \u0111\u1ED1i t\u01B0\u1EE3ng 'data' ch\u1EE9a c\u1EA5u h\xECnh chi ti\u1EBFt c\u1EE7a t\u1EEBng kh\u1ED1i giao di\u1EC7n.");
6400
+ }
6401
+ if (errors.length > 0) {
6402
+ return { isValid: false, errors };
6403
+ }
6404
+ const renderList = canvasObj.renderList.map(
6405
+ (id) => String(id).replace(/^["']+|["']+$/g, "").trim()
6406
+ );
6407
+ const rawData = canvasObj.data;
6408
+ const cleanData = sanitizeCanvasKeys(rawData);
6409
+ for (const blockId of renderList) {
6410
+ if (!(blockId in cleanData)) {
6411
+ errors.push(`Kh\u1ED1i ID '${blockId}' c\xF3 trong 'renderList' nh\u01B0ng kh\xF4ng t\u1ED3n t\u1EA1i trong t\u1EEB \u0111i\u1EC3n 'data'.`);
6412
+ } else {
6413
+ const block = cleanData[blockId];
6414
+ if (!block || typeof block !== "object") {
6415
+ errors.push(`Kh\u1ED1i d\u1EEF li\u1EC7u data['${blockId}'] ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng.`);
6416
+ } else if (block.type === void 0 || typeof block.type !== "number") {
6417
+ errors.push(`Kh\u1ED1i data['${blockId}'] b\u1EAFt bu\u1ED9c ph\u1EA3i c\xF3 tr\u01B0\u1EDDng 'type' l\xE0 m\xE3 s\u1ED1 nguy\xEAn (Block Type).`);
6418
+ }
6419
+ }
6420
+ }
6421
+ if (isPublishing) {
6422
+ for (const blockId of renderList) {
6423
+ const block = cleanData[blockId];
6424
+ if (!block) continue;
6425
+ if (block.type === 28) {
6426
+ const name = typeof block.name === "string" ? block.name.trim() : "";
6427
+ if (name.length < 2 || name.length > 30) {
6428
+ errors.push(`Kh\u1ED1i Th\xF4ng tin Mini Shop (ID: '${blockId}'): T\xEAn Mini Shop ('name') ph\u1EA3i t\u1EEB 2 \u0111\u1EBFn 30 k\xFD t\u1EF1.`);
6429
+ }
6430
+ const img = block.image;
6431
+ if (!img || typeof img.url !== "string" || !img.url.startsWith("http")) {
6432
+ errors.push(`Kh\u1ED1i Th\xF4ng tin Mini Shop (ID: '${blockId}'): B\u1EAFt bu\u1ED9c ph\u1EA3i c\xF3 \u1EA3nh logo v\u1EDBi URL h\u1EE3p l\u1EC7 ('image.url').`);
6433
+ }
6434
+ }
6435
+ if (block.type === 29) {
6436
+ const len = typeof block.length === "number" ? block.length : 0;
6437
+ const html = typeof block.outputHtml === "string" ? block.outputHtml.trim() : "";
6438
+ if (len === 0 && html === "") {
6439
+ errors.push(`Kh\u1ED1i M\xF4 t\u1EA3 (ID: '${blockId}'): Kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng n\u1ED9i dung m\xF4 t\u1EA3.`);
6440
+ }
6441
+ }
6442
+ if (block.type === 1) {
6443
+ const indexes = Array.isArray(block.indexes) ? block.indexes : [];
6444
+ const images = block.images && typeof block.images === "object" ? block.images : {};
6445
+ for (const idx of indexes) {
6446
+ const img = images[String(idx)];
6447
+ if (img && typeof img.url === "string" && img.url.trim() === "") {
6448
+ errors.push(`Kh\u1ED1i Carousel (ID: '${blockId}'): \u1EA2nh t\u1EA1i ch\u1EC9 m\u1EE5c '${idx}' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 URL r\u1ED7ng.`);
6449
+ }
6450
+ }
6451
+ }
6452
+ if (block.type === 21) {
6453
+ const msg = typeof block.content === "string" ? block.content.trim() : "";
6454
+ if (msg.length === 0 || msg.length > 40) {
6455
+ errors.push(`Kh\u1ED1i Tin nh\u1EAFn m\u1EB7c \u0111\u1ECBnh (ID: '${blockId}'): N\u1ED9i dung tin nh\u1EAFn ph\u1EA3i t\u1EEB 1 \u0111\u1EBFn 40 k\xFD t\u1EF1.`);
6456
+ }
6457
+ }
6458
+ }
6459
+ }
6460
+ const resultCanvas = {
6461
+ version: typeof canvasObj.version === "number" || typeof canvasObj.version === "string" ? canvasObj.version : "1",
6462
+ renderList,
6463
+ data: cleanData,
6464
+ ...canvasObj.freezedTop !== void 0 ? { freezedTop: Number(canvasObj.freezedTop) } : {},
6465
+ ...canvasObj.freezedBottom !== void 0 ? { freezedBottom: Number(canvasObj.freezedBottom) } : {},
6466
+ ...canvasObj.pageTitle !== void 0 ? { pageTitle: String(canvasObj.pageTitle) } : {}
6467
+ };
6468
+ return {
6469
+ isValid: errors.length === 0,
6470
+ errors,
6471
+ data: errors.length === 0 ? resultCanvas : void 0
6472
+ };
6473
+ }
6353
6474
  function validateUpdateInstantPageRequest(input) {
6354
6475
  const errors = [];
6355
6476
  if (!input || typeof input !== "object") {
@@ -6388,40 +6509,42 @@ function validateUpdateInstantPageRequest(input) {
6388
6509
  data.active = obj.active;
6389
6510
  }
6390
6511
  }
6512
+ let isPublishing = false;
6391
6513
  if (obj.status !== void 0 && obj.status !== null) {
6392
6514
  const st = Number(obj.status);
6393
6515
  if (![0, 1, 2, 3].includes(st)) {
6394
6516
  errors.push("Tr\u01B0\u1EDDng 'status' ph\u1EA3i l\xE0 m\u1ED9t trong c\xE1c m\xE3: 0 (B\u1EA3n sao m\u1EDBi t\u1EA1o ch\u01B0a l\u01B0u), 1 (\u0110ang ho\u1EA1t \u0111\u1ED9ng / \u0110\xE3 xu\u1EA5t b\u1EA3n), 3 (\u0110\xE3 k\u1EBFt th\xFAc / L\u01B0u tr\u1EEF).");
6395
6517
  } else {
6396
6518
  data.status = st;
6519
+ if (st === 1) isPublishing = true;
6397
6520
  }
6398
6521
  }
6522
+ let validatedDraftCanvas;
6399
6523
  if (obj.draft !== void 0 && obj.draft !== null) {
6400
- if (typeof obj.draft !== "string") {
6401
- errors.push("Tr\u01B0\u1EDDng 'draft' ph\u1EA3i l\xE0 chu\u1ED7i JSON (JSON-encoded string).");
6402
- } else if (obj.draft.trim() !== "") {
6403
- try {
6404
- JSON.parse(obj.draft);
6405
- data.draft = obj.draft;
6406
- } catch (err) {
6407
- errors.push(`Tr\u01B0\u1EDDng 'draft' kh\xF4ng ph\u1EA3i l\xE0 chu\u1ED7i JSON h\u1EE3p l\u1EC7: ${err.message}`);
6408
- }
6524
+ const canvasRes = validateInstantPageCanvas(obj.draft, isPublishing);
6525
+ if (!canvasRes.isValid) {
6526
+ errors.push(...canvasRes.errors.map((err) => `[draft] ${err}`));
6409
6527
  } else {
6410
- data.draft = "";
6528
+ validatedDraftCanvas = canvasRes.data;
6529
+ data.draft = JSON.stringify(canvasRes.data);
6411
6530
  }
6412
6531
  }
6532
+ let validatedContentCanvas;
6413
6533
  if (obj.content !== void 0 && obj.content !== null) {
6414
- if (typeof obj.content !== "string") {
6415
- errors.push("Tr\u01B0\u1EDDng 'content' ph\u1EA3i l\xE0 chu\u1ED7i JSON (JSON-encoded string).");
6416
- } else if (obj.content.trim() !== "") {
6417
- try {
6418
- JSON.parse(obj.content);
6419
- data.content = obj.content;
6420
- } catch (err) {
6421
- errors.push(`Tr\u01B0\u1EDDng 'content' kh\xF4ng ph\u1EA3i l\xE0 chu\u1ED7i JSON h\u1EE3p l\u1EC7: ${err.message}`);
6422
- }
6534
+ const canvasRes = validateInstantPageCanvas(obj.content, isPublishing);
6535
+ if (!canvasRes.isValid) {
6536
+ errors.push(...canvasRes.errors.map((err) => `[content] ${err}`));
6423
6537
  } else {
6424
- data.content = "";
6538
+ validatedContentCanvas = canvasRes.data;
6539
+ data.content = JSON.stringify(canvasRes.data);
6540
+ }
6541
+ }
6542
+ if (isPublishing) {
6543
+ if (data.draft && !data.content) {
6544
+ data.content = data.draft;
6545
+ } else if (data.content && !data.draft) {
6546
+ data.draft = data.content;
6547
+ } else if (!data.draft && !data.content) {
6425
6548
  }
6426
6549
  }
6427
6550
  const hasUpdateField = data.name !== void 0 || data.oaId !== void 0 || data.active !== void 0 || data.status !== void 0 || data.draft !== void 0 || data.content !== void 0;
@@ -7432,6 +7555,8 @@ var ZaloInstantPageBlockType = /* @__PURE__ */ ((ZaloInstantPageBlockType2) => {
7432
7555
  ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CALL_HOTLINE_BUTTON"] = 23] = "CALL_HOTLINE_BUTTON";
7433
7556
  ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["KEY_VALUE_TABLE"] = 25] = "KEY_VALUE_TABLE";
7434
7557
  ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CONSENT_NOTICE"] = 27] = "CONSENT_NOTICE";
7558
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["SHOP_INFO"] = 28] = "SHOP_INFO";
7559
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["SHOP_DESCRIPTION"] = 29] = "SHOP_DESCRIPTION";
7435
7560
  return ZaloInstantPageBlockType2;
7436
7561
  })(ZaloInstantPageBlockType || {});
7437
7562
  var ZaloInstantPageSharePermission = {
@@ -7445,6 +7570,399 @@ var ZaloInstantPageSharePermission = {
7445
7570
  READ_ONLY: 4
7446
7571
  };
7447
7572
 
7573
+ // src/helpers/instant-page-factory.ts
7574
+ var InstantPageFactory = class {
7575
+ /**
7576
+ * Khởi tạo Canvas hoàn chỉnh từ Template ID (1, 3, 4, 5) được điền sẵn dữ liệu hợp lệ.
7577
+ */
7578
+ static createFromTemplate(templateId, options = {}) {
7579
+ const brandName = options.brandName || "RedAI Official Store";
7580
+ const brandLogoUrl = options.brandLogoUrl || "https://adtima-media.zascdn.me/2023/10/58117541-e206-4f9d-b4cf-69e50f963288.svg";
7581
+ const productName = options.productName || "S\u1EA3n ph\u1EA9m / D\u1ECBch v\u1EE5 \u0110\u1ED9t ph\xE1 2026";
7582
+ const price = options.price ?? 299e3;
7583
+ const rawPrice = options.rawPrice ?? 499e3;
7584
+ const defaultMsg = options.defaultMessage || "T\xF4i mu\u1ED1n t\xECm hi\u1EC3u th\xEAm v\u1EC1 s\u1EA3n ph\u1EA9m n\xE0y";
7585
+ const defaultImages = [
7586
+ "https://adtima-media.zascdn.me/2023/06/84cba4c9-be13-425a-8daa-40e695ca9805.jpg",
7587
+ "https://adtima-media.zascdn.me/2023/06/805587cd-4699-47e6-a9bb-3cbbb4039b40.jpg",
7588
+ "https://adtima-media.zascdn.me/2023/06/aca98d2c-1739-4f03-a366-43a6d6c4ef53.jpg",
7589
+ "https://adtima-media.zascdn.me/2023/06/8cc5692b-2899-4862-9957-d3f66e8778cd.jpg"
7590
+ ];
7591
+ switch (templateId) {
7592
+ case 5: {
7593
+ const carouselImgs = options.carouselImages && options.carouselImages.length > 0 ? options.carouselImages : defaultImages.map((url, i) => ({ url, name: `image-${i + 1}.jpg` }));
7594
+ const indexes = carouselImgs.map((_, i) => String(i));
7595
+ const imagesMap = {};
7596
+ carouselImgs.forEach((img, i) => {
7597
+ imagesMap[String(i)] = {
7598
+ name: img.name || `image-${i + 1}.jpg`,
7599
+ url: img.url
7600
+ };
7601
+ });
7602
+ const descText = options.description || "H\u1EC7 sinh th\xE1i c\xF4ng ngh\u1EC7 t\u1EF1 \u0111\u1ED9ng h\xF3a RedAI. T\xEDch h\u1EE3p \u0111a k\xEAnh Zalo OA, Website & CRM; h\u1ED7 tr\u1EE3 t\u1EF1 \u0111\u1ED9ng ph\u1EA3n h\u1ED3i v\xE0 ch\u1ED1t \u0111\u01A1n 24/7.";
7603
+ return {
7604
+ version: 1,
7605
+ renderList: ["1", "2", "3", "4"],
7606
+ freezedBottom: 4,
7607
+ pageTitle: "Chi ti\u1EBFt",
7608
+ data: {
7609
+ "1": {
7610
+ id: "-1",
7611
+ type: 28,
7612
+ name: brandName,
7613
+ image: {
7614
+ name: "logo.png",
7615
+ url: brandLogoUrl
7616
+ }
7617
+ },
7618
+ "2": {
7619
+ id: "-1",
7620
+ type: 29,
7621
+ delta: {
7622
+ ops: [
7623
+ { attributes: { bold: true, size: "18px" }, insert: `${brandName}
7624
+ ` },
7625
+ { insert: `
7626
+ ${descText}
7627
+ ` }
7628
+ ]
7629
+ },
7630
+ outputHtml: `<p><strong style="font-size: 18px;">${brandName}</strong></p><p><br>${descText}</p>`,
7631
+ length: brandName.length + descText.length + 10
7632
+ },
7633
+ "3": {
7634
+ id: "-1",
7635
+ type: 1,
7636
+ indexes,
7637
+ images: imagesMap,
7638
+ videos: {
7639
+ "0": { name: "", thumbnail: "", url: "" }
7640
+ }
7641
+ },
7642
+ "4": {
7643
+ id: "-1",
7644
+ type: 21,
7645
+ content: defaultMsg,
7646
+ marginTop: 0,
7647
+ marginBottom: 0
7648
+ }
7649
+ }
7650
+ };
7651
+ }
7652
+ case 4: {
7653
+ return {
7654
+ version: 4,
7655
+ renderList: ["1", "2", "3"],
7656
+ freezedBottom: 3,
7657
+ data: {
7658
+ "1": {
7659
+ id: "-1",
7660
+ indexes: ["0", "1", "2"],
7661
+ images: {
7662
+ "1": { name: "banner-1.jpg", url: defaultImages[0] },
7663
+ "2": { name: "banner-2.jpg", url: defaultImages[1] }
7664
+ },
7665
+ textEditor: {
7666
+ delta: {
7667
+ ops: [
7668
+ { attributes: { bold: true }, insert: `Ch\xE0o m\u1EEBng b\u1EA1n \u0111\u1EBFn v\u1EDBi ${brandName}` },
7669
+ { insert: "\n\nB\u1EA1n \u0111ang quan t\xE2m gi\u1EA3i ph\xE1p n\xE0o \u0111\u1EC3 chuy\xEAn vi\xEAn h\u1ED7 tr\u1EE3 ngay?\n\n" }
7670
+ ]
7671
+ },
7672
+ outputHtml: `<p><strong>Ch\xE0o m\u1EEBng b\u1EA1n \u0111\u1EBFn v\u1EDBi ${brandName}</strong></p><p><br></p><p>B\u1EA1n \u0111ang quan t\xE2m gi\u1EA3i ph\xE1p n\xE0o \u0111\u1EC3 chuy\xEAn vi\xEAn h\u1ED7 tr\u1EE3 ngay?</p>`
7673
+ },
7674
+ type: 1,
7675
+ videos: {
7676
+ "0": { name: "", thumbnail: "", url: "" }
7677
+ }
7678
+ },
7679
+ "2": {
7680
+ rows: [{ id: 0, left: "\u01AFu \u0111\xE3i tr\u1EA3i nghi\u1EC7m", right: "D\xF9ng th\u1EED mi\u1EC5n ph\xED" }],
7681
+ type: 25
7682
+ },
7683
+ "3": {
7684
+ list: [
7685
+ "T\u01B0 v\u1EA5n gi\u1EA3i ph\xE1p t\u1EF1 \u0111\u1ED9ng h\xF3a",
7686
+ "B\xE1o gi\xE1 chi ti\u1EBFt g\xF3i doanh nghi\u1EC7p",
7687
+ "H\u1ED7 tr\u1EE3 k\u1EF9 thu\u1EADt 24/7"
7688
+ ],
7689
+ marginBottom: 16,
7690
+ marginTop: 0,
7691
+ type: 20
7692
+ }
7693
+ }
7694
+ };
7695
+ }
7696
+ case 3:
7697
+ case 1:
7698
+ default: {
7699
+ return {
7700
+ version: "1",
7701
+ renderList: [
7702
+ "0",
7703
+ "1",
7704
+ "2",
7705
+ "11",
7706
+ "16",
7707
+ "17",
7708
+ "18",
7709
+ "26",
7710
+ "3",
7711
+ "4",
7712
+ "5",
7713
+ "7",
7714
+ "8",
7715
+ "9",
7716
+ "12",
7717
+ "10",
7718
+ "27"
7719
+ ],
7720
+ freezedTop: 3,
7721
+ freezedBottom: 10,
7722
+ data: {
7723
+ "0": {
7724
+ id: "-1",
7725
+ type: 1,
7726
+ indexes: ["0", "1", "2"],
7727
+ images: {
7728
+ "0": { name: "prod-1.jpg", url: defaultImages[0] },
7729
+ "1": { name: "prod-2.jpg", url: defaultImages[1] },
7730
+ "2": { name: "prod-3.jpg", url: defaultImages[2] }
7731
+ },
7732
+ videos: { "5": { name: "", thumbnail: "", url: "" } }
7733
+ },
7734
+ "1": {
7735
+ id: "-1",
7736
+ discountValue: 35,
7737
+ visible: true,
7738
+ countdownType: 4,
7739
+ type: 2,
7740
+ startDate: Date.now(),
7741
+ loopDays: 1,
7742
+ label: "<p>Th\u1EDDi gian \u01B0u \u0111\xE3i c\xF2n l\u1EA1i:</p>",
7743
+ labelDelta: { ops: [{ insert: "Th\u1EDDi gian \u01B0u \u0111\xE3i c\xF2n l\u1EA1i:\n" }] },
7744
+ marginTop: 8,
7745
+ marginBottom: 0,
7746
+ visibility: { days: true, hours: true, minutes: true, seconds: true }
7747
+ },
7748
+ "2": {
7749
+ type: 19,
7750
+ name: productName,
7751
+ price,
7752
+ rawPrice,
7753
+ marginTop: 8,
7754
+ marginBottom: 8
7755
+ },
7756
+ "3": {
7757
+ id: "-1",
7758
+ type: 18,
7759
+ visible: true,
7760
+ formQuestion: {
7761
+ type: 2,
7762
+ title: "Phi\xEAn b\u1EA3n",
7763
+ isRequired: true,
7764
+ disable: false,
7765
+ answers: [
7766
+ { type: 1, value: "B\u1EA3n Ti\xEAu Chu\u1EA9n", priority: 0 },
7767
+ { type: 1, value: "B\u1EA3n Cao C\u1EA5p", priority: 1 }
7768
+ ],
7769
+ description: "",
7770
+ priority: 0
7771
+ },
7772
+ marginTop: 8,
7773
+ marginBottom: 8
7774
+ },
7775
+ "4": {
7776
+ id: "-1",
7777
+ type: 18,
7778
+ visible: true,
7779
+ formQuestion: {
7780
+ type: 2,
7781
+ title: "G\xF3i dung l\u01B0\u1EE3ng",
7782
+ isRequired: true,
7783
+ disable: false,
7784
+ answers: [
7785
+ { type: 1, value: "G\xF3i 1 Th\xE1ng", priority: 0 },
7786
+ { type: 1, value: "G\xF3i 1 N\u0103m", priority: 1 }
7787
+ ],
7788
+ description: "",
7789
+ priority: 0
7790
+ },
7791
+ marginTop: 8,
7792
+ marginBottom: 8
7793
+ },
7794
+ "5": {
7795
+ id: "-1",
7796
+ type: 16,
7797
+ formQuestion: {
7798
+ type: 1,
7799
+ title: "S\u1ED1 l\u01B0\u1EE3ng",
7800
+ isRequired: true,
7801
+ disable: false,
7802
+ answers: [{ type: 5, value: "", priority: 0 }],
7803
+ description: "",
7804
+ priority: 0
7805
+ },
7806
+ marginTop: 8,
7807
+ marginBottom: 8
7808
+ },
7809
+ "7": {
7810
+ id: "-1",
7811
+ type: 7,
7812
+ formQuestion: {
7813
+ type: 1,
7814
+ title: "H\u1ECD v\xE0 t\xEAn",
7815
+ isRequired: true,
7816
+ disable: false,
7817
+ answers: [{ type: 7, value: "", placeHolder: "Nh\u1EADp h\u1ECD v\xE0 t\xEAn c\u1EE7a b\u1EA1n", priority: 0 }],
7818
+ description: "",
7819
+ priority: 0
7820
+ },
7821
+ marginTop: 8,
7822
+ marginBottom: 8
7823
+ },
7824
+ "8": {
7825
+ id: "-1",
7826
+ type: 9,
7827
+ formQuestion: {
7828
+ type: 1,
7829
+ title: "S\u1ED1 \u0111i\u1EC7n tho\u1EA1i",
7830
+ isRequired: true,
7831
+ disable: false,
7832
+ answers: [{ type: 13, value: "", placeHolder: "Nh\u1EADp s\u1ED1 \u0111i\u1EC7n tho\u1EA1i li\xEAn h\u1EC7", priority: 0 }],
7833
+ description: "",
7834
+ priority: 0
7835
+ },
7836
+ marginTop: 8,
7837
+ marginBottom: 8
7838
+ },
7839
+ "9": {
7840
+ id: "-1",
7841
+ type: 10,
7842
+ formQuestion: {
7843
+ type: 1,
7844
+ title: "\u0110\u1ECBa ch\u1EC9",
7845
+ isRequired: true,
7846
+ disable: false,
7847
+ answers: [{ type: 15, value: "", placeHolder: "Nh\u1EADp \u0111\u1ECBa ch\u1EC9 giao h\xE0ng ho\u1EB7c nh\u1EADn t\u01B0 v\u1EA5n", priority: 0 }],
7848
+ description: "",
7849
+ priority: 0
7850
+ },
7851
+ marginTop: 8,
7852
+ marginBottom: 8
7853
+ },
7854
+ "10": {
7855
+ id: "-1",
7856
+ type: 8,
7857
+ background: "#008FE5",
7858
+ borderColor: "#000000",
7859
+ borderRadius: 4,
7860
+ borderSize: 1,
7861
+ showBorder: false,
7862
+ formPopup: templateId === 3,
7863
+ fixedPosition: true,
7864
+ image: {
7865
+ name: "cart.svg",
7866
+ url: "https://adtima-media.zascdn.me/2023/10/58117541-e206-4f9d-b4cf-69e50f963288.svg"
7867
+ },
7868
+ content2: "\u0110\u1EB7t h\xE0ng ngay"
7869
+ },
7870
+ "11": {
7871
+ id: "-1",
7872
+ type: 4,
7873
+ delta: {
7874
+ ops: [
7875
+ { attributes: { color: "#bf2600", bold: true }, insert: "\u01AFU \u0110\xC3I \u0110\u1EB6C BI\u1EC6T H\xD4M NAY\n" },
7876
+ { insert: `Tr\u1EA3i nghi\u1EC7m tr\u1ECDn b\u1ED9 t\xEDnh n\u0103ng v\u01B0\u1EE3t tr\u1ED9i c\u1EE7a ${productName}.
7877
+ ` }
7878
+ ]
7879
+ },
7880
+ marginTop: 16,
7881
+ marginBottom: 16,
7882
+ outputHtml: `<p><strong style="color: rgb(191, 38, 0);">\u01AFU \u0110\xC3I \u0110\u1EB6C BI\u1EC6T H\xD4M NAY</strong></p><p>Tr\u1EA3i nghi\u1EC7m tr\u1ECDn b\u1ED9 t\xEDnh n\u0103ng v\u01B0\u1EE3t tr\u1ED9i c\u1EE7a ${productName}.</p>`
7883
+ },
7884
+ "12": {
7885
+ id: "-1",
7886
+ type: 23,
7887
+ actionType: "1",
7888
+ content: "Li\xEAn h\u1EC7 Hotline",
7889
+ borderColor: "#008fe5",
7890
+ borderRadius: 4,
7891
+ borderSize: 2,
7892
+ showBorder: true,
7893
+ fixedPosition: true,
7894
+ visible: true,
7895
+ phone: options.hotline || "",
7896
+ image: {
7897
+ name: "phone.svg",
7898
+ url: "https://adtima-media.zascdn.me/2023/10/03d065a4-90b2-4deb-b684-5ff61407a47d.svg"
7899
+ },
7900
+ color: "#008fe5",
7901
+ background: "#ffffff",
7902
+ marginTop: 16,
7903
+ marginBottom: 16
7904
+ },
7905
+ "16": {
7906
+ id: "-1",
7907
+ type: 6,
7908
+ mediaType: "image",
7909
+ image: { url: defaultImages[0], name: "hero-1.png" },
7910
+ videoSetting: { autoPlay: true, loop: true }
7911
+ },
7912
+ "17": {
7913
+ id: "-1",
7914
+ type: 6,
7915
+ mediaType: "image",
7916
+ image: { url: defaultImages[1], name: "hero-2.png" },
7917
+ videoSetting: { autoPlay: true, loop: true }
7918
+ },
7919
+ "18": {
7920
+ id: "-1",
7921
+ type: 6,
7922
+ mediaType: "image",
7923
+ image: { url: defaultImages[2], name: "hero-3.png" },
7924
+ videoSetting: { autoPlay: true, loop: true }
7925
+ },
7926
+ "26": {
7927
+ id: "-1",
7928
+ type: 14,
7929
+ backgroundColor: "#f2f3f3",
7930
+ textDelta: { ops: [{ attributes: { size: "18px", bold: true }, insert: `${brandName}
7931
+ ` }] },
7932
+ textHtml: `<p><strong style="font-size: 18px;">${brandName}</strong></p>`,
7933
+ detailings: [
7934
+ {
7935
+ image: {
7936
+ url: "https://adtima-media.zascdn.me/2023/10/cba64b4d-0bd5-4504-8b6d-5f2d2562854a.png",
7937
+ name: "home.png"
7938
+ },
7939
+ textDelta: { ops: [{ insert: `\u0110\u1ECBa ch\u1EC9: ${options.address || "H\xE0 N\u1ED9i / TP.HCM"}
7940
+ ` }] },
7941
+ textHtml: `<p>\u0110\u1ECBa ch\u1EC9: ${options.address || "H\xE0 N\u1ED9i / TP.HCM"}</p>`
7942
+ },
7943
+ {
7944
+ image: {
7945
+ url: "https://adtima-media.zascdn.me/2023/10/d538811f-9232-4ef0-a130-ea2b1dda05d2.png",
7946
+ name: "phone.png"
7947
+ },
7948
+ textDelta: { ops: [{ insert: `Hotline: ${options.hotline || "1900 xxxx"}
7949
+ ` }] },
7950
+ textHtml: `<p>Hotline: ${options.hotline || "1900 xxxx"}</p>`
7951
+ }
7952
+ ]
7953
+ },
7954
+ "27": {
7955
+ id: "-1",
7956
+ type: 27,
7957
+ useCustomConsent: false
7958
+ }
7959
+ }
7960
+ };
7961
+ }
7962
+ }
7963
+ }
7964
+ };
7965
+
7448
7966
  // src/validators/automated-rules.validator.ts
7449
7967
  var AutomatedRuleScopeEnum = /* @__PURE__ */ ((AutomatedRuleScopeEnum2) => {
7450
7968
  AutomatedRuleScopeEnum2[AutomatedRuleScopeEnum2["Ads"] = 1] = "Ads";
@@ -8180,6 +8698,7 @@ export {
8180
8698
  AutomatedRuleTimeRangeEnum,
8181
8699
  ConversionLabelEnum,
8182
8700
  ConversionUrlTypeEnum,
8701
+ InstantPageFactory,
8183
8702
  MAX_REPORT_RANGE_MS,
8184
8703
  MAX_REPORT_RANGE_SECONDS,
8185
8704
  MemoryZaloSessionStore,
@@ -8259,6 +8778,7 @@ export {
8259
8778
  defaultSharedMemorySessionStore,
8260
8779
  deriveAccountKeyFromZpsid,
8261
8780
  parseZaloCookieInput,
8781
+ sanitizeCanvasKeys,
8262
8782
  validateChangeCampaignStatusParams,
8263
8783
  validateCloneInstantPageRequest,
8264
8784
  validateCreateCampaignPayload,
@@ -8279,6 +8799,7 @@ export {
8279
8799
  validateEstimateAudienceRequest,
8280
8800
  validateGetInstantPageDetailRequest,
8281
8801
  validateGetInstantPageSharedUserRequest,
8802
+ validateInstantPageCanvas,
8282
8803
  validateListFlowsByOfficialAccountRequest,
8283
8804
  validateListFormLeadsRequest,
8284
8805
  validateListFormsByOfficialAccountRequest,