Add all sdk files and all supporting files to launch the PAX.
diff --git a/dev/CONTRIBUTING.md b/dev/CONTRIBUTING.md new file mode 100644 index 0000000..4c1129e --- /dev/null +++ b/dev/CONTRIBUTING.md
@@ -0,0 +1,10 @@ +## Contributing guidelines + +Currently the GitHub respository is owned by Google Partner Ads Experience dev +team. If you find any bugs, please report to: +[Google group](https://groups.google.com/g/embedding-google-ads-with-jimdo-dev). + +## Community Guidelines + +This project follows +[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
diff --git a/dev/LICENSE b/dev/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/dev/LICENSE
@@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
diff --git a/dev/README.md b/dev/README.md new file mode 100644 index 0000000..10cfeb5 --- /dev/null +++ b/dev/README.md
@@ -0,0 +1,167 @@ +# Partner Ads Experience (PAX) API + +This Repository contains all of the interfaces needed to integrate with +Google Partner Ads experience. + +This SDK is required when you develop your app with Typescript. For javascript +developer, this SDK is not required as part of your app library. But it is also +useful to check the type declaration files during integration developing +process. + +| Directory/file | Description | +| ---------------------------- | --------------------------------------------------------------------------------------- | +| `sdk/integrator.d.ts` | The Ads app integrator entry point | +| `sdk/config` | Configuration required by the Ads app to launch the partner ads experience | +| `sdk/required_services.d.ts` | Wrapper interface for all the communication required services | +| `sdk/services` | All service interfaces required to communicate between the partner app and the Ads app | +| `sdk/services/ads` | Services provided by the Ads app and called by the partner | +| `sdk/services/partner` | Services provided by the partner and called by the Ads app | + +## Quick start + +**Note:** The following code assumes that you develop with Javascript. + +Make a local copy of the repo + +``` +git clone https://partner-code.googlesource.com/embedded-ads/partner-ads-experience +``` + +### Config setup +```js +let paxConfig = { + authAccess: { + oauthTokenAccess: { + token: ${token}, + } + }, + locale: ${locale}, + clientConfig: { + contentContainer: ${ads_container_element_id}, + }, +}; +``` +To add debugging config, set: +```js +let paxConfig = { + authAccess: { + oauthTokenAccess: { + token: ${token}, + } + }, + locale: ${locale}, + clientConfig: { + contentContainer: ${ads_container_element_id}, + }, + debuggingConfig: { + env: 'QA_PROD' + }, +}; +``` + +### Ads required services setup +Ads required services play the key role to communicate between the Ads app and +the partner app during the Ads app running time. + +#### OAuth data + +```js +let authInfoService = { + get: ${get_access_info_impl}, + fix: ${fix_access_info_impl}, +}; +``` + +#### Conversion tracking + +```js +let conversionTrackingService = { + getSupportedConversionLabels: ${get_supported_conversion_labels_impl}, +}; +``` + +#### Business info + +```js +let businessService = { + getBusinessInfo: ${get_business_info_impl}, + fixBusinessInfo: ${fix_business_info_impl}, +}; +``` + +#### Terms and conditions + +```js +let termsAndConditionsService = { + notify: ${notify_impl}, +}; +``` + +### Wrap all Ads app required services + +```js +let paxServices = { + authenticationService: authInfoService, + businessService: businessService, + conversionTrackingService: conversionTrackingService, + termsAndConditionsService: termsAndConditionsService, +}; +``` + +### Launch with the integrator + +```js +// Insert the script with integrator js file from Google gstatic.com. +let sc = document.createElement('script'); +sc.src = 'https://www.gstatic.com/pax/jimdo/dev/pax_integrator.js'; +document.body.append(sc); + +// Create an element to launch the Ads app. +let rootContainer = document.getElementById(${root_element_id}); +let adsContainer = document.createElement('div'); +adsContainer.id = ${ads_container_element_id}; +rootContainer.appendChild(adsContainer); + +// Call launch api +google.ads.integration.integrator.launchGoogleAds(paxConfig, paxServices); +``` + +### Get services supported by the Ads app + +```js +const adsAppHandler = await google.ads.integration.integrator.launchGoogleAds(paxConfig, paxServices); +const adsSupportedServices = adsAppHandler.getServices(); +``` + +#### Get conversion tracking id from the Ads app + +```js +const ctService = adsSupportedServices.conversionTrackingService; +const conversionTrackingId = (await ctService.getConversionTrackingId(${get_conversion_tracking_id_request})).conversionTrackingId; +``` + +## Contributing guidelines + +Currently the GitHub repository is owned by Google Partner Ads Experience dev +team. If you find any bugs, please report to: +[Google group](https://groups.google.com/g/embedding-google-ads-with-jimdo-dev). + +## Other resources +* TBD: to be published + +## License +``` +Copyright 2023 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +```
diff --git a/dev/sdk/config/config.d.ts b/dev/sdk/config/config.d.ts new file mode 100644 index 0000000..977b40e --- /dev/null +++ b/dev/sdk/config/config.d.ts
@@ -0,0 +1,83 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +export declare namespace google.ads.integration { + /** + * Auth access config to launch the Ads app. + */ + export interface AuthAccess { + oauthTokenAccess?: google.ads.integration.OAuthTokenAccess; + } +} +export declare namespace google.ads.integration { + export interface OAuthTokenAccess { + /** + * Access token string generated by Google OAuth 2.0. + */ + token?: string; + } +} +export declare namespace google.ads.integration { + /** + * Debugging Config to launch the Ads app. + */ + export interface DebuggingConfig { + /** + * Environment setup to launch the Ads app. Currently we support + * environments: 'PROD' and 'QA_PROD' + */ + env?: google.ads.integration.Environment; + } +} +export declare namespace google.ads.integration { + /** + * Config required to launch the Ads app. + */ + export interface Config { + authAccess?: google.ads.integration.AuthAccess; + clientConfig?: google.ads.integration.ClientConfig; + /** + * The ISO language code of Google Ads app, e.g. 'de' for Germany. + */ + locale?: string; + /** + * Debugging config to launch the Ads app. + */ + debuggingConfig?: google.ads.integration.DebuggingConfig; + } +} +export declare namespace google.ads.integration { + /** + * Client config required to launch the Ads app. + */ + export interface ClientConfig { + /** + * The container element id to launch the Ads app. + */ + contentContainer?: string; + } +} + +export declare namespace google.ads.integration { + /** + * Environment choices to launch the Ads App. + */ + export const enum Environment { + PROD = 'PROD', + QA_PROD = 'QA_PROD', + } +}
diff --git a/dev/sdk/integrator.d.ts b/dev/sdk/integrator.d.ts new file mode 100644 index 0000000..e2c78de --- /dev/null +++ b/dev/sdk/integrator.d.ts
@@ -0,0 +1,63 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {google as googleConfig} from 'config/config'; + +import {google as googleService} from './required_services'; + +/** + * Namespace for Google Ads integration. + */ +export declare namespace google.ads.integration { + /** + * The main integrator to be called by the partner to launch Google Ads. + */ + export interface Integrator { + /** + * Launch Googe Ads. + * + * @param config Config required to launch Google Ads app. + * @param services Services provided by partner which are required to + * launch Google ads app. + * + * @return Promise<AdsApp>. + */ + launchGoogleAds( + config?: googleConfig.ads.integration.Config, + services?: googleService.ads.integration.service.RequiredServicesByAds): + Promise<AdsApp>; + } + + /** + * The global singleton integrator instance to launch Google Ads app. + */ + let integrator: Integrator; + + /** + * Google Ads app handler used by the partner. + * + * This interface provides some methods to be called by the partner after + * the Ads app is launched. + */ + export interface AdsApp { + /** + * Returns all the services provided by the Ads app to support the + * communications during Ads app running phase. + */ + getServices(): + googleService.ads.integration.service.SupportedServicesFromAds; + } +}
diff --git a/dev/sdk/required_services.d.ts b/dev/sdk/required_services.d.ts new file mode 100644 index 0000000..0013c31 --- /dev/null +++ b/dev/sdk/required_services.d.ts
@@ -0,0 +1,52 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {google as adsConversionTracking} from 'service/ads/conversion-tracking-service'; +import {google as authentication} from 'service/partner/authentication-service'; +import {google as business} from 'service/partner/business-service'; +import {google as partnerConversionTracking} from 'service/partner/conversion-tracking-service'; +import {google as termsAndConditions} from 'service/partner/terms-and-conditions-service'; + +/** + * Namespace for all the services to communicate between the Ads app and the + * partner app. + */ +export declare namespace google.ads.integration.service { + /** + * The collection of services required by the Ads app. + */ + export interface RequiredServicesByAds { + authenticationService?: + authentication.ads.integration.service.partner.AuthenticationService; + + businessService?: business.ads.integration.service.partner.BusinessService; + + conversionTrackingService?: partnerConversionTracking.ads.integration + .service.partner.ConversionTrackingService; + + termsAndConditionsService?: termsAndConditions.ads.integration.service + .partner.TermsAndConditionsService; + } + + /** + * The collection of services provided by the Ads app and can be called + * by the partner. + */ + export interface SupportedServicesFromAds { + conversionTrackingIdService?: adsConversionTracking.ads.integration.service + .ads.ConversionTrackingIdService; + } +}
diff --git a/dev/sdk/service/ads/conversion-tracking-service.d.ts b/dev/sdk/service/ads/conversion-tracking-service.d.ts new file mode 100644 index 0000000..65b32c7 --- /dev/null +++ b/dev/sdk/service/ads/conversion-tracking-service.d.ts
@@ -0,0 +1,46 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +export declare namespace google.ads.integration.service.ads { + export interface GetConversionTrackingIdRequest {} +} +export declare namespace google.ads.integration.service.ads { + export interface GetConversionTrackingIdResponse { + /** + * Conversion tracking id with the format like 'AW-XXXXXXXXX' + * + * The partner attaches this id in the gTag installed on the + * website. + */ + conversionTrackingId?: string; + } +} + + +export declare namespace google.ads.integration.service.ads { + /** + * Service called by the partner to finish the conversion tracking setup. + * + * This service is provided by the Ads app. + */ + export interface ConversionTrackingIdService { + getConversionTrackingId(request: google.ads.integration.service.ads + .GetConversionTrackingIdRequest): + Promise< + google.ads.integration.service.ads.GetConversionTrackingIdResponse>; + } +}
diff --git a/dev/sdk/service/partner/authentication-service.d.ts b/dev/sdk/service/partner/authentication-service.d.ts new file mode 100644 index 0000000..85a7db2 --- /dev/null +++ b/dev/sdk/service/partner/authentication-service.d.ts
@@ -0,0 +1,120 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +export declare namespace google.ads.integration.service.partner { + export interface GetRequest {} +} +export declare namespace google.ads.integration.service.partner { + export interface GetResponse { + /** + * The Google OAuth 2.0 Access token. + * + * The access token would be valid and have no 'Bearer ' as prefix. + */ + accessToken?: string; + /** + * The current authenticated user returned from oauth response. + */ + authUser?: string; + } +} +export declare namespace google.ads.integration.service.partner { + export interface FixRequest { + /** + * Error severity for partner to make decisions. + */ + errorSeverity?: google.ads.integration.service.partner.ErrorSeverity; + /** + * Authentication specific error type for partner to understand + * the error. + */ + errorType?: google.ads.integration.service.partner.AuthenticationErrorType; + /** + * Detailed error message for partner to log. + */ + errorMessage?: string; + } +} +export declare namespace google.ads.integration.service.partner { + export interface FixResponse { + /** + * Whether or not the partner is ready for Ads app to do a retry. + */ + retryReady?: boolean; + } +} + +export declare namespace google.ads.integration.service.partner { + /** + * Generic error severity type for all xchannel error fixing + * methods. + */ + export const enum ErrorSeverity { + UNSPECIFIED = 'UNSPECIFIED', + /** + * This enum value means the error will prevent Ads App from + * rendering. + */ + FATAL = 'FATAL', + /** + * This enum value means the error will not prevent Ads App + * from rendering. + */ + WARNING = 'WARNING', + } +} +export declare namespace google.ads.integration.service.partner { + /** + * Authentication specific error type. + */ + export const enum AuthenticationErrorType { + /** + * Authentication has unknown errors. + */ + AUTH_UNKNOWN_ERROR = 'AUTH_UNKNOWN_ERROR', + /** + * Access token expired. + */ + AUTH_TOKEN_EXPIRED = 'AUTH_TOKEN_EXPIRED', + } +} + +export declare namespace google.ads.integration.service.partner { + /** + * Service called by the Ads app to do authentication. + * + * This service is provided by the partner. + */ + export interface AuthenticationService { + /** + * Gets OAuth access token and authenticated user index to do + * authentication. + * + * The OAuth access token would be expired after a given period + * of time. (e.g. one hour). This method would be called by the + * Ads app when the current access token is expired. + */ + get(request: google.ads.integration.service.partner.GetRequest): + Promise<google.ads.integration.service.partner.GetResponse>; + /** + * Fix the invalid authentication fields that Ads app got from + * the partner. + */ + fix(request: google.ads.integration.service.partner.FixRequest): + Promise<google.ads.integration.service.partner.FixResponse>; + } +}
diff --git a/dev/sdk/service/partner/business-service.d.ts b/dev/sdk/service/partner/business-service.d.ts new file mode 100644 index 0000000..b9a1a57 --- /dev/null +++ b/dev/sdk/service/partner/business-service.d.ts
@@ -0,0 +1,118 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +export declare namespace google.ads.integration.service.partner { + export interface GetBusinessInfoRequest {} +} +export declare namespace google.ads.integration.service.partner { + export interface GetBusinessInfoResponse { + businessName?: string; + businessUrl?: string; + } +} +export declare namespace google.ads.integration.service.partner { + export interface FixBusinessInfoRequest { + /** + * Error severity for partner to make decisions. + */ + errorSeverity?: google.ads.integration.service.partner.ErrorSeverity; + /** + * Business info specific error type for partner to understand + * the error. + */ + errorType?: google.ads.integration.service.partner.BusinessInfoErrorType; + /** + * Detailed error message for partner to log. + */ + errorMessage?: string; + } +} +export declare namespace google.ads.integration.service.partner { + export interface FixBusinessInfoResponse { + /** + * Whether or not the partner is ready for Ads app to do a retry. + */ + retryReady?: boolean; + } +} + +export declare namespace google.ads.integration.service.partner { + /** + * Generic error severity type for all xchannel error fixing + * methods. + */ + export const enum ErrorSeverity { + UNSPECIFIED = 'UNSPECIFIED', + /** + * This enum value means the error will prevent Ads App from + * rendering. + */ + FATAL = 'FATAL', + /** + * This enum value means the error will not prevent Ads App + * from rendering. + */ + WARNING = 'WARNING', + } +} +export declare namespace google.ads.integration.service.partner { + /** + * Business info specific error type. + */ + export const enum BusinessInfoErrorType { + /** + * Business url has unknown errors. + */ + URL_UNKNOWN_ERROR = 'URL_UNKNOWN_ERROR', + /** + * Business url could be empty, exceeding maximum allowable + * length(512), or syntactically invalid. + */ + URL_SYNTAX_ERROR = 'URL_SYNTAX_ERROR', + /** + * Business url is unreachable because it is not found, + * unauthenticated, has too many redirects or a bad redirect. + */ + URL_UNREACHABLE = 'URL_UNREACHABLE', + /** + * Business url is blocklisted by Google Ads to advertise. + */ + URL_INELIGIBLE = 'URL_INELIGIBLE', + } +} + +export declare namespace google.ads.integration.service.partner { + /** + * Service called by the Ads app to get business info from + * the partner. + */ + export interface BusinessService { + /** + * Gets business info to be used in ads campaign construction. + */ + getBusinessInfo( + request: google.ads.integration.service.partner.GetBusinessInfoRequest): + Promise<google.ads.integration.service.partner.GetBusinessInfoResponse>; + /** + * Fix the invalid business info fields that Ads app got from + * the partner. + */ + fixBusinessInfo( + request: google.ads.integration.service.partner.FixBusinessInfoRequest): + Promise<google.ads.integration.service.partner.FixBusinessInfoResponse>; + } +}
diff --git a/dev/sdk/service/partner/conversion-tracking-service.d.ts b/dev/sdk/service/partner/conversion-tracking-service.d.ts new file mode 100644 index 0000000..3f643f4 --- /dev/null +++ b/dev/sdk/service/partner/conversion-tracking-service.d.ts
@@ -0,0 +1,64 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +export declare namespace google.ads.integration.service.partner { + export interface GetConversionLabelsRequest {} +} +export declare namespace google.ads.integration.service.partner { + export interface GetConversionLabelsResponse { + /** + * The list of conversion goal labels supported by the partner. + * + * The list of conversion goal labels would be pre-defined + * between Google Ads and the partner. + * The full list of conversion goal labels are: + * - purchase + * - subscribe + * - add_to_cart + * - begin_checkout + * - book_appointment + * - contact + * - request_quote + * - phone_call_leads + * - get_directions + * - submit_lead_form + * - sign_up + * + */ + conversionLabels?: Array<string>; + } +} + + +export declare namespace google.ads.integration.service.partner { + /** + * Service called by the Ads app to power conversion + * tracking setup. + * + * This service is provided by the partner. + */ + export interface ConversionTrackingService { + /** + * Gets a list of supported conversion goal labels supported by + * the partner. + */ + getSupportedConversionLabels(request: google.ads.integration.service.partner + .GetConversionLabelsRequest): + Promise< + google.ads.integration.service.partner.GetConversionLabelsResponse>; + } +}
diff --git a/dev/sdk/service/partner/error-severity.d.ts b/dev/sdk/service/partner/error-severity.d.ts new file mode 100644 index 0000000..d7a3865 --- /dev/null +++ b/dev/sdk/service/partner/error-severity.d.ts
@@ -0,0 +1,37 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +export declare namespace google.ads.integration.service.partner { + /** + * Generic error severity type for all xchannel error fixing + * methods. + */ + export const enum ErrorSeverity { + UNSPECIFIED = 'UNSPECIFIED', + /** + * This enum value means the error will prevent Ads App from + * rendering. + */ + FATAL = 'FATAL', + /** + * This enum value means the error will not prevent Ads App + * from rendering. + */ + WARNING = 'WARNING', + } +}
diff --git a/dev/sdk/service/partner/terms-and-conditions-service.d.ts b/dev/sdk/service/partner/terms-and-conditions-service.d.ts new file mode 100644 index 0000000..e83c551 --- /dev/null +++ b/dev/sdk/service/partner/terms-and-conditions-service.d.ts
@@ -0,0 +1,44 @@ +/** + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +export declare namespace google.ads.integration.service.partner { + export interface NotifyRequest { + /** + * Whether the user has accepted the term of condition. + */ + isAccepted?: boolean; + } +} +export declare namespace google.ads.integration.service.partner { + export interface NotifyResponse {} +} + + +export declare namespace google.ads.integration.service.partner { + /** + * Service called by the Ads app to notify partner whether the + * user has accepted terms and conditions. + */ + export interface TermsAndConditionsService { + /** + * Notify partner whether the user has accepted terms and + * conditions. + */ + notify(request: google.ads.integration.service.partner.NotifyRequest): + Promise<google.ads.integration.service.partner.NotifyResponse>; + } +}