@getlatedev/node 0.2.901 → 0.2.902

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,34 @@ 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):
16851
+ * - `request_id`: the id we log the callback request under. Quote it when reporting a problem.
16852
+ * - `stage`: where the flow ended. `authorize` = the platform's consent dialog returned an
16853
+ * error or denial instead of a code. `callback` = we processed the returned code (success,
16854
+ * a selection step, or a failure). `select_page` is reserved for the destination-selection step.
16855
+ *
16856
+ * `oauth_denied` carries `error_message` and, when the platform sent them, its own values as
16857
+ * `platform_error` (e.g. `access_denied`), `platform_error_reason` (e.g. `user_denied`) and
16858
+ * `platform_error_description` (truncated to 500 characters). `is_user_fixable=true` is set when
16859
+ * the platform reported that the user cancelled or declined.
16860
+ *
16861
+ * `no_facebook_pages` comes with `is_user_fixable=true`, an `error_message` telling the user to
16862
+ * click "Edit previous settings" in Meta's dialog and tick the Page (or create one), and, when
16863
+ * Meta's token debug answered, `error_reason`:
16864
+ * - `pages_permission_declined`: the user declined the pages_show_list permission.
16865
+ * - `no_pages_granted`: the permission was granted with no Page ticked. Meta reports a user who
16866
+ * manages no Page the same way, so this covers both.
16867
+ * - `granted_pages_not_listed`: Pages were ticked but Meta listed none the user can manage.
16868
+ *
16869
+ * Headless Facebook success (`step=select_page`): `userProfile` is JSON that was
16870
+ * percent-encoded once before being set as a query param, so it is encoded twice on the wire.
16871
+ * After your framework decodes the query string once, run one more decodeURIComponent (or
16872
+ * equivalent) and then JSON.parse it. `tempToken` and `connect_token` are plain values.
16846
16873
  *
16847
16874
  * `missing_google_permissions` (YouTube and Google Business) means the user unchecked one or more
16848
16875
  * permissions on Google's consent screen. It always comes with `is_user_fixable=true`. When Google
