@adtrackify/at-service-common 1.0.28 → 1.0.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adtrackify/at-service-common",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,2 +1,3 @@
1
1
  export * from './generic';
2
- export * from './internal-api';
2
+ export * from './internal-api';
3
+ export * from './third-party';
@@ -0,0 +1 @@
1
+ export * from './shopify-client';
@@ -4,7 +4,7 @@ import * as log from 'lambda-log';
4
4
  const _shopify_api_version = process.env.SHOPIFY_API_VERSION as string;
5
5
 
6
6
  export class ShopifyClient {
7
- getConfig = (shopifyDomain: string, accessToken: string) => {
7
+ static getConfig = (shopifyDomain: string, accessToken: string) => {
8
8
  const config = {
9
9
  baseURL: `https://${shopifyDomain}/admin/api/${_shopify_api_version}`,
10
10
  headers: {
@@ -15,12 +15,12 @@ export class ShopifyClient {
15
15
  };
16
16
  return config;
17
17
  };
18
- getClient = (shopifyDomain: string, accessToken: string) => {
18
+ static getClient = (shopifyDomain: string, accessToken: string) => {
19
19
  return axiosHttpService(
20
20
  this.getConfig(shopifyDomain, accessToken)
21
21
  );
22
22
  };
23
- registerApp = async (shop: string, code: string, appKey: string, appSecret: string) => {
23
+ static registerApp = async (shop: string, code: string, appKey: string, appSecret: string) => {
24
24
  const client = axiosHttpService();
25
25
  const url = 'https://' + shop + '/admin/oauth/access_token';
26
26
  const payload = {
@@ -31,7 +31,7 @@ export class ShopifyClient {
31
31
  const res = await client.post(url, payload);
32
32
  return res;
33
33
  };
34
- registerWebhookTopic = async (shop: string, accessToken: string, eventBridgeArn: string, topic: string) => {
34
+ static registerWebhookTopic = async (shop: string, accessToken: string, eventBridgeArn: string, topic: string) => {
35
35
  const client = axiosHttpService();
36
36
  const url = `https://${shop}/admin/api/${_shopify_api_version}/webhooks.json`;
37
37
  const payload = {
@@ -48,7 +48,7 @@ export class ShopifyClient {
48
48
  log.debug('Shopify Client Webhook Registration Response', { registrationResponse: res });
49
49
  return res;
50
50
  };
51
- updateShopifyAppMetafield = async (shop: string, accessToken: string, pixelId: string) => {
51
+ static updateShopifyAppMetafield = async (shop: string, accessToken: string, pixelId: string) => {
52
52
  const url = `https://${shop}/admin/api/${_shopify_api_version}/metafields.json`;
53
53
  const payload = {
54
54
  metafield: {
@@ -65,7 +65,7 @@ export class ShopifyClient {
65
65
  }
66
66
  return res;
67
67
  };
68
- getShopifyStoreProperties = async (shop: string, accessToken: string) => {
68
+ static getShopifyStoreProperties = async (shop: string, accessToken: string) => {
69
69
  const url = `https://${shop}/admin/api/${_shopify_api_version}/shop.json`;
70
70
  const res = await this.genericShopifyGet(url, accessToken);
71
71
 
@@ -74,19 +74,19 @@ export class ShopifyClient {
74
74
  }
75
75
  return res;
76
76
  };
77
- genericShopifyPost = async (url: string, accessToken: string, payload: any) => {
77
+ static genericShopifyPost = async (url: string, accessToken: string, payload: any) => {
78
78
  const client = axiosHttpService();
79
79
  const res = await client.post(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });
80
80
  log.debug('Shopify Client Response', { res });
81
81
  return res;
82
82
  };
83
- genericShopifyGet = async (url: string, accessToken: string) => {
83
+ static genericShopifyGet = async (url: string, accessToken: string) => {
84
84
  const client = axiosHttpService();
85
85
  const res = await client.get(url, { headers: { 'X-Shopify-Access-Token': accessToken } });
86
86
  log.debug('Shopify Client Response', { res });
87
87
  return res;
88
88
  };
89
- genericShopifyPut = async (url: string, accessToken: string, payload: any) => {
89
+ static genericShopifyPut = async (url: string, accessToken: string, payload: any) => {
90
90
  const client = axiosHttpService();
91
91
  const res = await client.put(url, payload, { headers: { 'X-Shopify-Access-Token': accessToken } });
92
92
  log.debug('Shopify Client Response', { res });