ggez-banking-sdk 0.0.71 → 0.0.73

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.
@@ -68,22 +68,24 @@ const Data = () => {
68
68
  };
69
69
  const dataSignUpApi = (values) => {
70
70
  const client = new clientjs_1.ClientJS();
71
- let customField = [];
71
+ let customField = {};
72
72
  if (values.referralCode && values.referralCodeType) {
73
- customField.push({
73
+ customField["referral_data"] = {
74
74
  type: enum_1.GGEZPromotionType.referral,
75
75
  referral_data: {
76
76
  referral_code: values.referralCode,
77
77
  type: +values.referralCodeType,
78
78
  },
79
- });
79
+ };
80
80
  }
81
81
  if (values.giftData) {
82
- customField.push({
83
- type: enum_1.GGEZPromotionType.gift,
84
- order_status: enum_1.OrderStatus.Pending,
85
- gift_data: values.giftData,
86
- });
82
+ customField["gift_data"] = [
83
+ {
84
+ type: enum_1.GGEZPromotionType.gift,
85
+ order_status: enum_1.OrderStatus.Pending,
86
+ gift_data: values.giftData,
87
+ },
88
+ ];
87
89
  }
88
90
  let data = {
89
91
  ...data_1.userData,
@@ -179,22 +181,24 @@ const Data = () => {
179
181
  };
180
182
  const dataSignUpWithGoogle = (values) => {
181
183
  const client = new clientjs_1.ClientJS();
182
- let customField = [];
184
+ let customField = {};
183
185
  if (values.referralCode && values.referralCodeType) {
184
- customField.push({
186
+ customField["referral_data"] = {
185
187
  type: enum_1.GGEZPromotionType.referral,
186
188
  referral_data: {
187
189
  referral_code: values.referralCode,
188
190
  type: +values.referralCodeType,
189
191
  },
190
- });
192
+ };
191
193
  }
192
194
  if (values.giftData) {
193
- customField.push({
194
- type: enum_1.GGEZPromotionType.gift,
195
- order_status: enum_1.OrderStatus.Pending,
196
- gift_data: values.giftData,
197
- });
195
+ customField["gift_data"] = [
196
+ {
197
+ type: enum_1.GGEZPromotionType.gift,
198
+ order_status: enum_1.OrderStatus.Pending,
199
+ gift_data: values.giftData,
200
+ },
201
+ ];
198
202
  }
199
203
  let data = {
200
204
  ...data_1.userData,
@@ -1,6 +1,7 @@
1
1
  import { LoginWithGoogleInterface, SignUpInterface, SignUpWithGoogleInterface, LoginRequestInterface, LoginDeviceCredentialInterface } from "../interfaces/signInterface";
2
2
  import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
3
3
  import { LimitedTokenInterface } from "../interfaces/signInterface";
4
+ import { GiftData } from "../interfaces";
4
5
  export declare const useAuth: (baseUrl: string, nodeUrl: string, userInfo: UserInfo, tokenData: LimitedTokenInterface, programId: string, geoCoordinates?: IGeoCoordinates | null, lang?: string) => {
5
6
  GetUser: (installationId: string, token?: string, userId?: string) => Promise<{
6
7
  response: import("axios").AxiosResponse<any, any>;
@@ -68,4 +69,16 @@ export declare const useAuth: (baseUrl: string, nodeUrl: string, userInfo: UserI
68
69
  message: any;
69
70
  status: string;
70
71
  }>;
72
+ incrementPromotionParticipants: (giftData: GiftData) => Promise<{
73
+ response: any;
74
+ newUser: any;
75
+ message: any;
76
+ status: string;
77
+ }>;
78
+ getPromotionDataByCode: (promotionCode: string) => Promise<{
79
+ response: any;
80
+ newUser: any;
81
+ message: any;
82
+ status: string;
83
+ }>;
71
84
  };
@@ -229,6 +229,59 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
229
229
  };
230
230
  }
231
231
  };
232
+ const getPromotionDataByCode = async (promotionCode) => {
233
+ try {
234
+ let headersData = {
235
+ isUrlEncoded: false,
236
+ token: "",
237
+ header: false,
238
+ };
239
+ let headers = headerConfig(headersData);
240
+ const response = await restApi_1.default.restApi(nodeUrl, "get", "/api/promotion/" + promotionCode, headers);
241
+ return {
242
+ response: response,
243
+ newUser: null,
244
+ message: response?.data?.result?.friendly_message,
245
+ status: "success",
246
+ };
247
+ }
248
+ catch (error) {
249
+ return {
250
+ response: error.response,
251
+ newUser: null,
252
+ message: error.message,
253
+ status: "failed",
254
+ };
255
+ }
256
+ };
257
+ const incrementPromotionParticipants = async (giftData) => {
258
+ try {
259
+ const data = {
260
+ giftData: giftData,
261
+ };
262
+ let headersData = {
263
+ isUrlEncoded: false,
264
+ token: "",
265
+ header: false,
266
+ };
267
+ let headers = headerConfig(headersData);
268
+ const response = await restApi_1.default.restApi(nodeUrl, "put", "/api/promotion", headers, data);
269
+ return {
270
+ response: response,
271
+ newUser: null,
272
+ message: response?.data?.result?.friendly_message,
273
+ status: "success",
274
+ };
275
+ }
276
+ catch (error) {
277
+ return {
278
+ response: error.response,
279
+ newUser: null,
280
+ message: error.message,
281
+ status: "failed",
282
+ };
283
+ }
284
+ };
232
285
  return {
233
286
  GetUser,
234
287
  SignUpApi,
@@ -236,6 +289,8 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
236
289
  LoginDeviceCredential,
237
290
  SignUpWithGoogle,
238
291
  LoginWithGoogle,
292
+ incrementPromotionParticipants,
293
+ getPromotionDataByCode,
239
294
  };
240
295
  };
241
296
  exports.useAuth = useAuth;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ggez-banking-sdk",
3
- "version": "0.0.71",
3
+ "version": "0.0.73",
4
4
  "description": "A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",