@zernio/node 0.2.78 → 0.2.80

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.d.mts CHANGED
@@ -928,6 +928,20 @@ type AdMetrics = {
928
928
  actions?: {
929
929
  [key: string]: (number);
930
930
  };
931
+ /**
932
+ * Monetary mirror of `actions`, from Meta's Insights `action_values[]` array. Same keying — values are the revenue attributed to each action_type, in ad-account native currency (same unit as `spend`; see the campaign node's `currency` field). Use this to compute revenue-per-event (e.g. avg purchase value). Meta-only; other platforms return {}.
933
+ */
934
+ actionValues?: {
935
+ [key: string]: (number);
936
+ };
937
+ /**
938
+ * Convenience sum of purchase-type action values — picked from `actionValues` via the same priority list as `conversions` so both fields describe the same events. In ad-account native currency. 0 when the campaign has no purchase event configured. Meta-only.
939
+ */
940
+ purchaseValue?: number;
941
+ /**
942
+ * Return on ad spend — derived as `purchaseValue / spend`. 0 when `spend` is 0. Equivalent to Meta's `purchase_roas` under default attribution. At ad-set and campaign levels this is recomputed from summed purchaseValue + spend (NOT averaged across children) so it's mathematically correct at every rollup level.
943
+ */
944
+ roas?: number;
931
945
  /**
932
946
  * Present on individual ads only, not on campaign aggregations
933
947
  */
@@ -12152,14 +12166,20 @@ type CreateStandaloneAdData = {
12152
12166
  adAccountId: string;
12153
12167
  name: string;
12154
12168
  /**
12155
- * Available goals vary by platform. Meta (Facebook/Instagram) and TikTok support all 7. LinkedIn supports all except app_promotion. Twitter/X supports engagement, traffic, awareness, video_views, app_promotion. Pinterest and Google Ads support only engagement, traffic, awareness, video_views.
12169
+ * Required on legacy + multi-creative shapes. Inherited from the ad set on the attach shape. Available goals vary by platform.
12156
12170
  */
12157
- goal: 'engagement' | 'traffic' | 'awareness' | 'video_views' | 'lead_generation' | 'conversions' | 'app_promotion';
12158
- budgetAmount: number;
12159
- budgetType: 'daily' | 'lifetime';
12171
+ goal?: 'engagement' | 'traffic' | 'awareness' | 'video_views' | 'lead_generation' | 'conversions' | 'app_promotion';
12172
+ /**
12173
+ * Required on legacy + multi-creative shapes. Inherited on attach.
12174
+ */
12175
+ budgetAmount?: number;
12176
+ /**
12177
+ * Required on legacy + multi-creative shapes. Inherited on attach.
12178
+ */
12179
+ budgetType?: 'daily' | 'lifetime';
12160
12180
  currency?: string;
12161
12181
  /**
12162
- * Required for most platforms. Max: Meta=255, Google=30, Pinterest=100
12182
+ * Required on legacy + attach shapes (skip for multi-creative — use `creatives[].headline`). Max: Meta=255, Google=30, Pinterest=100
12163
12183
  */
12164
12184
  headline?: string;
12165
12185
  /**
@@ -12167,18 +12187,43 @@ type CreateStandaloneAdData = {
12167
12187
  */
12168
12188
  longHeadline?: string;
12169
12189
  /**
12170
- * Max: Google=90, Pinterest=500
12190
+ * Required on legacy + attach shapes. Max: Google=90, Pinterest=500
12171
12191
  */
12172
- body: string;
12192
+ body?: string;
12173
12193
  /**
12174
- * Meta only
12194
+ * Required on legacy + attach shapes. Meta only.
12175
12195
  */
12176
12196
  callToAction?: 'LEARN_MORE' | 'SHOP_NOW' | 'SIGN_UP' | 'BOOK_TRAVEL' | 'CONTACT_US' | 'DOWNLOAD' | 'GET_OFFER' | 'GET_QUOTE' | 'SUBSCRIBE' | 'WATCH_MORE';
12197
+ /**
12198
+ * Required on legacy + attach shapes. Skip for multi-creative.
12199
+ */
12177
12200
  linkUrl?: string;
12178
12201
  /**
12179
- * Image URL (or video URL for TikTok). Not required for Google Search campaigns.
12202
+ * Required on legacy + attach shapes. Not required for Google Search campaigns.
12180
12203
  */
12181
12204
  imageUrl?: string;
12205
+ /**
12206
+ * Meta-only. When present, switches to the multi-creative shape:
12207
+ * creates 1 campaign + 1 ad set + N ads (one per entry here).
12208
+ * Top-level `headline` / `body` / `imageUrl` / `linkUrl` /
12209
+ * `callToAction` are ignored in this mode. Mutually exclusive with `adSetId`.
12210
+ *
12211
+ */
12212
+ creatives?: Array<{
12213
+ headline: string;
12214
+ body: string;
12215
+ imageUrl: string;
12216
+ linkUrl: string;
12217
+ callToAction: 'LEARN_MORE' | 'SHOP_NOW' | 'SIGN_UP' | 'BOOK_TRAVEL' | 'CONTACT_US' | 'DOWNLOAD' | 'GET_OFFER' | 'GET_QUOTE' | 'SUBSCRIBE' | 'WATCH_MORE';
12218
+ }>;
12219
+ /**
12220
+ * Meta-only. When present, switches to the attach shape: adds
12221
+ * one new ad to this existing ad set without creating a new
12222
+ * campaign. Budget, targeting, goal, and schedule are inherited
12223
+ * from the ad set on Meta. Mutually exclusive with `creatives[]`.
12224
+ *
12225
+ */
12226
+ adSetId?: string;
12182
12227
  /**
12183
12228
  * Google Display only
12184
12229
  */
@@ -12227,10 +12272,15 @@ type CreateStandaloneAdData = {
12227
12272
  advantageAudience?: 0 | 1;
12228
12273
  };
12229
12274
  };
12230
- type CreateStandaloneAdResponse = ({
12275
+ type CreateStandaloneAdResponse = (({
12231
12276
  ad?: Ad;
12232
12277
  message?: string;
12233
- });
12278
+ } | {
12279
+ ads?: Array<Ad>;
12280
+ platformCampaignId?: string;
12281
+ platformAdSetId?: string;
12282
+ message?: string;
12283
+ }));
12234
12284
  type CreateStandaloneAdError = (unknown | {
12235
12285
  error?: string;
12236
12286
  });
package/dist/index.d.ts CHANGED
@@ -928,6 +928,20 @@ type AdMetrics = {
928
928
  actions?: {
929
929
  [key: string]: (number);
930
930
  };
931
+ /**
932
+ * Monetary mirror of `actions`, from Meta's Insights `action_values[]` array. Same keying — values are the revenue attributed to each action_type, in ad-account native currency (same unit as `spend`; see the campaign node's `currency` field). Use this to compute revenue-per-event (e.g. avg purchase value). Meta-only; other platforms return {}.
933
+ */
934
+ actionValues?: {
935
+ [key: string]: (number);
936
+ };
937
+ /**
938
+ * Convenience sum of purchase-type action values — picked from `actionValues` via the same priority list as `conversions` so both fields describe the same events. In ad-account native currency. 0 when the campaign has no purchase event configured. Meta-only.
939
+ */
940
+ purchaseValue?: number;
941
+ /**
942
+ * Return on ad spend — derived as `purchaseValue / spend`. 0 when `spend` is 0. Equivalent to Meta's `purchase_roas` under default attribution. At ad-set and campaign levels this is recomputed from summed purchaseValue + spend (NOT averaged across children) so it's mathematically correct at every rollup level.
943
+ */
944
+ roas?: number;
931
945
  /**
932
946
  * Present on individual ads only, not on campaign aggregations
933
947
  */
@@ -12152,14 +12166,20 @@ type CreateStandaloneAdData = {
12152
12166
  adAccountId: string;
12153
12167
  name: string;
12154
12168
  /**
12155
- * Available goals vary by platform. Meta (Facebook/Instagram) and TikTok support all 7. LinkedIn supports all except app_promotion. Twitter/X supports engagement, traffic, awareness, video_views, app_promotion. Pinterest and Google Ads support only engagement, traffic, awareness, video_views.
12169
+ * Required on legacy + multi-creative shapes. Inherited from the ad set on the attach shape. Available goals vary by platform.
12156
12170
  */
12157
- goal: 'engagement' | 'traffic' | 'awareness' | 'video_views' | 'lead_generation' | 'conversions' | 'app_promotion';
12158
- budgetAmount: number;
12159
- budgetType: 'daily' | 'lifetime';
12171
+ goal?: 'engagement' | 'traffic' | 'awareness' | 'video_views' | 'lead_generation' | 'conversions' | 'app_promotion';
12172
+ /**
12173
+ * Required on legacy + multi-creative shapes. Inherited on attach.
12174
+ */
12175
+ budgetAmount?: number;
12176
+ /**
12177
+ * Required on legacy + multi-creative shapes. Inherited on attach.
12178
+ */
12179
+ budgetType?: 'daily' | 'lifetime';
12160
12180
  currency?: string;
12161
12181
  /**
12162
- * Required for most platforms. Max: Meta=255, Google=30, Pinterest=100
12182
+ * Required on legacy + attach shapes (skip for multi-creative — use `creatives[].headline`). Max: Meta=255, Google=30, Pinterest=100
12163
12183
  */
12164
12184
  headline?: string;
12165
12185
  /**
@@ -12167,18 +12187,43 @@ type CreateStandaloneAdData = {
12167
12187
  */
12168
12188
  longHeadline?: string;
12169
12189
  /**
12170
- * Max: Google=90, Pinterest=500
12190
+ * Required on legacy + attach shapes. Max: Google=90, Pinterest=500
12171
12191
  */
12172
- body: string;
12192
+ body?: string;
12173
12193
  /**
12174
- * Meta only
12194
+ * Required on legacy + attach shapes. Meta only.
12175
12195
  */
12176
12196
  callToAction?: 'LEARN_MORE' | 'SHOP_NOW' | 'SIGN_UP' | 'BOOK_TRAVEL' | 'CONTACT_US' | 'DOWNLOAD' | 'GET_OFFER' | 'GET_QUOTE' | 'SUBSCRIBE' | 'WATCH_MORE';
12197
+ /**
12198
+ * Required on legacy + attach shapes. Skip for multi-creative.
12199
+ */
12177
12200
  linkUrl?: string;
12178
12201
  /**
12179
- * Image URL (or video URL for TikTok). Not required for Google Search campaigns.
12202
+ * Required on legacy + attach shapes. Not required for Google Search campaigns.
12180
12203
  */
12181
12204
  imageUrl?: string;
12205
+ /**
12206
+ * Meta-only. When present, switches to the multi-creative shape:
12207
+ * creates 1 campaign + 1 ad set + N ads (one per entry here).
12208
+ * Top-level `headline` / `body` / `imageUrl` / `linkUrl` /
12209
+ * `callToAction` are ignored in this mode. Mutually exclusive with `adSetId`.
12210
+ *
12211
+ */
12212
+ creatives?: Array<{
12213
+ headline: string;
12214
+ body: string;
12215
+ imageUrl: string;
12216
+ linkUrl: string;
12217
+ callToAction: 'LEARN_MORE' | 'SHOP_NOW' | 'SIGN_UP' | 'BOOK_TRAVEL' | 'CONTACT_US' | 'DOWNLOAD' | 'GET_OFFER' | 'GET_QUOTE' | 'SUBSCRIBE' | 'WATCH_MORE';
12218
+ }>;
12219
+ /**
12220
+ * Meta-only. When present, switches to the attach shape: adds
12221
+ * one new ad to this existing ad set without creating a new
12222
+ * campaign. Budget, targeting, goal, and schedule are inherited
12223
+ * from the ad set on Meta. Mutually exclusive with `creatives[]`.
12224
+ *
12225
+ */
12226
+ adSetId?: string;
12182
12227
  /**
12183
12228
  * Google Display only
12184
12229
  */
@@ -12227,10 +12272,15 @@ type CreateStandaloneAdData = {
12227
12272
  advantageAudience?: 0 | 1;
12228
12273
  };
12229
12274
  };
12230
- type CreateStandaloneAdResponse = ({
12275
+ type CreateStandaloneAdResponse = (({
12231
12276
  ad?: Ad;
12232
12277
  message?: string;
12233
- });
12278
+ } | {
12279
+ ads?: Array<Ad>;
12280
+ platformCampaignId?: string;
12281
+ platformAdSetId?: string;
12282
+ message?: string;
12283
+ }));
12234
12284
  type CreateStandaloneAdError = (unknown | {
12235
12285
  error?: string;
12236
12286
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zernio/node",
3
- "version": "0.2.78",
3
+ "version": "0.2.80",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -3158,7 +3158,14 @@ export const boostPost = <ThrowOnError extends boolean = false>(options: Options
3158
3158
 
3159
3159
  /**
3160
3160
  * Create standalone ad
3161
- * Creates a paid ad with custom creative (headline, body, image/video, link). Creates the full platform campaign hierarchy.
3161
+ * Creates a paid ad with custom creative. The request body supports three mutually-exclusive shapes:
3162
+ *
3163
+ * 1. **Legacy single-creative** (all platforms). Top-level `headline` + `body` + `imageUrl` + `linkUrl` + `callToAction` create 1 campaign + 1 ad set + 1 ad.
3164
+ * 2. **Multi-creative** (Meta only — use `creatives[]` array). Creates 1 campaign + 1 ad set + N ads sharing the same budget / targeting / schedule. This is the standard performance-marketing creative-testing flow — Meta's delivery algorithm A/B tests the creatives inside a single ad set so budget isn't fragmented across N parallel campaigns.
3165
+ * 3. **Attach to existing ad set** (Meta only — pass `adSetId` + a single creative). Adds one new ad to an existing ad set without creating a new campaign. Budget, targeting, goal are inherited from the ad set on Meta.
3166
+ *
3167
+ * `creatives[]` and `adSetId` are mutually exclusive; specifying both returns 400.
3168
+ *
3162
3169
  */
3163
3170
  export const createStandaloneAd = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<CreateStandaloneAdData, ThrowOnError>) => {
3164
3171
  return (options?.client ?? client).post<CreateStandaloneAdResponse, CreateStandaloneAdError, ThrowOnError>({
@@ -343,6 +343,20 @@ export type AdMetrics = {
343
343
  actions?: {
344
344
  [key: string]: (number);
345
345
  };
346
+ /**
347
+ * Monetary mirror of `actions`, from Meta's Insights `action_values[]` array. Same keying — values are the revenue attributed to each action_type, in ad-account native currency (same unit as `spend`; see the campaign node's `currency` field). Use this to compute revenue-per-event (e.g. avg purchase value). Meta-only; other platforms return {}.
348
+ */
349
+ actionValues?: {
350
+ [key: string]: (number);
351
+ };
352
+ /**
353
+ * Convenience sum of purchase-type action values — picked from `actionValues` via the same priority list as `conversions` so both fields describe the same events. In ad-account native currency. 0 when the campaign has no purchase event configured. Meta-only.
354
+ */
355
+ purchaseValue?: number;
356
+ /**
357
+ * Return on ad spend — derived as `purchaseValue / spend`. 0 when `spend` is 0. Equivalent to Meta's `purchase_roas` under default attribution. At ad-set and campaign levels this is recomputed from summed purchaseValue + spend (NOT averaged across children) so it's mathematically correct at every rollup level.
358
+ */
359
+ roas?: number;
346
360
  /**
347
361
  * Present on individual ads only, not on campaign aggregations
348
362
  */
@@ -12462,14 +12476,20 @@ export type CreateStandaloneAdData = {
12462
12476
  adAccountId: string;
12463
12477
  name: string;
12464
12478
  /**
12465
- * Available goals vary by platform. Meta (Facebook/Instagram) and TikTok support all 7. LinkedIn supports all except app_promotion. Twitter/X supports engagement, traffic, awareness, video_views, app_promotion. Pinterest and Google Ads support only engagement, traffic, awareness, video_views.
12479
+ * Required on legacy + multi-creative shapes. Inherited from the ad set on the attach shape. Available goals vary by platform.
12466
12480
  */
12467
- goal: 'engagement' | 'traffic' | 'awareness' | 'video_views' | 'lead_generation' | 'conversions' | 'app_promotion';
12468
- budgetAmount: number;
12469
- budgetType: 'daily' | 'lifetime';
12481
+ goal?: 'engagement' | 'traffic' | 'awareness' | 'video_views' | 'lead_generation' | 'conversions' | 'app_promotion';
12482
+ /**
12483
+ * Required on legacy + multi-creative shapes. Inherited on attach.
12484
+ */
12485
+ budgetAmount?: number;
12486
+ /**
12487
+ * Required on legacy + multi-creative shapes. Inherited on attach.
12488
+ */
12489
+ budgetType?: 'daily' | 'lifetime';
12470
12490
  currency?: string;
12471
12491
  /**
12472
- * Required for most platforms. Max: Meta=255, Google=30, Pinterest=100
12492
+ * Required on legacy + attach shapes (skip for multi-creative — use `creatives[].headline`). Max: Meta=255, Google=30, Pinterest=100
12473
12493
  */
12474
12494
  headline?: string;
12475
12495
  /**
@@ -12477,18 +12497,43 @@ export type CreateStandaloneAdData = {
12477
12497
  */
12478
12498
  longHeadline?: string;
12479
12499
  /**
12480
- * Max: Google=90, Pinterest=500
12500
+ * Required on legacy + attach shapes. Max: Google=90, Pinterest=500
12481
12501
  */
12482
- body: string;
12502
+ body?: string;
12483
12503
  /**
12484
- * Meta only
12504
+ * Required on legacy + attach shapes. Meta only.
12485
12505
  */
12486
12506
  callToAction?: 'LEARN_MORE' | 'SHOP_NOW' | 'SIGN_UP' | 'BOOK_TRAVEL' | 'CONTACT_US' | 'DOWNLOAD' | 'GET_OFFER' | 'GET_QUOTE' | 'SUBSCRIBE' | 'WATCH_MORE';
12507
+ /**
12508
+ * Required on legacy + attach shapes. Skip for multi-creative.
12509
+ */
12487
12510
  linkUrl?: string;
12488
12511
  /**
12489
- * Image URL (or video URL for TikTok). Not required for Google Search campaigns.
12512
+ * Required on legacy + attach shapes. Not required for Google Search campaigns.
12490
12513
  */
12491
12514
  imageUrl?: string;
12515
+ /**
12516
+ * Meta-only. When present, switches to the multi-creative shape:
12517
+ * creates 1 campaign + 1 ad set + N ads (one per entry here).
12518
+ * Top-level `headline` / `body` / `imageUrl` / `linkUrl` /
12519
+ * `callToAction` are ignored in this mode. Mutually exclusive with `adSetId`.
12520
+ *
12521
+ */
12522
+ creatives?: Array<{
12523
+ headline: string;
12524
+ body: string;
12525
+ imageUrl: string;
12526
+ linkUrl: string;
12527
+ callToAction: 'LEARN_MORE' | 'SHOP_NOW' | 'SIGN_UP' | 'BOOK_TRAVEL' | 'CONTACT_US' | 'DOWNLOAD' | 'GET_OFFER' | 'GET_QUOTE' | 'SUBSCRIBE' | 'WATCH_MORE';
12528
+ }>;
12529
+ /**
12530
+ * Meta-only. When present, switches to the attach shape: adds
12531
+ * one new ad to this existing ad set without creating a new
12532
+ * campaign. Budget, targeting, goal, and schedule are inherited
12533
+ * from the ad set on Meta. Mutually exclusive with `creatives[]`.
12534
+ *
12535
+ */
12536
+ adSetId?: string;
12492
12537
  /**
12493
12538
  * Google Display only
12494
12539
  */
@@ -12538,10 +12583,15 @@ export type CreateStandaloneAdData = {
12538
12583
  };
12539
12584
  };
12540
12585
 
12541
- export type CreateStandaloneAdResponse = ({
12586
+ export type CreateStandaloneAdResponse = (({
12542
12587
  ad?: Ad;
12543
12588
  message?: string;
12544
- });
12589
+ } | {
12590
+ ads?: Array<Ad>;
12591
+ platformCampaignId?: string;
12592
+ platformAdSetId?: string;
12593
+ message?: string;
12594
+ }));
12545
12595
 
12546
12596
  export type CreateStandaloneAdError = (unknown | {
12547
12597
  error?: string;