@zernio/node 0.2.964 → 0.2.965

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
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(index_exports);
36
36
  // package.json
37
37
  var package_default = {
38
38
  name: "@zernio/node",
39
- version: "0.2.964",
39
+ version: "0.2.965",
40
40
  description: "The official Node.js library for the Zernio API",
41
41
  main: "dist/index.js",
42
42
  module: "dist/index.mjs",
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "@zernio/node",
8
- version: "0.2.964",
8
+ version: "0.2.965",
9
9
  description: "The official Node.js library for the Zernio API",
10
10
  main: "dist/index.js",
11
11
  module: "dist/index.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zernio/node",
3
- "version": "0.2.964",
3
+ "version": "0.2.965",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -13425,7 +13425,7 @@ export const removeTrackingTagSharedAccount = <ThrowOnError extends boolean = fa
13425
13425
  };
13426
13426
 
13427
13427
  /**
13428
- * Install on a Shopify store
13428
+ * Install on a Shopify store or WordPress site
13429
13429
  * Puts the Meta pixel on a connected Shopify store's storefront and checkout through
13430
13430
  * Zernio's Shopify web pixel (a Shopify app pixel, no theme edits). The store then sends
13431
13431
  * PageView, ViewContent, AddToCart, Search, InitiateCheckout, AddPaymentInfo and Purchase
@@ -13443,6 +13443,25 @@ export const removeTrackingTagSharedAccount = <ThrowOnError extends boolean = fa
13443
13443
  * merchant to (the Shopify account id stays the same). Meta only (platform `metaads`);
13444
13444
  * other platforms return 405.
13445
13445
  *
13446
+ * **WordPress** (`storeAccountId` is a connected WordPress.com or self-hosted site): Zernio
13447
+ * adds a Custom HTML widget with the Meta pixel base code (fbevents.js, `init`, `PageView`)
13448
+ * to a widget area of the active theme (a footer area when there is one, else the first
13449
+ * active area; pass `sidebarId` to choose), then reads the widget back to confirm WordPress
13450
+ * kept the `<script>` tag. The widget carries a Zernio marker, so the call is idempotent
13451
+ * per pixel: repeating it updates or moves the same widget, and pixel code the site owner
13452
+ * pasted by hand is never touched. Several pixels can run side by side (one widget each).
13453
+ * When the site cannot run the pixel, nothing is left behind and the call answers 422
13454
+ * `tracking_tag_install_blocked` with `details.reason`:
13455
+ * - `insufficient_permissions`: the connected user lacks `edit_theme_options` (needs Administrator).
13456
+ * - `scripts_stripped`: WordPress removed the script (the user lacks `unfiltered_html`, e.g. a multisite admin who is not a Super Admin, or `DISALLOW_UNFILTERED_HTML` is set).
13457
+ * - `wordpress_com_plan`: a WordPress.com plan that strips scripts (plans without plugins).
13458
+ * - `no_widget_areas`: the theme has no widget areas (block themes such as Twenty Twenty-Five).
13459
+ * - `widgets_api_unavailable`: no widgets REST API (WordPress older than 5.8, or disabled).
13460
+ * The `error` message names the manual alternative (Meta's official WordPress plugin).
13461
+ * With `verifyHomepage` (default true) the homepage is fetched afterwards and
13462
+ * `homepageCheck` says whether the pixel is visible; `not_found` can be a stale page cache,
13463
+ * the widget read-back is authoritative.
13464
+ *
13446
13465
  */
