@redonvn/zalo-ads-sdk 0.2.18 → 0.2.20

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
@@ -2117,11 +2117,18 @@ function validateCreateCampaignPayload(payload, options = {}) {
2117
2117
  `campaignType: ${payload.campaignType} kh\xF4ng h\u1EE3p l\u1EC7. C\xE1c lo\u1EA1i h\u1ED7 tr\u1EE3: 6 (Website), 17 (Form), 18 (Message), 3 (OA), 14 (Video), 22 (Commerce), 4 (Article), 20 (Display).`
2118
2118
  );
2119
2119
  }
2120
- if (payload.campaignType !== VALID_CAMPAIGN_TYPES.DISPLAY) {
2120
+ const OA_REQUIRED_CAMPAIGN_TYPES = [
2121
+ VALID_CAMPAIGN_TYPES.FORM,
2122
+ VALID_CAMPAIGN_TYPES.MESSAGE,
2123
+ VALID_CAMPAIGN_TYPES.OA,
2124
+ VALID_CAMPAIGN_TYPES.COMMERCE,
2125
+ VALID_CAMPAIGN_TYPES.ARTICLE
2126
+ ];
2127
+ if (payload.campaignType !== void 0 && OA_REQUIRED_CAMPAIGN_TYPES.includes(payload.campaignType)) {
2121
2128
  if (!payload.pageId || payload.pageId <= 0) {
2122
- errors.push("pageId c\u1EE7a Official Account l\xE0 b\u1EAFt bu\u1ED9c \u0111\u1ED1i v\u1EDBi lo\u1EA1i chi\u1EBFn d\u1ECBch n\xE0y (ph\u1EA3i > 0).");
2129
+ errors.push("pageId c\u1EE7a Official Account l\xE0 b\u1EAFt bu\u1ED9c \u0111\u1ED1i v\u1EDBi lo\u1EA1i chi\u1EBFn d\u1ECBch n\xE0y (ph\u1EA3i > 0, ch\u1ECDn t\u1EEB Danh s\xE1ch t\xE0i kho\u1EA3n OA).");
2123
2130
  }
2124
- } else {
2131
+ } else if (payload.campaignType === VALID_CAMPAIGN_TYPES.DISPLAY) {
2125
2132
  if (payload.pageId !== -1 && payload.pageId !== 0 && !payload.pageId) {
2126
2133
  warnings.push("Qu\u1EA3ng c\xE1o Display th\u01B0\u1EDDng s\u1EED d\u1EE5ng pageId = -1.");
2127
2134
  }
@@ -2600,14 +2607,171 @@ function validateCropCoordinates(input) {
2600
2607
  data: errors.length === 0 ? cleanData : void 0
2601
2608
  };
2602
2609
  }
2610
+ function validateCreateCommerceCampaign(payload, options = {}) {
2611
+ const errors = [];
2612
+ const warnings = [];
2613
+ if (!payload.name || typeof payload.name !== "string" || !payload.name.trim()) {
2614
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
2615
+ } else if (payload.name.length > 255) {
2616
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 255 k\xFD t\u1EF1.");
2617
+ }
2618
+ if (!payload.pageId || payload.pageId <= 0) {
2619
+ errors.push("T\xE0i kho\u1EA3n OA ('pageId') l\xE0 b\u1EAFt bu\u1ED9c \u0111\u1ED1i v\u1EDBi Qu\u1EA3ng c\xE1o Commerce (ch\u1ECDn t\u1EEB Danh s\xE1ch t\xE0i kho\u1EA3n OA, ph\u1EA3i > 0).");
2620
+ }
2621
+ if (payload.productId === void 0 || payload.productId === null || payload.productId <= 0) {
2622
+ warnings.push("Qu\u1EA3ng c\xE1o Commerce n\xEAn ch\u1EC9 \u0111\u1ECBnh productId (ho\u1EB7c -1/0 khi d\xF9ng Instant Page s\u1EA3n ph\u1EA9m).");
2623
+ }
2624
+ return { isValid: errors.length === 0, errors, warnings };
2625
+ }
2626
+ function validateCreateDisplayCampaign(payload, options = {}) {
2627
+ const errors = [];
2628
+ const warnings = [];
2629
+ if (!payload.name || typeof payload.name !== "string" || !payload.name.trim()) {
2630
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
2631
+ } else if (payload.name.length > 255) {
2632
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 255 k\xFD t\u1EF1.");
2633
+ }
2634
+ if (payload.targetUrl && !/^https?:\/\/.+/i.test(payload.targetUrl)) {
2635
+ errors.push("targetUrl ph\u1EA3i l\xE0 m\u1ED9t \u0111\u01B0\u1EDDng link h\u1EE3p l\u1EC7 b\u1EAFt \u0111\u1EA7u b\u1EB1ng http:// ho\u1EB7c https://.");
2636
+ }
2637
+ return { isValid: errors.length === 0, errors, warnings };
2638
+ }
2639
+ function validateCreateWebsiteCampaign(payload, options = {}) {
2640
+ const errors = [];
2641
+ const warnings = [];
2642
+ if (!payload.name || typeof payload.name !== "string" || !payload.name.trim()) {
2643
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
2644
+ } else if (payload.name.length > 255) {
2645
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 255 k\xFD t\u1EF1.");
2646
+ }
2647
+ if (!payload.targetUrl || typeof payload.targetUrl !== "string" || !payload.targetUrl.trim()) {
2648
+ errors.push("Li\xEAn k\u1EBFt website ('targetUrl') l\xE0 b\u1EAFt bu\u1ED9c \u0111\u1ED1i v\u1EDBi Qu\u1EA3ng c\xE1o Website.");
2649
+ } else if (!/^https?:\/\/.+/i.test(payload.targetUrl)) {
2650
+ errors.push("Li\xEAn k\u1EBFt website ('targetUrl') ph\u1EA3i l\xE0 \u0111\u01B0\u1EDDng link h\u1EE3p l\u1EC7 b\u1EAFt \u0111\u1EA7u b\u1EB1ng http:// ho\u1EB7c https://.");
2651
+ }
2652
+ return { isValid: errors.length === 0, errors, warnings };
2653
+ }
2654
+ function validateCreateFormCampaign(payload, options = {}) {
2655
+ const errors = [];
2656
+ const warnings = [];
2657
+ if (!payload.name || typeof payload.name !== "string" || !payload.name.trim()) {
2658
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
2659
+ } else if (payload.name.length > 255) {
2660
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 255 k\xFD t\u1EF1.");
2661
+ }
2662
+ if (!payload.pageId || payload.pageId <= 0) {
2663
+ errors.push("T\xE0i kho\u1EA3n OA ('pageId') l\xE0 b\u1EAFt bu\u1ED9c \u0111\u1ED1i v\u1EDBi Qu\u1EA3ng c\xE1o Form (ch\u1ECDn t\u1EEB Danh s\xE1ch t\xE0i kho\u1EA3n OA, ph\u1EA3i > 0).");
2664
+ }
2665
+ return { isValid: errors.length === 0, errors, warnings };
2666
+ }
2667
+ function validateCreateMessageCampaign(payload, options = {}) {
2668
+ const errors = [];
2669
+ const warnings = [];
2670
+ if (!payload.name || typeof payload.name !== "string" || !payload.name.trim()) {
2671
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
2672
+ } else if (payload.name.length > 255) {
2673
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 255 k\xFD t\u1EF1.");
2674
+ }
2675
+ if (!payload.pageId || payload.pageId <= 0) {
2676
+ errors.push("T\xE0i kho\u1EA3n OA ('pageId') l\xE0 b\u1EAFt bu\u1ED9c \u0111\u1ED1i v\u1EDBi Qu\u1EA3ng c\xE1o Tin nh\u1EAFn (ch\u1ECDn t\u1EEB Danh s\xE1ch t\xE0i kho\u1EA3n OA, ph\u1EA3i > 0).");
2677
+ }
2678
+ return { isValid: errors.length === 0, errors, warnings };
2679
+ }
2680
+ function validateCreateOfficialAccountCampaign(payload, options = {}) {
2681
+ const errors = [];
2682
+ const warnings = [];
2683
+ if (!payload.name || typeof payload.name !== "string" || !payload.name.trim()) {
2684
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
2685
+ } else if (payload.name.length > 255) {
2686
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 255 k\xFD t\u1EF1.");
2687
+ }
2688
+ if (!payload.pageId || payload.pageId <= 0) {
2689
+ errors.push("T\xE0i kho\u1EA3n OA ('pageId') l\xE0 b\u1EAFt bu\u1ED9c \u0111\u1ED1i v\u1EDBi Qu\u1EA3ng c\xE1o Zalo Official Account (ch\u1ECDn t\u1EEB Danh s\xE1ch t\xE0i kho\u1EA3n OA, ph\u1EA3i > 0).");
2690
+ }
2691
+ return { isValid: errors.length === 0, errors, warnings };
2692
+ }
2693
+ function validateCreateArticleCampaign(payload, options = {}) {
2694
+ const errors = [];
2695
+ const warnings = [];
2696
+ if (!payload.name || typeof payload.name !== "string" || !payload.name.trim()) {
2697
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
2698
+ } else if (payload.name.length > 255) {
2699
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 255 k\xFD t\u1EF1.");
2700
+ }
2701
+ if (!payload.pageId || payload.pageId <= 0) {
2702
+ errors.push("T\xE0i kho\u1EA3n OA ('pageId') l\xE0 b\u1EAFt bu\u1ED9c \u0111\u1ED1i v\u1EDBi Qu\u1EA3ng c\xE1o B\xE0i vi\u1EBFt (ch\u1ECDn t\u1EEB Danh s\xE1ch t\xE0i kho\u1EA3n OA, ph\u1EA3i > 0).");
2703
+ }
2704
+ if (!payload.articleId || payload.articleId <= 0) {
2705
+ errors.push("B\xE0i vi\u1EBFt ('articleId') l\xE0 b\u1EAFt bu\u1ED9c \u0111\u1ED1i v\u1EDBi Qu\u1EA3ng c\xE1o B\xE0i vi\u1EBFt (ch\u1ECDn t\u1EEB Danh s\xE1ch b\xE0i vi\u1EBFt c\u1EE7a OA \u0111\xF3, l\u1EA5y qua getOwnedArticles).");
2706
+ }
2707
+ return { isValid: errors.length === 0, errors, warnings };
2708
+ }
2709
+ function validateCreateVideoCampaign(payload, options = {}) {
2710
+ const errors = [];
2711
+ const warnings = [];
2712
+ if (!payload.name || typeof payload.name !== "string" || !payload.name.trim()) {
2713
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
2714
+ } else if (payload.name.length > 255) {
2715
+ errors.push("T\xEAn chi\u1EBFn d\u1ECBch ('name') kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 255 k\xFD t\u1EF1.");
2716
+ }
2717
+ if (!payload.targetUrl || typeof payload.targetUrl !== "string" || !payload.targetUrl.trim()) {
2718
+ errors.push("Li\xEAn k\u1EBFt Website ('targetUrl') l\xE0 b\u1EAFt bu\u1ED9c \u0111\u1ED1i v\u1EDBi Qu\u1EA3ng c\xE1o Video.");
2719
+ } else if (!/^https?:\/\/.+/i.test(payload.targetUrl)) {
2720
+ errors.push("Li\xEAn k\u1EBFt Website ('targetUrl') ph\u1EA3i l\xE0 \u0111\u01B0\u1EDDng link h\u1EE3p l\u1EC7 b\u1EAFt \u0111\u1EA7u b\u1EB1ng http:// ho\u1EB7c https://.");
2721
+ }
2722
+ return { isValid: errors.length === 0, errors, warnings };
2723
+ }
2724
+ function validateUpdateWebsiteAd(payload, options = {}) {
2725
+ return validateUpdateAdPayload({ ...payload, Type: VALID_AD_TYPES.WEBSITE }, options);
2726
+ }
2727
+ function validateUpdateDisplayAd(payload, options = {}) {
2728
+ return validateUpdateAdPayload({ ...payload, Type: VALID_AD_TYPES.DISPLAY }, options);
2729
+ }
2730
+ function validateUpdateVideoAd(payload, options = {}) {
2731
+ return validateUpdateAdPayload({ ...payload, Type: VALID_AD_TYPES.VIDEO }, options);
2732
+ }
2733
+ function validateUpdateCommerceAd(payload, options = {}) {
2734
+ return validateUpdateAdPayload({ ...payload, Type: VALID_AD_TYPES.COMMERCE }, options);
2735
+ }
2736
+ function validateUpdateFormAd(payload, options = {}) {
2737
+ return validateUpdateAdPayload({ ...payload, Type: VALID_AD_TYPES.FORM }, options);
2738
+ }
2739
+ function validateUpdateMessageAd(payload, options = {}) {
2740
+ return validateUpdateAdPayload({ ...payload, Type: VALID_AD_TYPES.MESSAGE }, options);
2741
+ }
2742
+ function validateUpdateOfficialAccountAd(payload, options = {}) {
2743
+ return validateUpdateAdPayload({ ...payload, Type: VALID_AD_TYPES.OA }, options);
2744
+ }
2745
+ function validateUpdateArticleAd(payload, options = {}) {
2746
+ return validateUpdateAdPayload({ ...payload, Type: VALID_AD_TYPES.ARTICLE }, options);
2747
+ }
2603
2748
  var ZaloCampaignsValidator = {
2749
+ // Generic
2604
2750
  createCampaign: validateCreateCampaignPayload,
2605
2751
  updateAd: validateUpdateAdPayload,
2606
2752
  renameCampaign: validateRenameCampaignParams,
2607
2753
  changeStatus: validateChangeCampaignStatusParams,
2608
2754
  duplicateAd: validateDuplicateAdParams,
2609
2755
  validateCropCoordinates,
2610
- validateUploadCropAdImage: validateCropCoordinates
2756
+ validateUploadCropAdImage: validateCropCoordinates,
2757
+ // Specific Create Campaign
2758
+ createCommerceCampaign: validateCreateCommerceCampaign,
2759
+ createDisplayCampaign: validateCreateDisplayCampaign,
2760
+ createWebsiteCampaign: validateCreateWebsiteCampaign,
2761
+ createFormCampaign: validateCreateFormCampaign,
2762
+ createMessageCampaign: validateCreateMessageCampaign,
2763
+ createOfficialAccountCampaign: validateCreateOfficialAccountCampaign,
2764
+ createArticleCampaign: validateCreateArticleCampaign,
2765
+ createVideoCampaign: validateCreateVideoCampaign,
2766
+ // Specific Update Ad
2767
+ updateWebsiteAd: validateUpdateWebsiteAd,
2768
+ updateDisplayAd: validateUpdateDisplayAd,
2769
+ updateVideoAd: validateUpdateVideoAd,
2770
+ updateCommerceAd: validateUpdateCommerceAd,
2771
+ updateFormAd: validateUpdateFormAd,
2772
+ updateMessageAd: validateUpdateMessageAd,
2773
+ updateOfficialAccountAd: validateUpdateOfficialAccountAd,
2774
+ updateArticleAd: validateUpdateArticleAd
2611
2775
  };
2612
2776
 
2613
2777
  // src/services/campaigns.service.ts
@@ -5759,8 +5923,8 @@ function validateListFormLeadsRequest(input) {
5759
5923
  const offset = typeof raw.offset === "number" && raw.offset >= 0 ? Math.floor(raw.offset) : 0;
5760
5924
  const status = typeof raw.status === "string" && raw.status.trim() !== "" ? raw.status.trim() : "2,6,1,0,7,4,5,3";
5761
5925
  const now = Math.floor(Date.now() / 1e3);
5762
- const fromTime = typeof raw.fromTime === "number" && raw.fromTime >= 0 ? Math.floor(raw.fromTime) : now - 90 * 86400;
5763
- const toTime = typeof raw.toTime === "number" && raw.toTime >= 0 ? Math.floor(raw.toTime) : now;
5926
+ const fromTime = typeof raw.fromTime === "number" && raw.fromTime >= 0 ? raw.fromTime >= 1e10 ? Math.floor(raw.fromTime / 1e3) : Math.floor(raw.fromTime) : now - 90 * 86400;
5927
+ const toTime = typeof raw.toTime === "number" && raw.toTime >= 0 ? raw.toTime >= 1e10 ? Math.floor(raw.toTime / 1e3) : Math.floor(raw.toTime) : now;
5764
5928
  if (toTime < fromTime) {
5765
5929
  errors.push("M\u1ED1c th\u1EDDi gian k\u1EBFt th\xFAc 'toTime' ph\u1EA3i l\u1EDBn h\u01A1n ho\u1EB7c b\u1EB1ng 'fromTime'.");
5766
5930
  }
@@ -6350,6 +6514,127 @@ function validateSearchInstantPagesRequest(input) {
6350
6514
  data: errors.length === 0 ? data : void 0
6351
6515
  };
6352
6516
  }
6517
+ function sanitizeCanvasKeys(data) {
6518
+ const cleanData = {};
6519
+ for (const [key, value] of Object.entries(data)) {
6520
+ const cleanKey = key.replace(/^["']+|["']+$/g, "").trim();
6521
+ if (value && typeof value === "object" && !Array.isArray(value)) {
6522
+ const valObj = value;
6523
+ const sanitizedSub = { ...valObj };
6524
+ if (sanitizedSub.images && typeof sanitizedSub.images === "object" && !Array.isArray(sanitizedSub.images)) {
6525
+ sanitizedSub.images = sanitizeCanvasKeys(sanitizedSub.images);
6526
+ }
6527
+ if (sanitizedSub.videos && typeof sanitizedSub.videos === "object" && !Array.isArray(sanitizedSub.videos)) {
6528
+ sanitizedSub.videos = sanitizeCanvasKeys(sanitizedSub.videos);
6529
+ }
6530
+ cleanData[cleanKey] = sanitizedSub;
6531
+ } else {
6532
+ cleanData[cleanKey] = value;
6533
+ }
6534
+ }
6535
+ return cleanData;
6536
+ }
6537
+ function validateInstantPageCanvas(input, isPublishing = false) {
6538
+ const errors = [];
6539
+ if (!input) {
6540
+ return { isValid: false, errors: ["Canvas Instant Page kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng."] };
6541
+ }
6542
+ let canvasObj;
6543
+ if (typeof input === "string") {
6544
+ if (input.trim() === "") {
6545
+ return { isValid: false, errors: ["Chu\u1ED7i Canvas JSON kh\xF4ng \u0111\u01B0\u1EE3c r\u1ED7ng."] };
6546
+ }
6547
+ try {
6548
+ canvasObj = JSON.parse(input);
6549
+ } catch (e) {
6550
+ return { isValid: false, errors: [`Canvas JSON kh\xF4ng h\u1EE3p l\u1EC7: ${e.message}`] };
6551
+ }
6552
+ } else if (typeof input === "object" && input !== null) {
6553
+ canvasObj = input;
6554
+ } else {
6555
+ return { isValid: false, errors: ["Canvas ph\u1EA3i l\xE0 \u0111\u1ED1i t\u01B0\u1EE3ng (Object) ho\u1EB7c chu\u1ED7i JSON h\u1EE3p l\u1EC7."] };
6556
+ }
6557
+ if (!canvasObj.renderList || !Array.isArray(canvasObj.renderList)) {
6558
+ 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: [] }.");
6559
+ } else if (canvasObj.renderList.length === 0) {
6560
+ 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.");
6561
+ }
6562
+ if (!canvasObj.data || typeof canvasObj.data !== "object" || Array.isArray(canvasObj.data)) {
6563
+ 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.");
6564
+ }
6565
+ if (errors.length > 0) {
6566
+ return { isValid: false, errors };
6567
+ }
6568
+ const renderList = canvasObj.renderList.map(
6569
+ (id) => String(id).replace(/^["']+|["']+$/g, "").trim()
6570
+ );
6571
+ const rawData = canvasObj.data;
6572
+ const cleanData = sanitizeCanvasKeys(rawData);
6573
+ for (const blockId of renderList) {
6574
+ if (!(blockId in cleanData)) {
6575
+ errors.push(`Kh\u1ED1i ID '${blockId}' c\xF3 trong 'renderList' nh\u01B0ng kh\xF4ng t\u1ED3n t\u1EA1i trong t\u1EEB \u0111i\u1EC3n 'data'.`);
6576
+ } else {
6577
+ const block = cleanData[blockId];
6578
+ if (!block || typeof block !== "object") {
6579
+ errors.push(`Kh\u1ED1i d\u1EEF li\u1EC7u data['${blockId}'] ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng.`);
6580
+ } else if (block.type === void 0 || typeof block.type !== "number") {
6581
+ 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).`);
6582
+ }
6583
+ }
6584
+ }
6585
+ if (isPublishing) {
6586
+ for (const blockId of renderList) {
6587
+ const block = cleanData[blockId];
6588
+ if (!block) continue;
6589
+ if (block.type === 28) {
6590
+ const name = typeof block.name === "string" ? block.name.trim() : "";
6591
+ if (name.length < 2 || name.length > 30) {
6592
+ 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.`);
6593
+ }
6594
+ const img = block.image;
6595
+ if (!img || typeof img.url !== "string" || !img.url.startsWith("http")) {
6596
+ 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').`);
6597
+ }
6598
+ }
6599
+ if (block.type === 29) {
6600
+ const len = typeof block.length === "number" ? block.length : 0;
6601
+ const html = typeof block.outputHtml === "string" ? block.outputHtml.trim() : "";
6602
+ if (len === 0 && html === "") {
6603
+ 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.`);
6604
+ }
6605
+ }
6606
+ if (block.type === 1) {
6607
+ const indexes = Array.isArray(block.indexes) ? block.indexes : [];
6608
+ const images = block.images && typeof block.images === "object" ? block.images : {};
6609
+ for (const idx of indexes) {
6610
+ const img = images[String(idx)];
6611
+ if (img && typeof img.url === "string" && img.url.trim() === "") {
6612
+ 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.`);
6613
+ }
6614
+ }
6615
+ }
6616
+ if (block.type === 21) {
6617
+ const msg = typeof block.content === "string" ? block.content.trim() : "";
6618
+ if (msg.length === 0 || msg.length > 40) {
6619
+ 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.`);
6620
+ }
6621
+ }
6622
+ }
6623
+ }
6624
+ const resultCanvas = {
6625
+ version: typeof canvasObj.version === "number" || typeof canvasObj.version === "string" ? canvasObj.version : "1",
6626
+ renderList,
6627
+ data: cleanData,
6628
+ ...canvasObj.freezedTop !== void 0 ? { freezedTop: Number(canvasObj.freezedTop) } : {},
6629
+ ...canvasObj.freezedBottom !== void 0 ? { freezedBottom: Number(canvasObj.freezedBottom) } : {},
6630
+ ...canvasObj.pageTitle !== void 0 ? { pageTitle: String(canvasObj.pageTitle) } : {}
6631
+ };
6632
+ return {
6633
+ isValid: errors.length === 0,
6634
+ errors,
6635
+ data: errors.length === 0 ? resultCanvas : void 0
6636
+ };
6637
+ }
6353
6638
  function validateUpdateInstantPageRequest(input) {
6354
6639
  const errors = [];
6355
6640
  if (!input || typeof input !== "object") {
@@ -6388,40 +6673,42 @@ function validateUpdateInstantPageRequest(input) {
6388
6673
  data.active = obj.active;
6389
6674
  }
6390
6675
  }
6676
+ let isPublishing = false;
6391
6677
  if (obj.status !== void 0 && obj.status !== null) {
6392
6678
  const st = Number(obj.status);
6393
6679
  if (![0, 1, 2, 3].includes(st)) {
6394
6680
  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
6681
  } else {
6396
6682
  data.status = st;
6683
+ if (st === 1) isPublishing = true;
6397
6684
  }
6398
6685
  }
6686
+ let validatedDraftCanvas;
6399
6687
  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
- }
6688
+ const canvasRes = validateInstantPageCanvas(obj.draft, isPublishing);
6689
+ if (!canvasRes.isValid) {
6690
+ errors.push(...canvasRes.errors.map((err) => `[draft] ${err}`));
6409
6691
  } else {
6410
- data.draft = "";
6692
+ validatedDraftCanvas = canvasRes.data;
6693
+ data.draft = JSON.stringify(canvasRes.data);
6411
6694
  }
6412
6695
  }
6696
+ let validatedContentCanvas;
6413
6697
  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
- }
6698
+ const canvasRes = validateInstantPageCanvas(obj.content, isPublishing);
6699
+ if (!canvasRes.isValid) {
6700
+ errors.push(...canvasRes.errors.map((err) => `[content] ${err}`));
6423
6701
  } else {
6424
- data.content = "";
6702
+ validatedContentCanvas = canvasRes.data;
6703
+ data.content = JSON.stringify(canvasRes.data);
6704
+ }
6705
+ }
6706
+ if (isPublishing) {
6707
+ if (data.draft && !data.content) {
6708
+ data.content = data.draft;
6709
+ } else if (data.content && !data.draft) {
6710
+ data.draft = data.content;
6711
+ } else if (!data.draft && !data.content) {
6425
6712
  }
6426
6713
  }
6427
6714
  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 +7719,8 @@ var ZaloInstantPageBlockType = /* @__PURE__ */ ((ZaloInstantPageBlockType2) => {
7432
7719
  ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CALL_HOTLINE_BUTTON"] = 23] = "CALL_HOTLINE_BUTTON";
7433
7720
  ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["KEY_VALUE_TABLE"] = 25] = "KEY_VALUE_TABLE";
7434
7721
  ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CONSENT_NOTICE"] = 27] = "CONSENT_NOTICE";
7722
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["SHOP_INFO"] = 28] = "SHOP_INFO";
7723
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["SHOP_DESCRIPTION"] = 29] = "SHOP_DESCRIPTION";
7435
7724
  return ZaloInstantPageBlockType2;
7436
7725
  })(ZaloInstantPageBlockType || {});
7437
7726
  var ZaloInstantPageSharePermission = {
@@ -7445,6 +7734,399 @@ var ZaloInstantPageSharePermission = {
7445
7734
  READ_ONLY: 4
7446
7735
  };
7447
7736
 
7737
+ // src/helpers/instant-page-factory.ts
7738
+ var InstantPageFactory = class {
7739
+ /**
7740
+ * 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ệ.
7741
+ */
7742
+ static createFromTemplate(templateId, options = {}) {
7743
+ const brandName = options.brandName || "RedAI Official Store";
7744
+ const brandLogoUrl = options.brandLogoUrl || "https://adtima-media.zascdn.me/2023/10/58117541-e206-4f9d-b4cf-69e50f963288.svg";
7745
+ const productName = options.productName || "S\u1EA3n ph\u1EA9m / D\u1ECBch v\u1EE5 \u0110\u1ED9t ph\xE1 2026";
7746
+ const price = options.price ?? 299e3;
7747
+ const rawPrice = options.rawPrice ?? 499e3;
7748
+ const defaultMsg = options.defaultMessage || "T\xF4i mu\u1ED1n t\xECm hi\u1EC3u th\xEAm v\u1EC1 s\u1EA3n ph\u1EA9m n\xE0y";
7749
+ const defaultImages = [
7750
+ "https://adtima-media.zascdn.me/2023/06/84cba4c9-be13-425a-8daa-40e695ca9805.jpg",
7751
+ "https://adtima-media.zascdn.me/2023/06/805587cd-4699-47e6-a9bb-3cbbb4039b40.jpg",
7752
+ "https://adtima-media.zascdn.me/2023/06/aca98d2c-1739-4f03-a366-43a6d6c4ef53.jpg",
7753
+ "https://adtima-media.zascdn.me/2023/06/8cc5692b-2899-4862-9957-d3f66e8778cd.jpg"
7754
+ ];
7755
+ switch (templateId) {
7756
+ case 5: {
7757
+ const carouselImgs = options.carouselImages && options.carouselImages.length > 0 ? options.carouselImages : defaultImages.map((url, i) => ({ url, name: `image-${i + 1}.jpg` }));
7758
+ const indexes = carouselImgs.map((_, i) => String(i));
7759
+ const imagesMap = {};
7760
+ carouselImgs.forEach((img, i) => {
7761
+ imagesMap[String(i)] = {
7762
+ name: img.name || `image-${i + 1}.jpg`,
7763
+ url: img.url
7764
+ };
7765
+ });
7766
+ 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.";
7767
+ return {
7768
+ version: 1,
7769
+ renderList: ["1", "2", "3", "4"],
7770
+ freezedBottom: 4,
7771
+ pageTitle: "Chi ti\u1EBFt",
7772
+ data: {
7773
+ "1": {
7774
+ id: "-1",
7775
+ type: 28,
7776
+ name: brandName,
7777
+ image: {
7778
+ name: "logo.png",
7779
+ url: brandLogoUrl
7780
+ }
7781
+ },
7782
+ "2": {
7783
+ id: "-1",
7784
+ type: 29,
7785
+ delta: {
7786
+ ops: [
7787
+ { attributes: { bold: true, size: "18px" }, insert: `${brandName}
7788
+ ` },
7789
+ { insert: `
7790
+ ${descText}
7791
+ ` }
7792
+ ]
7793
+ },
7794
+ outputHtml: `<p><strong style="font-size: 18px;">${brandName}</strong></p><p><br>${descText}</p>`,
7795
+ length: brandName.length + descText.length + 10
7796
+ },
7797
+ "3": {
7798
+ id: "-1",
7799
+ type: 1,
7800
+ indexes,
7801
+ images: imagesMap,
7802
+ videos: {
7803
+ "0": { name: "", thumbnail: "", url: "" }
7804
+ }
7805
+ },
7806
+ "4": {
7807
+ id: "-1",
7808
+ type: 21,
7809
+ content: defaultMsg,
7810
+ marginTop: 0,
7811
+ marginBottom: 0
7812
+ }
7813
+ }
7814
+ };
7815
+ }
7816
+ case 4: {
7817
+ return {
7818
+ version: 4,
7819
+ renderList: ["1", "2", "3"],
7820
+ freezedBottom: 3,
7821
+ data: {
7822
+ "1": {
7823
+ id: "-1",
7824
+ indexes: ["0", "1", "2"],
7825
+ images: {
7826
+ "1": { name: "banner-1.jpg", url: defaultImages[0] },
7827
+ "2": { name: "banner-2.jpg", url: defaultImages[1] }
7828
+ },
7829
+ textEditor: {
7830
+ delta: {
7831
+ ops: [
7832
+ { attributes: { bold: true }, insert: `Ch\xE0o m\u1EEBng b\u1EA1n \u0111\u1EBFn v\u1EDBi ${brandName}` },
7833
+ { 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" }
7834
+ ]
7835
+ },
7836
+ 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>`
7837
+ },
7838
+ type: 1,
7839
+ videos: {
7840
+ "0": { name: "", thumbnail: "", url: "" }
7841
+ }
7842
+ },
7843
+ "2": {
7844
+ rows: [{ id: 0, left: "\u01AFu \u0111\xE3i tr\u1EA3i nghi\u1EC7m", right: "D\xF9ng th\u1EED mi\u1EC5n ph\xED" }],
7845
+ type: 25
7846
+ },
7847
+ "3": {
7848
+ list: [
7849
+ "T\u01B0 v\u1EA5n gi\u1EA3i ph\xE1p t\u1EF1 \u0111\u1ED9ng h\xF3a",
7850
+ "B\xE1o gi\xE1 chi ti\u1EBFt g\xF3i doanh nghi\u1EC7p",
7851
+ "H\u1ED7 tr\u1EE3 k\u1EF9 thu\u1EADt 24/7"
7852
+ ],
7853
+ marginBottom: 16,
7854
+ marginTop: 0,
7855
+ type: 20
7856
+ }
7857
+ }
7858
+ };
7859
+ }
7860
+ case 3:
7861
+ case 1:
7862
+ default: {
7863
+ return {
7864
+ version: "1",
7865
+ renderList: [
7866
+ "0",
7867
+ "1",
7868
+ "2",
7869
+ "11",
7870
+ "16",
7871
+ "17",
7872
+ "18",
7873
+ "26",
7874
+ "3",
7875
+ "4",
7876
+ "5",
7877
+ "7",
7878
+ "8",
7879
+ "9",
7880
+ "12",
7881
+ "10",
7882
+ "27"
7883
+ ],
7884
+ freezedTop: 3,
7885
+ freezedBottom: 10,
7886
+ data: {
7887
+ "0": {
7888
+ id: "-1",
7889
+ type: 1,
7890
+ indexes: ["0", "1", "2"],
7891
+ images: {
7892
+ "0": { name: "prod-1.jpg", url: defaultImages[0] },
7893
+ "1": { name: "prod-2.jpg", url: defaultImages[1] },
7894
+ "2": { name: "prod-3.jpg", url: defaultImages[2] }
7895
+ },
7896
+ videos: { "5": { name: "", thumbnail: "", url: "" } }
7897
+ },
7898
+ "1": {
7899
+ id: "-1",
7900
+ discountValue: 35,
7901
+ visible: true,
7902
+ countdownType: 4,
7903
+ type: 2,
7904
+ startDate: Date.now(),
7905
+ loopDays: 1,
7906
+ label: "<p>Th\u1EDDi gian \u01B0u \u0111\xE3i c\xF2n l\u1EA1i:</p>",
7907
+ labelDelta: { ops: [{ insert: "Th\u1EDDi gian \u01B0u \u0111\xE3i c\xF2n l\u1EA1i:\n" }] },
7908
+ marginTop: 8,
7909
+ marginBottom: 0,
7910
+ visibility: { days: true, hours: true, minutes: true, seconds: true }
7911
+ },
7912
+ "2": {
7913
+ type: 19,
7914
+ name: productName,
7915
+ price,
7916
+ rawPrice,
7917
+ marginTop: 8,
7918
+ marginBottom: 8
7919
+ },
7920
+ "3": {
7921
+ id: "-1",
7922
+ type: 18,
7923
+ visible: true,
7924
+ formQuestion: {
7925
+ type: 2,
7926
+ title: "Phi\xEAn b\u1EA3n",
7927
+ isRequired: true,
7928
+ disable: false,
7929
+ answers: [
7930
+ { type: 1, value: "B\u1EA3n Ti\xEAu Chu\u1EA9n", priority: 0 },
7931
+ { type: 1, value: "B\u1EA3n Cao C\u1EA5p", priority: 1 }
7932
+ ],
7933
+ description: "",
7934
+ priority: 0
7935
+ },
7936
+ marginTop: 8,
7937
+ marginBottom: 8
7938
+ },
7939
+ "4": {
7940
+ id: "-1",
7941
+ type: 18,
7942
+ visible: true,
7943
+ formQuestion: {
7944
+ type: 2,
7945
+ title: "G\xF3i dung l\u01B0\u1EE3ng",
7946
+ isRequired: true,
7947
+ disable: false,
7948
+ answers: [
7949
+ { type: 1, value: "G\xF3i 1 Th\xE1ng", priority: 0 },
7950
+ { type: 1, value: "G\xF3i 1 N\u0103m", priority: 1 }
7951
+ ],
7952
+ description: "",
7953
+ priority: 0
7954
+ },
7955
+ marginTop: 8,
7956
+ marginBottom: 8
7957
+ },
7958
+ "5": {
7959
+ id: "-1",
7960
+ type: 16,
7961
+ formQuestion: {
7962
+ type: 1,
7963
+ title: "S\u1ED1 l\u01B0\u1EE3ng",
7964
+ isRequired: true,
7965
+ disable: false,
7966
+ answers: [{ type: 5, value: "", priority: 0 }],
7967
+ description: "",
7968
+ priority: 0
7969
+ },
7970
+ marginTop: 8,
7971
+ marginBottom: 8
7972
+ },
7973
+ "7": {
7974
+ id: "-1",
7975
+ type: 7,
7976
+ formQuestion: {
7977
+ type: 1,
7978
+ title: "H\u1ECD v\xE0 t\xEAn",
7979
+ isRequired: true,
7980
+ disable: false,
7981
+ answers: [{ type: 7, value: "", placeHolder: "Nh\u1EADp h\u1ECD v\xE0 t\xEAn c\u1EE7a b\u1EA1n", priority: 0 }],
7982
+ description: "",
7983
+ priority: 0
7984
+ },
7985
+ marginTop: 8,
7986
+ marginBottom: 8
7987
+ },
7988
+ "8": {
7989
+ id: "-1",
7990
+ type: 9,
7991
+ formQuestion: {
7992
+ type: 1,
7993
+ title: "S\u1ED1 \u0111i\u1EC7n tho\u1EA1i",
7994
+ isRequired: true,
7995
+ disable: false,
7996
+ answers: [{ type: 13, value: "", placeHolder: "Nh\u1EADp s\u1ED1 \u0111i\u1EC7n tho\u1EA1i li\xEAn h\u1EC7", priority: 0 }],
7997
+ description: "",
7998
+ priority: 0
7999
+ },
8000
+ marginTop: 8,
8001
+ marginBottom: 8
8002
+ },
8003
+ "9": {
8004
+ id: "-1",
8005
+ type: 10,
8006
+ formQuestion: {
8007
+ type: 1,
8008
+ title: "\u0110\u1ECBa ch\u1EC9",
8009
+ isRequired: true,
8010
+ disable: false,
8011
+ answers: [{ type: 15, value: "", placeHolder: "Nh\u1EADp \u0111\u1ECBa ch\u1EC9 giao h\xE0ng ho\u1EB7c nh\u1EADn t\u01B0 v\u1EA5n", priority: 0 }],
8012
+ description: "",
8013
+ priority: 0
8014
+ },
8015
+ marginTop: 8,
8016
+ marginBottom: 8
8017
+ },
8018
+ "10": {
8019
+ id: "-1",
8020
+ type: 8,
8021
+ background: "#008FE5",
8022
+ borderColor: "#000000",
8023
+ borderRadius: 4,
8024
+ borderSize: 1,
8025
+ showBorder: false,
8026
+ formPopup: templateId === 3,
8027
+ fixedPosition: true,
8028
+ image: {
8029
+ name: "cart.svg",
8030
+ url: "https://adtima-media.zascdn.me/2023/10/58117541-e206-4f9d-b4cf-69e50f963288.svg"
8031
+ },
8032
+ content2: "\u0110\u1EB7t h\xE0ng ngay"
8033
+ },
8034
+ "11": {
8035
+ id: "-1",
8036
+ type: 4,
8037
+ delta: {
8038
+ ops: [
8039
+ { attributes: { color: "#bf2600", bold: true }, insert: "\u01AFU \u0110\xC3I \u0110\u1EB6C BI\u1EC6T H\xD4M NAY\n" },
8040
+ { insert: `Tr\u1EA3i nghi\u1EC7m tr\u1ECDn b\u1ED9 t\xEDnh n\u0103ng v\u01B0\u1EE3t tr\u1ED9i c\u1EE7a ${productName}.
8041
+ ` }
8042
+ ]
8043
+ },
8044
+ marginTop: 16,
8045
+ marginBottom: 16,
8046
+ 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>`
8047
+ },
8048
+ "12": {
8049
+ id: "-1",
8050
+ type: 23,
8051
+ actionType: "1",
8052
+ content: "Li\xEAn h\u1EC7 Hotline",
8053
+ borderColor: "#008fe5",
8054
+ borderRadius: 4,
8055
+ borderSize: 2,
8056
+ showBorder: true,
8057
+ fixedPosition: true,
8058
+ visible: true,
8059
+ phone: options.hotline || "",
8060
+ image: {
8061
+ name: "phone.svg",
8062
+ url: "https://adtima-media.zascdn.me/2023/10/03d065a4-90b2-4deb-b684-5ff61407a47d.svg"
8063
+ },
8064
+ color: "#008fe5",
8065
+ background: "#ffffff",
8066
+ marginTop: 16,
8067
+ marginBottom: 16
8068
+ },
8069
+ "16": {
8070
+ id: "-1",
8071
+ type: 6,
8072
+ mediaType: "image",
8073
+ image: { url: defaultImages[0], name: "hero-1.png" },
8074
+ videoSetting: { autoPlay: true, loop: true }
8075
+ },
8076
+ "17": {
8077
+ id: "-1",
8078
+ type: 6,
8079
+ mediaType: "image",
8080
+ image: { url: defaultImages[1], name: "hero-2.png" },
8081
+ videoSetting: { autoPlay: true, loop: true }
8082
+ },
8083
+ "18": {
8084
+ id: "-1",
8085
+ type: 6,
8086
+ mediaType: "image",
8087
+ image: { url: defaultImages[2], name: "hero-3.png" },
8088
+ videoSetting: { autoPlay: true, loop: true }
8089
+ },
8090
+ "26": {
8091
+ id: "-1",
8092
+ type: 14,
8093
+ backgroundColor: "#f2f3f3",
8094
+ textDelta: { ops: [{ attributes: { size: "18px", bold: true }, insert: `${brandName}
8095
+ ` }] },
8096
+ textHtml: `<p><strong style="font-size: 18px;">${brandName}</strong></p>`,
8097
+ detailings: [
8098
+ {
8099
+ image: {
8100
+ url: "https://adtima-media.zascdn.me/2023/10/cba64b4d-0bd5-4504-8b6d-5f2d2562854a.png",
8101
+ name: "home.png"
8102
+ },
8103
+ textDelta: { ops: [{ insert: `\u0110\u1ECBa ch\u1EC9: ${options.address || "H\xE0 N\u1ED9i / TP.HCM"}
8104
+ ` }] },
8105
+ textHtml: `<p>\u0110\u1ECBa ch\u1EC9: ${options.address || "H\xE0 N\u1ED9i / TP.HCM"}</p>`
8106
+ },
8107
+ {
8108
+ image: {
8109
+ url: "https://adtima-media.zascdn.me/2023/10/d538811f-9232-4ef0-a130-ea2b1dda05d2.png",
8110
+ name: "phone.png"
8111
+ },
8112
+ textDelta: { ops: [{ insert: `Hotline: ${options.hotline || "1900 xxxx"}
8113
+ ` }] },
8114
+ textHtml: `<p>Hotline: ${options.hotline || "1900 xxxx"}</p>`
8115
+ }
8116
+ ]
8117
+ },
8118
+ "27": {
8119
+ id: "-1",
8120
+ type: 27,
8121
+ useCustomConsent: false
8122
+ }
8123
+ }
8124
+ };
8125
+ }
8126
+ }
8127
+ }
8128
+ };
8129
+
7448
8130
  // src/validators/automated-rules.validator.ts
7449
8131
  var AutomatedRuleScopeEnum = /* @__PURE__ */ ((AutomatedRuleScopeEnum2) => {
7450
8132
  AutomatedRuleScopeEnum2[AutomatedRuleScopeEnum2["Ads"] = 1] = "Ads";
@@ -8180,6 +8862,7 @@ export {
8180
8862
  AutomatedRuleTimeRangeEnum,
8181
8863
  ConversionLabelEnum,
8182
8864
  ConversionUrlTypeEnum,
8865
+ InstantPageFactory,
8183
8866
  MAX_REPORT_RANGE_MS,
8184
8867
  MAX_REPORT_RANGE_SECONDS,
8185
8868
  MemoryZaloSessionStore,
@@ -8259,26 +8942,36 @@ export {
8259
8942
  defaultSharedMemorySessionStore,
8260
8943
  deriveAccountKeyFromZpsid,
8261
8944
  parseZaloCookieInput,
8945
+ sanitizeCanvasKeys,
8262
8946
  validateChangeCampaignStatusParams,
8263
8947
  validateCloneInstantPageRequest,
8948
+ validateCreateArticleCampaign,
8264
8949
  validateCreateCampaignPayload,
8950
+ validateCreateCommerceCampaign,
8265
8951
  validateCreateCustomAudienceRequest,
8952
+ validateCreateDisplayCampaign,
8266
8953
  validateCreateFlowRequest,
8954
+ validateCreateFormCampaign,
8267
8955
  validateCreateFormEventAudienceRequest,
8268
8956
  validateCreateFormRequest,
8269
8957
  validateCreateInstantPageRequest,
8270
8958
  validateCreateLookalikeAudienceRequest,
8959
+ validateCreateMessageCampaign,
8271
8960
  validateCreateMessageOaEventAudienceRequest,
8272
8961
  validateCreateMessagePersonalEventAudienceRequest,
8273
8962
  validateCreateOaPageRequest,
8963
+ validateCreateOfficialAccountCampaign,
8274
8964
  validateCreatePhoneAudienceRequest,
8275
8965
  validateCreateSavedAudienceRequest,
8966
+ validateCreateVideoCampaign,
8967
+ validateCreateWebsiteCampaign,
8276
8968
  validateCropCoordinates,
8277
8969
  validateDateRangeReportRequest,
8278
8970
  validateDuplicateAdParams,
8279
8971
  validateEstimateAudienceRequest,
8280
8972
  validateGetInstantPageDetailRequest,
8281
8973
  validateGetInstantPageSharedUserRequest,
8974
+ validateInstantPageCanvas,
8282
8975
  validateListFlowsByOfficialAccountRequest,
8283
8976
  validateListFormLeadsRequest,
8284
8977
  validateListFormsByOfficialAccountRequest,
@@ -8294,10 +8987,18 @@ export {
8294
8987
  validateSearchInstantPagesRequest,
8295
8988
  validateToggleLeadNotificationRequest,
8296
8989
  validateUpdateAdPayload,
8990
+ validateUpdateArticleAd,
8991
+ validateUpdateCommerceAd,
8992
+ validateUpdateDisplayAd,
8297
8993
  validateUpdateFlowRequest,
8994
+ validateUpdateFormAd,
8298
8995
  validateUpdateInstantPageRequest,
8299
8996
  validateUpdateInstantPageSharesRequest,
8300
8997
  validateUpdateLeadNotificationIntervalRequest,
8998
+ validateUpdateMessageAd,
8999
+ validateUpdateOfficialAccountAd,
9000
+ validateUpdateVideoAd,
9001
+ validateUpdateWebsiteAd,
8301
9002
  validateUploadCustomAudiencePhoneListRequest,
8302
9003
  validateUploadMediaRequest,
8303
9004
  validateUpsertCustomReportRequest,