@redonvn/zalo-ads-sdk 0.2.31 → 0.2.34

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.js CHANGED
@@ -2517,15 +2517,46 @@ function validateUpdateAdPayload(payload, options = {}) {
2517
2517
  errors.push("Settings.Price l\xE0 b\u1EAFt bu\u1ED9c.");
2518
2518
  } else {
2519
2519
  if (payload.Type === VALID_AD_TYPES.WEBSITE) {
2520
- if (price.Type !== 1) {
2520
+ if (price.Type !== 2 && price.Type !== 1) {
2521
2521
  errors.push(
2522
- "\u0110\u1ED1i v\u1EDBi Qu\u1EA3ng c\xE1o Website (Type 5), Price.Type b\u1EAFt bu\u1ED9c ph\u1EA3i b\u1EB1ng 1 (CPC). N\u1EBFu truy\u1EC1n 2 s\u1EBD b\u1ECB m\xE1y ch\u1EE7 l\u1ED7i."
2522
+ "\u0110\u1ED1i v\u1EDBi Qu\u1EA3ng c\xE1o Website (Type 5), Price.Type b\u1EAFt bu\u1ED9c ph\u1EA3i b\u1EB1ng 2 (L\u01B0\u1EE3t nh\u1EA5n - CPC)."
2523
2523
  );
2524
2524
  }
2525
- if (price.LimitType === 1) {
2526
- errors.push(
2527
- "Qu\u1EA3ng c\xE1o Website kh\xF4ng h\u1ED7 tr\u1EE3 LimitType: 1 (t\u1ED5ng ng\xE2n s\xE1ch). B\u1EAFt bu\u1ED9c ph\u1EA3i d\xF9ng LimitType: 0 (ng\xE2n s\xE1ch ng\xE0y)."
2528
- );
2525
+ if (price.SpendingMethod === 1) {
2526
+ if (price.Bid !== void 0 && price.Bid !== 0) {
2527
+ warnings.push(
2528
+ "Khi ch\u1ECDn 'T\u1ED5ng ng\xE2n s\xE1ch qu\u1EA3ng c\xE1o' (SpendingMethod = 1) cho Qu\u1EA3ng c\xE1o Website, tr\u01B0\u1EDDng Price.Bid n\xEAn \u0111\u1EC3 b\u1EB1ng 0 (h\u1EC7 th\u1ED1ng t\u1EF1 \u0111\u1ED9ng \u0111\u1EA5u th\u1EA7u)."
2529
+ );
2530
+ }
2531
+ if (price.LimitType === 1) {
2532
+ let days = 1;
2533
+ if (payload.StartDate && payload.EndDate && payload.EndDate > payload.StartDate) {
2534
+ days = Math.max(1, Math.ceil((payload.EndDate - payload.StartDate) / 86400));
2535
+ }
2536
+ const minTotalBudget = days * 2e5;
2537
+ if (price.Limit !== void 0 && price.Limit < minTotalBudget) {
2538
+ errors.push(
2539
+ `Ng\xE2n s\xE1ch To\xE0n l\u1ECBch ch\u1EA1y cho Qu\u1EA3ng c\xE1o Website (${days} ng\xE0y) t\u1ED1i thi\u1EC3u l\xE0 ${minTotalBudget.toLocaleString("vi-VN")} VN\u0110 (${days} ng\xE0y x 200,000\u0111/ng\xE0y). Hi\u1EC7n t\u1EA1i \u0111ang truy\u1EC1n: ${price.Limit.toLocaleString("vi-VN")}\u0111.`
2540
+ );
2541
+ }
2542
+ } else if (price.LimitType === 2 || price.LimitType === 0) {
2543
+ if (price.Limit !== void 0 && price.Limit < 2e5) {
2544
+ errors.push(
2545
+ `Ng\xE2n s\xE1ch M\u1ED7i ng\xE0y cho Qu\u1EA3ng c\xE1o Website (SpendingMethod = 1) t\u1ED1i thi\u1EC3u l\xE0 200,000 VN\u0110 (Price.Limit >= 200000). Hi\u1EC7n t\u1EA1i \u0111ang truy\u1EC1n: ${price.Limit.toLocaleString("vi-VN")}\u0111.`
2546
+ );
2547
+ }
2548
+ }
2549
+ } else if (price.SpendingMethod === 0) {
2550
+ if (price.Bid !== void 0 && price.Bid < 650) {
2551
+ errors.push(
2552
+ `Gi\xE1 \u0111\u1EB7t m\u1ED7i l\u01B0\u1EE3t nh\u1EA5n (Price.Bid) cho Qu\u1EA3ng c\xE1o Website t\u1ED1i thi\u1EC3u l\xE0 650 VN\u0110 (s\xE0n h\u1EC7 th\u1ED1ng Zalo Ads). Hi\u1EC7n t\u1EA1i \u0111ang truy\u1EC1n: ${price.Bid}\u0111.`
2553
+ );
2554
+ }
2555
+ if (price.Limit !== void 0 && price.Limit < 50) {
2556
+ errors.push(
2557
+ `S\u1ED1 l\u01B0\u1EE3ng l\u01B0\u1EE3t nh\u1EA5n (Price.Limit) cho Qu\u1EA3ng c\xE1o Website t\u1ED1i thi\u1EC3u l\xE0 50 l\u01B0\u1EE3t (minCTA = 50). Hi\u1EC7n t\u1EA1i \u0111ang truy\u1EC1n: ${price.Limit}.`
2558
+ );
2559
+ }
2529
2560
  }
2530
2561
  } else if (payload.Type === VALID_AD_TYPES.VIDEO) {
2531
2562
  if (price.Type !== 1 && price.Type !== 7) {