13447
13466
  export const installTrackingTagOnStore = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<InstallTrackingTagOnStoreData, ThrowOnError>) => {
13448
13467
  return (options?.client ?? client).post<InstallTrackingTagOnStoreResponse, InstallTrackingTagOnStoreError, ThrowOnError>({
@@ -13456,6 +13475,12 @@ export const installTrackingTagOnStore = <ThrowOnError extends boolean = false>(
13456
13475
  * Whether this pixel is the one the Shopify store fires. `installedTagId` names the pixel
13457
13476
  * the store currently fires, which can be a different tag. Meta only (platform `metaads`).
13458
13477
  *
13478
+ * WordPress: whether the Zernio widget for this pixel is live (in an active widget area,
13479
+ * script intact), plus a read-only `preflight` with the theme's widget areas and, when an
13480
+ * install would be blocked, the `reason` POST would return. The preflight reads
13481
+ * capabilities only, so `ready: true` is not a guarantee: `DISALLOW_UNFILTERED_HTML` or a
13482
+ * multisite admin who is not a Super Admin still strips the script, which POST detects.
13483
+ *
13459
13484
  */
13460
13485
  export const getTrackingTagStoreInstall = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<GetTrackingTagStoreInstallData, ThrowOnError>) => {
13461
13486
  return (options?.client ?? client).get<GetTrackingTagStoreInstallResponse, GetTrackingTagStoreInstallError, ThrowOnError>({
@@ -13465,11 +13490,14 @@ export const getTrackingTagStoreInstall = <ThrowOnError extends boolean = false>
13465
13490
  };
13466
13491
 
13467
13492
  /**
13468
- * Remove from a Shopify store
13493
+ * Remove from a Shopify store or WordPress site
13469
13494
  * Removes the pixel from the store. Idempotent: nothing installed returns 200 with
13470
13495
  * `installed: false`. If the store fires a different pixel, nothing is removed and the
13471
13496
  * call answers 409 `invalid_resource_state`. Meta only (platform `metaads`).
13472
13497
  *
13498
+ * WordPress: deletes every widget Zernio created for this pixel and reports how many in
13499
+ * `removed` (0 when nothing was installed). Pixel code added by hand is left alone.
13500
+ *
13473
13501
  */
13474
13502
  export const removeTrackingTagFromStore = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<RemoveTrackingTagFromStoreData, ThrowOnError>) => {
13475
13503
  return (options?.client ?? client).delete<RemoveTrackingTagFromStoreResponse, RemoveTrackingTagFromStoreError, ThrowOnError>({
@@ -8740,26 +8740,50 @@ export type SocialAccount = {
8740
8740
  export type platform10 = 'tiktok' | 'instagram' | 'facebook' | 'youtube' | 'linkedin' | 'twitter' | 'threads' | 'pinterest' | 'reddit' | 'bluesky' | 'googlebusiness' | 'telegram' | 'snapchat' | 'discord' | 'slack' | 'whatsapp' | 'shopify' | 'wordpress' | 'linkedinads' | 'metaads' | 'pinterestads' | 'tiktokads' | 'xads' | 'googleads' | 'openaiads' | 'sms' | 'phone' | 'rcs';
8741
8741
 
8742
8742
  /**
8743
- * A tracking tag's install on a connected store (Shopify web pixel).
8743
+ * A tracking tag's install on a connected store: a Shopify web pixel, or a Custom HTML widget on a WordPress site. Fields marked Shopify or WordPress are present only for that platform.
8744
8744
  */
8745
8745
  export type StorePixelInstall = {
8746
8746
  storeAccountId?: string;
8747
- platform?: 'shopify';
8748
- shopDomain?: string;
8747
+ platform?: 'shopify' | 'wordpress';
8749
8748
  /**
8750
- * True when this tag is the pixel the store fires.
8749
+ * Shopify: this tag is the pixel the store fires. WordPress: the Zernio widget for this tag is in an active widget area with its script intact.
8751
8750
  */
8752
8751
  installed?: boolean;
8753
8752
  /**
8754
- * The Meta pixel the store fires now (may be a different tag), or null.
8753
+ * Shopify only.
8754
+ */
8755
+ shopDomain?: string;
8756
+ /**
8757
+ * Shopify only: the Meta pixel the store fires now (may be a different tag), or null.
8755
8758
  */
8756
8759
  installedTagId?: (string) | null;
8757
8760
  /**
8758
- * Shopify web pixel id, or null when nothing is installed.
8761
+ * Shopify only: web pixel id, or null when nothing is installed.
8759
8762
  */
8760
8763
  webPixelId?: (string) | null;
8764
+ /**
8765
+ * WordPress only.
8766
+ */
8767
+ siteUrl?: string;
8768
+ /**
8769
+ * WordPress only.
8770
+ */
8771
+ method?: 'wordpress_widget';
8772
+ /**
8773
+ * WordPress only: widget id, e.g. `custom_html-3`.
8774
+ */
8775
+ widgetId?: (string) | null;
8776
+ /**
8777
+ * WordPress only: widget area holding the widget.
8778
+ */
8779
+ sidebarId?: (string) | null;
8761
8780
  };
8762
8781
 
8782
+ /**
8783
+ * WordPress only.
8784
+ */
8785
+ export type method = 'wordpress_widget';
8786
+
8763
8787
  /**
8764
8788
  * Normalized, platform-agnostic ad-targeting spec. Every field is optional, an
8765
8789
  * empty object targets the platform's default broadest audience. Field names are
@@ -9315,6 +9339,11 @@ export type platform11 = 'metaads';
9315
9339
  */
9316
9340
  export type kind2 = 'pixel' | 'tag' | 'insight_tag';
9317
9341
 
9342
+ /**
9343
+ * Why a pixel cannot be installed on a WordPress site.
9344
+ */
9345
+ export type TrackingTagInstallBlockedReason = 'insufficient_permissions' | 'scripts_stripped' | 'wordpress_com_plan' | 'no_widget_areas' | 'widgets_api_unavailable';
9346
+
9318
9347
  /**
9319
9348
  * X-specific post options. The article field creates a long-form X Article and is mutually exclusive with tweet media and tweet-only options. Geo-restriction applies at the media level: media is hidden outside the specified countries while tweet text remains visible.
9320
9349
  *
@@ -48609,9 +48638,17 @@ export type RemoveTrackingTagSharedAccountError = (unknown | {
48609
48638
  export type InstallTrackingTagOnStoreData = {
48610
48639
  body: {
48611
48640
  /**
48612
- * The connected Shopify account id (platform `shopify`).
48641
+ * The connected Shopify (`shopify`) or WordPress (`wordpress`) account id.
48613
48642
  */
48614
48643
  storeAccountId: string;
48644
+ /**
48645
+ * WordPress only: widget area to use (see `install.preflight.sidebars` from GET). Defaults to a footer area.
48646
+ */
48647
+ sidebarId?: string;
48648
+ /**
48649
+ * WordPress only: fetch the homepage afterwards and report `homepageCheck`.
48650
+ */
48651
+ verifyHomepage?: boolean;
48615
48652
  };
48616
48653
  path: {
48617
48654
  accountId: string;
@@ -48626,15 +48663,36 @@ export type InstallTrackingTagOnStoreResponse = ({
48626
48663
  platform?: 'metaads';
48627
48664
  install?: (StorePixelInstall & {
48628
48665
  /**
48629
- * The pixel this install replaced on the store, if any.
48666
+ * Shopify only: the pixel this install replaced on the store, if any.
48630
48667
  */
48631
48668
  replacedTagId?: (string) | null;
48669
+ /**
48670
+ * WordPress only: name of the widget area used.
48671
+ */
48672
+ sidebarName?: string;
48673
+ /**
48674
+ * WordPress only: false when an existing Zernio widget was updated.
48675
+ */
48676
+ created?: boolean;
48677
+ /**
48678
+ * WordPress only: whether the pixel appeared in the homepage HTML. `not_found` can be a stale page cache.
48679
+ */
48680
+ homepageCheck?: 'found' | 'not_found' | 'unreachable' | 'skipped';
48632
48681
  });
48633
48682
  });
48634
48683
 
48635
48684
  export type InstallTrackingTagOnStoreError = (ErrorResponse | {
48636
48685
  error?: string;
48637
- } | unknown);
48686
+ } | unknown | {
48687
+ /**
48688
+ * What blocked the install and the manual alternative.
48689
+ */
48690
+ error?: string;
48691
+ code?: 'tracking_tag_install_blocked';
48692
+ details?: {
48693
+ reason?: TrackingTagInstallBlockedReason;
48694
+ };
48695
+ });
48638
48696
 
48639
48697
  export type GetTrackingTagStoreInstallData = {
48640
48698
  path: {
@@ -48646,7 +48704,7 @@ export type GetTrackingTagStoreInstallData = {
48646
48704
  };
48647
48705
  query: {
48648
48706
  /**
48649
- * The connected Shopify account id.
48707
+ * The connected Shopify or WordPress account id.
48650
48708
  */
48651
48709
  storeAccountId: string;
48652
48710
  };
@@ -48654,7 +48712,28 @@ export type GetTrackingTagStoreInstallData = {
48654
48712
 
48655
48713
  export type GetTrackingTagStoreInstallResponse = ({
48656
48714
  platform?: 'metaads';
48657
- install?: StorePixelInstall;
48715
+ install?: (StorePixelInstall & {
48716
+ /**
48717
+ * WordPress only.
48718
+ */
48719
+ preflight?: {
48720
+ /**
48721
+ * True when POST should be able to install.
48722
+ */
48723
+ ready?: boolean;
48724
+ /**
48725
+ * A TrackingTagInstallBlockedReason when an install would be blocked, else null.
48726
+ */
48727
+ reason?: (string) | null;
48728
+ /**
48729
+ * Active widget areas of the theme.
48730
+ */
48731
+ sidebars?: Array<{
48732
+ id?: string;
48733
+ name?: string;
48734
+ }>;
48735
+ };
48736
+ });
48658
48737
  });
48659
48738
 
48660
48739
  export type GetTrackingTagStoreInstallError = (ErrorResponse | {
@@ -48671,7 +48750,7 @@ export type RemoveTrackingTagFromStoreData = {
48671
48750
  };
48672
48751
  query: {
48673
48752
  /**
48674
- * The connected Shopify account id.
48753
+ * The connected Shopify or WordPress account id.
48675
48754
  */
48676
48755
  storeAccountId: string;
48677
48756
  };
@@ -48679,7 +48758,12 @@ export type RemoveTrackingTagFromStoreData = {
48679
48758
 
48680
48759
  export type RemoveTrackingTagFromStoreResponse = ({
48681
48760
  platform?: 'metaads';
48682
- install?: StorePixelInstall;
48761
+ install?: (StorePixelInstall & {
48762
+ /**
48763
+ * WordPress only: number of Zernio widgets deleted.
48764
+ */
48765
+ removed?: number;
48766
+ });
48683
48767
  });
48684
48768
 
48685
48769
  export type RemoveTrackingTagFromStoreError = (ErrorResponse | {