@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.mjs CHANGED
@@ -2329,15 +2329,46 @@ function validateUpdateAdPayload(payload, options = {}) {
2329
2329
  errors.push("Settings.Price l\xE0 b\u1EAFt bu\u1ED9c.");
2330
2330
  } else {
2331
2331
  if (payload.Type === VALID_AD_TYPES.WEBSITE) {
2332
- if (price.Type !== 1) {
2332
+ if (price.Type !== 2 && price.Type !== 1) {
2333
2333
  errors.push(
2334
- "\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."
2334
+ "\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)."
2335
2335
  );
2336
2336
  }
2337
- if (price.LimitType === 1) {
2338
- errors.push(
2339
- "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)."
2340
- );
2337
+ if (price.SpendingMethod === 1) {
2338
+ if (price.Bid !== void 0 && price.Bid !== 0) {
2339
+ warnings.push(
2340
+ "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)."
2341
+ );
2342
+ }
2343
+ if (price.LimitType === 1) {
2344
+ let days = 1;
2345
+ if (payload.StartDate && payload.EndDate && payload.EndDate > payload.StartDate) {
2346
+ days = Math.max(1, Math.ceil((payload.EndDate - payload.StartDate) / 86400));
2347
+ }
2348
+ const minTotalBudget = days * 2e5;
2349
+ if (price.Limit !== void 0 && price.Limit < minTotalBudget) {
2350
+ errors.push(
2351
+ `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.`
2352
+ );
2353
+ }
2354
+ } else if (price.LimitType === 2 || price.LimitType === 0) {
2355
+ if (price.Limit !== void 0 && price.Limit < 2e5) {
2356
+ errors.push(
2357
+ `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.`
2358
+ );
2359
+ }
2360
+ }
2361
+ } else if (price.SpendingMethod === 0) {
2362
+ if (price.Bid !== void 0 && price.Bid < 650) {
2363
+ errors.push(
2364
+ `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.`
2365
+ );
2366
+ }
2367
+ if (price.Limit !== void 0 && price.Limit < 50) {
2368
+ errors.push(
2369
+ `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}.`
2370
+ );
2371
+ }
2341
2372
  }
2342
2373
  } else if (payload.Type === VALID_AD_TYPES.VIDEO) {
2343
2374
  if (price.Type !== 1 && price.Type !== 7) {