@zernio/node 0.2.901 → 0.2.903

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
@@ -16842,7 +16842,36 @@ type GetConnectUrlData = {
16842
16842
  *
16843
16843
  * On failure, the browser is sent to the same redirect_url with `error` and `platform` appended.
16844
16844
  * `error` and `platform` are always present. `error_message`, `is_user_fixable`, `reason`,
16845
- * `dashboard_url` and `missing_scopes` are conditional and must be treated as optional.
16845
+ * `dashboard_url`, `missing_scopes`, `error_reason` and the `platform_error*` params are
16846
+ * conditional and must be treated as optional. Your own query params are kept on every
16847
+ * redirect, but ours overwrite a param of yours with the same name. On an error redirect the
16848
+ * internal `headless`, `adsConnect` and `adsScope` markers we add during the flow are removed.
16849
+ *
16850
+ * Correlation (every redirect from an OAuth callback, success and failure, and the
16851
+ * `redirect_url` returned by the selection endpoints such as POST /v1/connect/facebook/select-page):
16852
+ * - `request_id`: the id we log that request under. Quote it when reporting a problem.
16853
+ * - `stage`: where the flow ended. `authorize` = the platform's consent dialog returned an
16854
+ * error or denial instead of a code. `callback` = we processed the returned code (success,
16855
+ * a selection step, or a failure). `select_page` = the destination-selection endpoint
16856
+ * (page, account, organization, board, location, profile or phone number) completed it.
16857
+ *
16858
+ * `oauth_denied` carries `error_message` and, when the platform sent them, its own values as
16859
+ * `platform_error` (e.g. `access_denied`), `platform_error_reason` (e.g. `user_denied`) and
16860
+ * `platform_error_description` (truncated to 500 characters). `is_user_fixable=true` is set when
16861
+ * the platform reported that the user cancelled or declined.
16862
+ *
16863
+ * `no_facebook_pages` comes with `is_user_fixable=true`, an `error_message` telling the user to
16864
+ * click "Edit previous settings" in Meta's dialog and tick the Page (or create one), and, when
16865
+ * Meta's token debug answered, `error_reason`:
16866
+ * - `pages_permission_declined`: the user declined the pages_show_list permission.
16867
+ * - `no_pages_granted`: the permission was granted with no Page ticked. Meta reports a user who
16868
+ * manages no Page the same way, so this covers both.
16869
+ * - `granted_pages_not_listed`: Pages were ticked but Meta listed none the user can manage.
16870
+ *
16871
+ * Headless Facebook success (`step=select_page`): `userProfile` is JSON that was
16872
+ * percent-encoded once before being set as a query param, so it is encoded twice on the wire.
16873
+ * After your framework decodes the query string once, run one more decodeURIComponent (or
16874
+ * equivalent) and then JSON.parse it. `tempToken` and `connect_token` are plain values.
16846
16875
  *
16847
16876
  * `missing_google_permissions` (YouTube and Google Business) means the user unchecked one or more
16848
16877
  * permissions on Google's consent screen. It always comes with `is_user_fixable=true`. When Google
@@ -16890,8 +16919,8 @@ type GetConnectUrlData = {
16890
16919
  * shopify_auth_failed, shopify_config_error, shopify_invalid_state, shopify_invalid_hmac,
16891
16920
  * shopify_invalid_shop, shopify_missing_scopes, shopify_callback_error
16892
16921
  *
16893
- * 1. On this endpoint every upstream OAuth error is collapsed into `oauth_denied`. The
16894
- * provider's own value (for example Meta's `access_denied`) is not forwarded. The dedicated
16922
+ * 1. On this endpoint every upstream OAuth error is collapsed into `oauth_denied`, with the
16923
+ * provider's own values in the `platform_error*` params described above. The dedicated
16895
16924
  * ads flows below are different: they use their own denial slugs and `google_ads_auth_failed`
16896
16925
  * and `tiktok_ads_auth_failed` may carry the provider's raw error string in `error_message`.
16897
16926
  *
@@ -17150,6 +17179,11 @@ type ConnectAdsData = {
17150
17179
  * Set `force=true` to bypass that and always receivean `authUrl`.
17151
17180
  * Completing the returned OAuth refreshes the stored token
17152
17181
  * on the existing posting and ads accounts in place.
17182
+ * An `alreadyConnected` response re-runs ad discovery and webhook
17183
+ * subscriptions in the background at most once every 15 minutes per ads
17184
+ * account (always when the call changes the ad-account scope), so it is not
17185
+ * a sync trigger. To check the connection's health, read
17186
+ * GET /v1/ads/accounts?accountId=<ads account ID>.
17153
17187
  *
17154
17188
  */
17155
17189
  force?: boolean;
@@ -17688,9 +17722,13 @@ type SelectFacebookPageData = {
17688
17722
  type SelectFacebookPageResponse = ({
17689
17723
  message?: string;
17690
17724
  /**
17691
- * Redirect URL when a custom redirect_url was provided or a business Page was selected.
17725
+ * Redirect URL when a custom redirect_url was provided or a business Page was selected. On an ads connect it also carries `adsAccountId`.
17692
17726
  */
17693
17727
  redirect_url?: string;
17728
+ /**
17729
+ * Ads connect only (the redirect_url carries adsConnect=true, as it does after GET /v1/connect/{platform}/ads). The metaads SocialAccount ID to use with the /v1/ads endpoints. `account.accountId` is the Facebook posting account. Absent when the ads account could not be created.
17730
+ */
17731
+ adsAccountId?: string;
17694
17732
  account?: {
17695
17733
  /**
17696
17734
  * ID of the created SocialAccount
@@ -17706,10 +17744,7 @@ type SelectFacebookPageResponse = ({
17706
17744
  });
17707
17745
  type SelectFacebookPageError = (unknown | {
17708
17746
  error?: string;
17709
- } | {
17710
- error?: string;
17711
- code?: 'RECONNECT_ACCOUNT_MISMATCH';
17712
- });
17747
+ } | ErrorResponse);
17713
17748
  type ListInstagramPagesData = {
17714
17749
  query: {
17715
17750
  /**
package/dist/index.d.ts CHANGED
@@ -16842,7 +16842,36 @@ type GetConnectUrlData = {
16842
16842
  *
16843
16843
  * On failure, the browser is sent to the same redirect_url with `error` and `platform` appended.
16844
16844
  * `error` and `platform` are always present. `error_message`, `is_user_fixable`, `reason`,
16845
- * `dashboard_url` and `missing_scopes` are conditional and must be treated as optional.
16845
+ * `dashboard_url`, `missing_scopes`, `error_reason` and the `platform_error*` params are
16846
+ * conditional and must be treated as optional. Your own query params are kept on every
16847
+ * redirect, but ours overwrite a param of yours with the same name. On an error redirect the
16848
+ * internal `headless`, `adsConnect` and `adsScope` markers we add during the flow are removed.
16849
+ *
16850
+ * Correlation (every redirect from an OAuth callback, success and failure, and the
16851
+ * `redirect_url` returned by the selection endpoints such as POST /v1/connect/facebook/select-page):
16852
+ * - `request_id`: the id we log that request under. Quote it when reporting a problem.
16853
+ * - `stage`: where the flow ended. `authorize` = the platform's consent dialog returned an
16854
+ * error or denial instead of a code. `callback` = we processed the returned code (success,
16855
+ * a selection step, or a failure). `select_page` = the destination-selection endpoint
16856
+ * (page, account, organization, board, location, profile or phone number) completed it.
16857
+ *
16858
+ * `oauth_denied` carries `error_message` and, when the platform sent them, its own values as
16859
+ * `platform_error` (e.g. `access_denied`), `platform_error_reason` (e.g. `user_denied`) and
16860
+ * `platform_error_description` (truncated to 500 characters). `is_user_fixable=true` is set when
16861
+ * the platform reported that the user cancelled or declined.
16862
+ *
16863
+ * `no_facebook_pages` comes with `is_user_fixable=true`, an `error_message` telling the user to
16864
+ * click "Edit previous settings" in Meta's dialog and tick the Page (or create one), and, when
16865
+ * Meta's token debug answered, `error_reason`:
16866
+ * - `pages_permission_declined`: the user declined the pages_show_list permission.
16867
+ * - `no_pages_granted`: the permission was granted with no Page ticked. Meta reports a user who
16868
+ * manages no Page the same way, so this covers both.
16869
+ * - `granted_pages_not_listed`: Pages were ticked but Meta listed none the user can manage.
16870
+ *
16871
+ * Headless Facebook success (`step=select_page`): `userProfile` is JSON that was
16872
+ * percent-encoded once before being set as a query param, so it is encoded twice on the wire.
16873
+ * After your framework decodes the query string once, run one more decodeURIComponent (or
16874
+ * equivalent) and then JSON.parse it. `tempToken` and `connect_token` are plain values.
16846
16875
  *
16847
16876
  * `missing_google_permissions` (YouTube and Google Business) means the user unchecked one or more
16848
16877
  * permissions on Google's consent screen. It always comes with `is_user_fixable=true`. When Google
@@ -16890,8 +16919,8 @@ type GetConnectUrlData = {
16890
16919
  * shopify_auth_failed, shopify_config_error, shopify_invalid_state, shopify_invalid_hmac,
16891
16920
  * shopify_invalid_shop, shopify_missing_scopes, shopify_callback_error
16892
16921
  *
16893
- * 1. On this endpoint every upstream OAuth error is collapsed into `oauth_denied`. The
16894
- * provider's own value (for example Meta's `access_denied`) is not forwarded. The dedicated
16922
+ * 1. On this endpoint every upstream OAuth error is collapsed into `oauth_denied`, with the
16923
+ * provider's own values in the `platform_error*` params described above. The dedicated
16895
16924
  * ads flows below are different: they use their own denial slugs and `google_ads_auth_failed`
16896
16925
  * and `tiktok_ads_auth_failed` may carry the provider's raw error string in `error_message`.
16897
16926
  *
@@ -17150,6 +17179,11 @@ type ConnectAdsData = {
17150
17179
  * Set `force=true` to bypass that and always receivean `authUrl`.
17151
17180
  * Completing the returned OAuth refreshes the stored token
17152
17181
  * on the existing posting and ads accounts in place.
17182
+ * An `alreadyConnected` response re-runs ad discovery and webhook
17183
+ * subscriptions in the background at most once every 15 minutes per ads
17184
+ * account (always when the call changes the ad-account scope), so it is not
17185
+ * a sync trigger. To check the connection's health, read
17186
+ * GET /v1/ads/accounts?accountId=<ads account ID>.
17153
17187
  *
17154
17188
  */
17155
17189
  force?: boolean;
@@ -17688,9 +17722,13 @@ type SelectFacebookPageData = {
17688
17722
  type SelectFacebookPageResponse = ({
17689
17723
  message?: string;
17690
17724
  /**
17691
- * Redirect URL when a custom redirect_url was provided or a business Page was selected.
17725
+ * Redirect URL when a custom redirect_url was provided or a business Page was selected. On an ads connect it also carries `adsAccountId`.
17692
17726
  */
17693
17727
  redirect_url?: string;
17728
+ /**
17729
+ * Ads connect only (the redirect_url carries adsConnect=true, as it does after GET /v1/connect/{platform}/ads). The metaads SocialAccount ID to use with the /v1/ads endpoints. `account.accountId` is the Facebook posting account. Absent when the ads account could not be created.
17730
+ */
17731
+ adsAccountId?: string;
17694
17732
  account?: {
17695
17733
  /**
17696
17734
  * ID of the created SocialAccount
@@ -17706,10 +17744,7 @@ type SelectFacebookPageResponse = ({
17706
17744
  });
17707
17745
  type SelectFacebookPageError = (unknown | {
17708
17746
  error?: string;
17709
- } | {
17710
- error?: string;
17711
- code?: 'RECONNECT_ACCOUNT_MISMATCH';
17712
- });
17747
+ } | ErrorResponse);
17713
17748
  type ListInstagramPagesData = {
17714
17749
  query: {
17715
17750
  /**
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.901",
39
+ version: "0.2.903",
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.901",
8
+ version: "0.2.903",
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.901",
3
+ "version": "0.2.903",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1651,9 +1651,20 @@ export const handleOAuthCallback = <ThrowOnError extends boolean = false>(option
1651
1651
  * return 400 with available Page IDs for API integrations; restart with pageId.
1652
1652
  * Dashboard session logins use the sole current grant automatically or open the existing
1653
1653
  * Facebook Page picker for several grants, including reconnects. Selection completes
1654
- * the Meta Ads connection. With no Pages granted the callback returns
1655
- * 400 with instructions to connect again and grant a Page.
1654
+ * the Meta Ads connection.
1656
1655
  * Success redirects with connected=metaads, profileId and accountId.
1656
+ * Every failure after Meta's dialog redirects to redirect_url (or the dashboard) with
1657
+ * `error`, `platform=metaads`, `error_message`, `request_id` and `stage`, plus
1658
+ * `is_user_fixable` and `error_reason` when known. `error` is the API error code:
1659
+ * `invalid_field_value` with `error_reason` `no_pages_granted` (no Page ticked),
1660
+ * `page_not_granted` (pageId not in the grant), `ad_accounts_not_granted` or
1661
+ * `reconnect_mismatch` (the grant shares no ad account with the existing connection);
1662
+ * `reconnect_required`, `ads_addon_required`, `payment_required` and the profile gates of
1663
+ * GET /v1/connect/{platform}; `invalid_state` with `error_reason=state_expired` after the
1664
+ * 30-minute window; `connection_failed` when Meta refuses the code (e.g. a replayed callback).
1665
+ * A denial in the dialog is `meta_ads_authorization_denied` with the `platform_error*` params.
1666
+ * Only a state that cannot be decrypted at all still answers 400 JSON, since it names no
1667
+ * redirect_url.
1657
1668
  * Business login reports metadata.tokenType=system-user in GET /v1/accounts. An absent
1658
1669
  * Meta expires_in leaves tokenExpiresAt absent; no personal-token re-exchange occurs.
1659
1670
  * Subsequent classic requests can change the ad-account scope using the business token;
@@ -15882,7 +15882,36 @@ export type GetConnectUrlData = {
15882
15882
  *
15883
15883
  * On failure, the browser is sent to the same redirect_url with `error` and `platform` appended.
15884
15884
  * `error` and `platform` are always present. `error_message`, `is_user_fixable`, `reason`,
15885
- * `dashboard_url` and `missing_scopes` are conditional and must be treated as optional.
15885
+ * `dashboard_url`, `missing_scopes`, `error_reason` and the `platform_error*` params are
15886
+ * conditional and must be treated as optional. Your own query params are kept on every
15887
+ * redirect, but ours overwrite a param of yours with the same name. On an error redirect the
15888
+ * internal `headless`, `adsConnect` and `adsScope` markers we add during the flow are removed.
15889
+ *
15890
+ * Correlation (every redirect from an OAuth callback, success and failure, and the
15891
+ * `redirect_url` returned by the selection endpoints such as POST /v1/connect/facebook/select-page):
15892
+ * - `request_id`: the id we log that request under. Quote it when reporting a problem.
15893
+ * - `stage`: where the flow ended. `authorize` = the platform's consent dialog returned an
15894
+ * error or denial instead of a code. `callback` = we processed the returned code (success,
15895
+ * a selection step, or a failure). `select_page` = the destination-selection endpoint
15896
+ * (page, account, organization, board, location, profile or phone number) completed it.
15897
+ *
15898
+ * `oauth_denied` carries `error_message` and, when the platform sent them, its own values as
15899
+ * `platform_error` (e.g. `access_denied`), `platform_error_reason` (e.g. `user_denied`) and
15900
+ * `platform_error_description` (truncated to 500 characters). `is_user_fixable=true` is set when
15901
+ * the platform reported that the user cancelled or declined.
15902
+ *
15903
+ * `no_facebook_pages` comes with `is_user_fixable=true`, an `error_message` telling the user to
15904
+ * click "Edit previous settings" in Meta's dialog and tick the Page (or create one), and, when
15905
+ * Meta's token debug answered, `error_reason`:
15906
+ * - `pages_permission_declined`: the user declined the pages_show_list permission.
15907
+ * - `no_pages_granted`: the permission was granted with no Page ticked. Meta reports a user who
15908
+ * manages no Page the same way, so this covers both.
15909
+ * - `granted_pages_not_listed`: Pages were ticked but Meta listed none the user can manage.
15910
+ *
15911
+ * Headless Facebook success (`step=select_page`): `userProfile` is JSON that was
15912
+ * percent-encoded once before being set as a query param, so it is encoded twice on the wire.
15913
+ * After your framework decodes the query string once, run one more decodeURIComponent (or
15914
+ * equivalent) and then JSON.parse it. `tempToken` and `connect_token` are plain values.
15886
15915
  *
15887
15916
  * `missing_google_permissions` (YouTube and Google Business) means the user unchecked one or more
15888
15917
  * permissions on Google's consent screen. It always comes with `is_user_fixable=true`. When Google
@@ -15930,8 +15959,8 @@ export type GetConnectUrlData = {
15930
15959
  * shopify_auth_failed, shopify_config_error, shopify_invalid_state, shopify_invalid_hmac,
15931
15960
  * shopify_invalid_shop, shopify_missing_scopes, shopify_callback_error
15932
15961
  *
15933
- * 1. On this endpoint every upstream OAuth error is collapsed into `oauth_denied`. The
15934
- * provider's own value (for example Meta's `access_denied`) is not forwarded. The dedicated
15962
+ * 1. On this endpoint every upstream OAuth error is collapsed into `oauth_denied`, with the
15963
+ * provider's own values in the `platform_error*` params described above. The dedicated
15935
15964
  * ads flows below are different: they use their own denial slugs and `google_ads_auth_failed`
15936
15965
  * and `tiktok_ads_auth_failed` may carry the provider's raw error string in `error_message`.
15937
15966
  *
@@ -16196,6 +16225,11 @@ export type ConnectAdsData = {
16196
16225
  * Set `force=true` to bypass that and always receivean `authUrl`.
16197
16226
  * Completing the returned OAuth refreshes the stored token
16198
16227
  * on the existing posting and ads accounts in place.
16228
+ * An `alreadyConnected` response re-runs ad discovery and webhook
16229
+ * subscriptions in the background at most once every 15 minutes per ads
16230
+ * account (always when the call changes the ad-account scope), so it is not
16231
+ * a sync trigger. To check the connection's health, read
16232
+ * GET /v1/ads/accounts?accountId=<ads account ID>.
16199
16233
  *
16200
16234
  */
16201
16235
  force?: boolean;
@@ -16757,9 +16791,13 @@ export type SelectFacebookPageData = {
16757
16791
  export type SelectFacebookPageResponse = ({
16758
16792
  message?: string;
16759
16793
  /**
16760
- * Redirect URL when a custom redirect_url was provided or a business Page was selected.
16794
+ * Redirect URL when a custom redirect_url was provided or a business Page was selected. On an ads connect it also carries `adsAccountId`.
16761
16795
  */
16762
16796
  redirect_url?: string;
16797
+ /**
16798
+ * Ads connect only (the redirect_url carries adsConnect=true, as it does after GET /v1/connect/{platform}/ads). The metaads SocialAccount ID to use with the /v1/ads endpoints. `account.accountId` is the Facebook posting account. Absent when the ads account could not be created.
16799
+ */
16800
+ adsAccountId?: string;
16763
16801
  account?: {
16764
16802
  /**
16765
16803
  * ID of the created SocialAccount
@@ -16776,10 +16814,7 @@ export type SelectFacebookPageResponse = ({
16776
16814
 
16777
16815
  export type SelectFacebookPageError = (unknown | {
16778
16816
  error?: string;
16779
- } | {
16780
- error?: string;
16781
- code?: 'RECONNECT_ACCOUNT_MISMATCH';
16782
- });
16817
+ } | ErrorResponse);
16783
16818
 
16784
16819
  export type ListInstagramPagesData = {
16785
16820
  query: {