@@ -16890,8 +16917,8 @@ type GetConnectUrlData = {
16890
16917
  * shopify_auth_failed, shopify_config_error, shopify_invalid_state, shopify_invalid_hmac,
16891
16918
  * shopify_invalid_shop, shopify_missing_scopes, shopify_callback_error
16892
16919
  *
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
16920
+ * 1. On this endpoint every upstream OAuth error is collapsed into `oauth_denied`, with the
16921
+ * provider's own values in the `platform_error*` params described above. The dedicated
16895
16922
  * ads flows below are different: they use their own denial slugs and `google_ads_auth_failed`
16896
16923
  * and `tiktok_ads_auth_failed` may carry the provider's raw error string in `error_message`.
16897
16924
  *
@@ -17150,6 +17177,11 @@ type ConnectAdsData = {
17150
17177
  * Set `force=true` to bypass that and always receivean `authUrl`.
17151
17178
  * Completing the returned OAuth refreshes the stored token
17152
17179
  * on the existing posting and ads accounts in place.
17180
+ * An `alreadyConnected` response re-runs ad discovery and webhook
17181
+ * subscriptions in the background at most once every 15 minutes per ads
17182
+ * account (always when the call changes the ad-account scope), so it is not
17183
+ * a sync trigger. To check the connection's health, read
17184
+ * GET /v1/ads/accounts?accountId=<ads account ID>.
17153
17185
  *
17154
17186
  */
17155
17187
  force?: boolean;
@@ -17688,9 +17720,13 @@ type SelectFacebookPageData = {
17688
17720
  type SelectFacebookPageResponse = ({
17689
17721
  message?: string;
17690
17722
  /**
17691
- * Redirect URL when a custom redirect_url was provided or a business Page was selected.
17723
+ * Redirect URL when a custom redirect_url was provided or a business Page was selected. On an ads connect it also carries `adsAccountId`.
17692
17724
  */
17693
17725
  redirect_url?: string;
17726
+ /**
17727
+ * 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.
17728
+ */
17729
+ adsAccountId?: string;
17694
17730
  account?: {
17695
17731
  /**
17696
17732
  * ID of the created SocialAccount
@@ -17706,10 +17742,7 @@ type SelectFacebookPageResponse = ({
17706
17742
  });
17707
17743
  type SelectFacebookPageError = (unknown | {
17708
17744
  error?: string;
17709
- } | {
17710
- error?: string;
17711
- code?: 'RECONNECT_ACCOUNT_MISMATCH';
17712
- });
17745
+ } | ErrorResponse);
17713
17746
  type ListInstagramPagesData = {
17714
17747
  query: {
17715
17748
  /**
package/dist/index.d.ts CHANGED
@@ -16842,7 +16842,34 @@ 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):
16851
+ * - `request_id`: the id we log the callback request under. Quote it when reporting a problem.
16852
+ * - `stage`: where the flow ended. `authorize` = the platform's consent dialog returned an
16853
+ * error or denial instead of a code. `callback` = we processed the returned code (success,
16854
+ * a selection step, or a failure). `select_page` is reserved for the destination-selection step.
16855
+ *
16856
+ * `oauth_denied` carries `error_message` and, when the platform sent them, its own values as
16857
+ * `platform_error` (e.g. `access_denied`), `platform_error_reason` (e.g. `user_denied`) and
16858
+ * `platform_error_description` (truncated to 500 characters). `is_user_fixable=true` is set when
16859
+ * the platform reported that the user cancelled or declined.
16860
+ *
16861
+ * `no_facebook_pages` comes with `is_user_fixable=true`, an `error_message` telling the user to
16862
+ * click "Edit previous settings" in Meta's dialog and tick the Page (or create one), and, when
16863
+ * Meta's token debug answered, `error_reason`:
16864
+ * - `pages_permission_declined`: the user declined the pages_show_list permission.
16865
+ * - `no_pages_granted`: the permission was granted with no Page ticked. Meta reports a user who
16866
+ * manages no Page the same way, so this covers both.
16867
+ * - `granted_pages_not_listed`: Pages were ticked but Meta listed none the user can manage.
16868
+ *
16869
+ * Headless Facebook success (`step=select_page`): `userProfile` is JSON that was
16870
+ * percent-encoded once before being set as a query param, so it is encoded twice on the wire.
16871
+ * After your framework decodes the query string once, run one more decodeURIComponent (or
16872
+ * equivalent) and then JSON.parse it. `tempToken` and `connect_token` are plain values.
16846
16873
  *
16847
16874
  * `missing_google_permissions` (YouTube and Google Business) means the user unchecked one or more
16848
16875
  * permissions on Google's consent screen. It always comes with `is_user_fixable=true`. When Google
@@ -16890,8 +16917,8 @@ type GetConnectUrlData = {
16890
16917
  * shopify_auth_failed, shopify_config_error, shopify_invalid_state, shopify_invalid_hmac,
16891
16918
  * shopify_invalid_shop, shopify_missing_scopes, shopify_callback_error
16892
16919
  *
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
16920
+ * 1. On this endpoint every upstream OAuth error is collapsed into `oauth_denied`, with the
16921
+ * provider's own values in the `platform_error*` params described above. The dedicated
16895
16922
  * ads flows below are different: they use their own denial slugs and `google_ads_auth_failed`
16896
16923
  * and `tiktok_ads_auth_failed` may carry the provider's raw error string in `error_message`.
16897
16924
  *
@@ -17150,6 +17177,11 @@ type ConnectAdsData = {
17150
17177
  * Set `force=true` to bypass that and always receivean `authUrl`.
17151
17178
  * Completing the returned OAuth refreshes the stored token
17152
17179
  * on the existing posting and ads accounts in place.
17180
+ * An `alreadyConnected` response re-runs ad discovery and webhook
17181
+ * subscriptions in the background at most once every 15 minutes per ads
17182
+ * account (always when the call changes the ad-account scope), so it is not
17183
+ * a sync trigger. To check the connection's health, read
17184
+ * GET /v1/ads/accounts?accountId=<ads account ID>.
17153
17185
  *
17154
17186
  */
17155
17187
  force?: boolean;
@@ -17688,9 +17720,13 @@ type SelectFacebookPageData = {
17688
17720
  type SelectFacebookPageResponse = ({
17689
17721
  message?: string;
17690
17722
  /**
17691
- * Redirect URL when a custom redirect_url was provided or a business Page was selected.
17723
+ * Redirect URL when a custom redirect_url was provided or a business Page was selected. On an ads connect it also carries `adsAccountId`.
17692
17724
  */
17693
17725
  redirect_url?: string;
17726
+ /**
17727
+ * 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.
17728
+ */
17729
+ adsAccountId?: string;
17694
17730
  account?: {
17695
17731
  /**
17696
17732
  * ID of the created SocialAccount
@@ -17706,10 +17742,7 @@ type SelectFacebookPageResponse = ({
17706
17742
  });
17707
17743
  type SelectFacebookPageError = (unknown | {
17708
17744
  error?: string;
17709
- } | {
17710
- error?: string;
17711
- code?: 'RECONNECT_ACCOUNT_MISMATCH';
17712
- });
17745
+ } | ErrorResponse);
17713
17746
  type ListInstagramPagesData = {
17714
17747
  query: {
17715
17748
  /**
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: "@getlatedev/node",
39
- version: "0.2.901",
39
+ version: "0.2.902",
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: "@getlatedev/node",
8
- version: "0.2.901",
8
+ version: "0.2.902",
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": "@getlatedev/node",
3
- "version": "0.2.901",
3
+ "version": "0.2.902",
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,34 @@ 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):
15891
+ * - `request_id`: the id we log the callback request under. Quote it when reporting a problem.
15892
+ * - `stage`: where the flow ended. `authorize` = the platform's consent dialog returned an
15893
+ * error or denial instead of a code. `callback` = we processed the returned code (success,
15894
+ * a selection step, or a failure). `select_page` is reserved for the destination-selection step.
15895
+ *
15896
+ * `oauth_denied` carries `error_message` and, when the platform sent them, its own values as
15897
+ * `platform_error` (e.g. `access_denied`), `platform_error_reason` (e.g. `user_denied`) and
15898
+ * `platform_error_description` (truncated to 500 characters). `is_user_fixable=true` is set when
15899
+ * the platform reported that the user cancelled or declined.
15900
+ *
15901
+ * `no_facebook_pages` comes with `is_user_fixable=true`, an `error_message` telling the user to
15902
+ * click "Edit previous settings" in Meta's dialog and tick the Page (or create one), and, when
15903
+ * Meta's token debug answered, `error_reason`:
15904
+ * - `pages_permission_declined`: the user declined the pages_show_list permission.
15905
+ * - `no_pages_granted`: the permission was granted with no Page ticked. Meta reports a user who
15906
+ * manages no Page the same way, so this covers both.
15907
+ * - `granted_pages_not_listed`: Pages were ticked but Meta listed none the user can manage.
15908
+ *
15909
+ * Headless Facebook success (`step=select_page`): `userProfile` is JSON that was
15910
+ * percent-encoded once before being set as a query param, so it is encoded twice on the wire.
15911
+ * After your framework decodes the query string once, run one more decodeURIComponent (or
15912
+ * equivalent) and then JSON.parse it. `tempToken` and `connect_token` are plain values.
15886
15913
  *
15887
15914
  * `missing_google_permissions` (YouTube and Google Business) means the user unchecked one or more
15888
15915
  * permissions on Google's consent screen. It always comes with `is_user_fixable=true`. When Google
@@ -15930,8 +15957,8 @@ export type GetConnectUrlData = {
15930
15957
  * shopify_auth_failed, shopify_config_error, shopify_invalid_state, shopify_invalid_hmac,
15931
15958
  * shopify_invalid_shop, shopify_missing_scopes, shopify_callback_error
15932
15959
  *
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
15960
+ * 1. On this endpoint every upstream OAuth error is collapsed into `oauth_denied`, with the
15961
+ * provider's own values in the `platform_error*` params described above. The dedicated
15935
15962
  * ads flows below are different: they use their own denial slugs and `google_ads_auth_failed`
15936
15963
  * and `tiktok_ads_auth_failed` may carry the provider's raw error string in `error_message`.
15937
15964
  *
@@ -16196,6 +16223,11 @@ export type ConnectAdsData = {
16196
16223
  * Set `force=true` to bypass that and always receivean `authUrl`.
16197
16224
  * Completing the returned OAuth refreshes the stored token
16198
16225
  * on the existing posting and ads accounts in place.
16226
+ * An `alreadyConnected` response re-runs ad discovery and webhook
16227
+ * subscriptions in the background at most once every 15 minutes per ads
16228
+ * account (always when the call changes the ad-account scope), so it is not
16229
+ * a sync trigger. To check the connection's health, read
16230
+ * GET /v1/ads/accounts?accountId=<ads account ID>.
16199
16231
  *
16200
16232
  */
16201
16233
  force?: boolean;
@@ -16757,9 +16789,13 @@ export type SelectFacebookPageData = {
16757
16789
  export type SelectFacebookPageResponse = ({
16758
16790
  message?: string;
16759
16791
  /**
16760
- * Redirect URL when a custom redirect_url was provided or a business Page was selected.
16792
+ * Redirect URL when a custom redirect_url was provided or a business Page was selected. On an ads connect it also carries `adsAccountId`.
16761
16793
  */
16762
16794
  redirect_url?: string;
16795
+ /**
16796
+ * 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.
16797
+ */
16798
+ adsAccountId?: string;
16763
16799
  account?: {
16764
16800
  /**
16765
16801
  * ID of the created SocialAccount
@@ -16776,10 +16812,7 @@ export type SelectFacebookPageResponse = ({
16776
16812
 
16777
16813
  export type SelectFacebookPageError = (unknown | {
16778
16814
  error?: string;
16779
- } | {
16780
- error?: string;
16781
- code?: 'RECONNECT_ACCOUNT_MISMATCH';
16782
- });
16815
+ } | ErrorResponse);
16783
16816
 
16784
16817
  export type ListInstagramPagesData = {
16785
16818
  query: {