@adtrackify/at-service-common 1.0.44 → 1.0.46

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.ts CHANGED
@@ -275,6 +275,7 @@ declare module '@adtrackify/at-service-common/clients/internal-api/shopify-app-i
275
275
  setBaseUrl: (url: string) => boolean;
276
276
  }>;
277
277
  updateShopifyAppInstall: (shopifyAppInstallId: string, updateShopifyAppInstallRequest: UpdateShopifyAppInstallRequest) => Promise<ApiResponse<ShopifyAppInstallResponseData>>;
278
+ getShopifyAppInstall: (shopifyAppInstallId: string) => Promise<ApiResponse<ShopifyAppInstallResponseData>>;
278
279
  }
279
280
 
280
281
  }
@@ -343,7 +344,9 @@ declare module '@adtrackify/at-service-common/clients/third-party/index' {
343
344
 
344
345
  }
345
346
  declare module '@adtrackify/at-service-common/clients/third-party/shopify-client' {
347
+ import Shopify from 'shopify-api-node';
346
348
  export class ShopifyClient {
349
+ static _shopify_api_version: string;
347
350
  static getConfig: (shopifyDomain: string, accessToken: string) => {
348
351
  baseURL: string;
349
352
  headers: {
@@ -401,6 +404,8 @@ declare module '@adtrackify/at-service-common/clients/third-party/shopify-client
401
404
  data: any;
402
405
  status: any;
403
406
  }>;
407
+ static appSubscriptionCreate: (shop: string, accessToken: string, planName: string, price: number, returnUrl: string, trialDays: number) => Promise<Shopify.IRecurringApplicationCharge>;
408
+ static appSubscriptionsList: (shop: string, accessToken: string) => Promise<Shopify.IRecurringApplicationCharge[]>;
404
409
  static genericShopifyPost: (url: string, accessToken: string, payload: any) => Promise<{
405
410
  headers: any;
406
411
  data: any;
package/dist/index.js CHANGED
@@ -636219,17 +636219,24 @@ var ShopifyAppInstallClient = class {
636219
636219
  log7.info("updateShopifyAppInstall", { response });
636220
636220
  return response;
636221
636221
  };
636222
+ getShopifyAppInstall = async (shopifyAppInstallId) => {
636223
+ const client2 = await this.getClient();
636224
+ const response = await client2.get(`/${shopifyAppInstallId}`);
636225
+ log7.info("getShopifyAppInstall", { response });
636226
+ return response;
636227
+ };
636222
636228
  };
636223
636229
 
636224
636230
  // src/clients/third-party/shopify-client.ts
636225
636231
  import * as log8 from "lambda-log";
636226
- var _shopify_api_version = process.env.SHOPIFY_API_VERSION;
636232
+ import Shopify from "shopify-api-node";
636227
636233
  var _ShopifyClient = class {
636228
636234
  };
636229
636235
  var ShopifyClient = _ShopifyClient;
636236
+ __publicField(ShopifyClient, "_shopify_api_version", process.env.SHOPIFY_API_VERSION);
636230
636237
  __publicField(ShopifyClient, "getConfig", (shopifyDomain, accessToken) => {
636231
636238
  const config = {
636232
- baseURL: `https://${shopifyDomain}/admin/api/${_shopify_api_version}`,
636239
+ baseURL: `https://${shopifyDomain}/admin/api/${_ShopifyClient._shopify_api_version}`,
636233
636240
  headers: {
636234
636241
  common: {
636235
636242
  "X-Shopify-Access-Token": accessToken
@@ -636256,7 +636263,7 @@ __publicField(ShopifyClient, "registerApp", async (shop, code, appKey, appSecret
636256
636263
  });
636257
636264
  __publicField(ShopifyClient, "registerWebhookTopic", async (shop, accessToken, eventBridgeArn, topic) => {
636258
636265
  const client2 = axiosHttpService();
636259
- const url = `https://${shop}/admin/api/${_shopify_api_version}/webhooks.json`;
636266
+ const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/webhooks.json`;
636260
636267
  const payload2 = {
636261
636268
  webhook: {
636262
636269
  topic,
@@ -636272,7 +636279,7 @@ __publicField(ShopifyClient, "registerWebhookTopic", async (shop, accessToken, e
636272
636279
  return res;
636273
636280
  });
636274
636281
  __publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessToken, pixelId) => {
636275
- const url = `https://${shop}/admin/api/${_shopify_api_version}/metafields.json`;
636282
+ const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/metafields.json`;
636276
636283
  const payload2 = {
636277
636284
  metafield: {
636278
636285
  namespace: "adtr",
@@ -636288,13 +636295,39 @@ __publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessTok
636288
636295
  return res;
636289
636296
  });
636290
636297
  __publicField(ShopifyClient, "getShopifyStoreProperties", async (shop, accessToken) => {
636291
- const url = `https://${shop}/admin/api/${_shopify_api_version}/shop.json`;
636298
+ const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/shop.json`;
636292
636299
  const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
636293
636300
  if (res.status >= 400) {
636294
636301
  log8.error("Failed to get Shopify Store Properties", { shop, accessToken, url });
636295
636302
  }
636296
636303
  return res;
636297
636304
  });
636305
+ __publicField(ShopifyClient, "appSubscriptionCreate", async (shop, accessToken, planName, price, returnUrl, trialDays) => {
636306
+ const config = {
636307
+ accessToken,
636308
+ shopName: shop
636309
+ };
636310
+ const client2 = new Shopify(config);
636311
+ const createSubscriptionParams = {
636312
+ name: planName,
636313
+ price,
636314
+ return_url: returnUrl,
636315
+ trial_days: trialDays
636316
+ };
636317
+ client2.recurringApplicationCharge.list();
636318
+ const response = await client2.recurringApplicationCharge.create(createSubscriptionParams);
636319
+ return response;
636320
+ });
636321
+ __publicField(ShopifyClient, "appSubscriptionsList", async (shop, accessToken) => {
636322
+ const config = {
636323
+ accessToken,
636324
+ shopName: shop
636325
+ };
636326
+ const client2 = new Shopify(config);
636327
+ client2.recurringApplicationCharge.list();
636328
+ const response = await client2.recurringApplicationCharge.list();
636329
+ return response;
636330
+ });
636298
636331
  __publicField(ShopifyClient, "genericShopifyPost", async (url, accessToken, payload2) => {
636299
636332
  const client2 = axiosHttpService();
636300
636333
  const res = await client2.post(url, payload2, { headers: { "X-Shopify-Access-Token": accessToken } });