@longvansoftware/storefront-js-client 2.2.7-beta.12 → 2.2.7-beta.13

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.
@@ -5,3 +5,4 @@ export declare const GET_CAMPAIGN_ACTIVE_NOW: import("graphql").DocumentNode;
5
5
  export declare const GET_PROMOTION_PRODUCT_PRICE: import("graphql").DocumentNode;
6
6
  export declare const GET_VOUCHER_AVAILABLE_FOR_CUSTOMER: import("graphql").DocumentNode;
7
7
  export declare const SUGGEST_VOUCHER: import("graphql").DocumentNode;
8
+ export declare const GET_CAMPAIGN_ACTION_BY_ID: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SUGGEST_VOUCHER = exports.GET_VOUCHER_AVAILABLE_FOR_CUSTOMER = exports.GET_PROMOTION_PRODUCT_PRICE = exports.GET_CAMPAIGN_ACTIVE_NOW = exports.CHECK_VALID_VOUCHER = exports.GET_VOUCHERS = exports.GET_CAMPAIGN_ACTION_ACTIVE_NOW = void 0;
3
+ exports.GET_CAMPAIGN_ACTION_BY_ID = exports.SUGGEST_VOUCHER = exports.GET_VOUCHER_AVAILABLE_FOR_CUSTOMER = exports.GET_PROMOTION_PRODUCT_PRICE = exports.GET_CAMPAIGN_ACTIVE_NOW = exports.CHECK_VALID_VOUCHER = exports.GET_VOUCHERS = exports.GET_CAMPAIGN_ACTION_ACTIVE_NOW = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.GET_CAMPAIGN_ACTION_ACTIVE_NOW = (0, graphql_tag_1.gql) `
6
6
  query GetCampaignActionActiveNow(
@@ -297,3 +297,53 @@ exports.SUGGEST_VOUCHER = (0, graphql_tag_1.gql) `
297
297
  }
298
298
  }
299
299
  `;
300
+ // query GetCampaignActionById {
301
+ // getCampaignActionById(id: "20.1273.888") {
302
+ // name
303
+ // description
304
+ // partyId
305
+ // type
306
+ // viewTemplateId
307
+ // urlTemplate
308
+ // shortCode
309
+ // uriPattern
310
+ // parameterPattern
311
+ // status
312
+ // extendDaysForHeadReview
313
+ // priorityLevel
314
+ // positionConnectionType
315
+ // baseCommissionPercent
316
+ // targetType
317
+ // id
318
+ // createdStamp
319
+ // updatedStamp
320
+ // updatedBy
321
+ // createdBy
322
+ // }
323
+ // }
324
+ exports.GET_CAMPAIGN_ACTION_BY_ID = (0, graphql_tag_1.gql) `
325
+ query GetCampaignActionById($id: String!) {
326
+ getCampaignActionById(id: $id) {
327
+ name
328
+ description
329
+ partyId
330
+ type
331
+ viewTemplateId
332
+ urlTemplate
333
+ shortCode
334
+ uriPattern
335
+ parameterPattern
336
+ status
337
+ extendDaysForHeadReview
338
+ priorityLevel
339
+ positionConnectionType
340
+ baseCommissionPercent
341
+ targetType
342
+ id
343
+ createdStamp
344
+ updatedStamp
345
+ updatedBy
346
+ createdBy
347
+ }
348
+ }
349
+ `;
@@ -15,4 +15,5 @@ export declare class CampaignService extends Service {
15
15
  getVoucherAvailableForCustomer(campaignId: string, customerId: string, excludeExpired: Boolean): Promise<any>;
16
16
  addCustomerToVoucher(voucherCode: string, userId: string): Promise<any>;
17
17
  suggestVoucher(): Promise<any>;
18
+ getCampaignActionById(id: string): Promise<any>;
18
19
  }
@@ -161,7 +161,7 @@ class CampaignService extends serviceSDK_1.Service {
161
161
  const query = queries_1.SUGGEST_VOUCHER;
162
162
  const variables = {
163
163
  partyId: this.orgId,
164
- excludeExpired: true
164
+ excludeExpired: true,
165
165
  };
166
166
  try {
167
167
  const response = yield this.graphqlQuery(query, variables);
@@ -172,5 +172,20 @@ class CampaignService extends serviceSDK_1.Service {
172
172
  }
173
173
  });
174
174
  }
175
+ getCampaignActionById(id) {
176
+ return __awaiter(this, void 0, void 0, function* () {
177
+ const query = queries_1.GET_CAMPAIGN_ACTION_BY_ID;
178
+ const variables = {
179
+ id,
180
+ };
181
+ try {
182
+ const response = yield this.graphqlQuery(query, variables);
183
+ return response.getCampaignActionById;
184
+ }
185
+ catch (error) {
186
+ throw error;
187
+ }
188
+ });
189
+ }
175
190
  }
176
191
  exports.CampaignService = CampaignService;
@@ -0,0 +1,5 @@
1
+ import { Service } from "../serviceSDK";
2
+ export declare class AuthorizationService extends Service {
3
+ constructor(endpoint: string, orgId: string, storeId: string);
4
+ checkToken(orgId: string, token: string): Promise<any>;
5
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AuthorizationService = void 0;
13
+ const serviceSDK_1 = require("../serviceSDK");
14
+ class AuthorizationService extends serviceSDK_1.Service {
15
+ constructor(endpoint, orgId, storeId) {
16
+ super(endpoint, orgId, storeId);
17
+ }
18
+ checkToken(orgId, token) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const endpoint = `/${orgId}/oauth2/api/v1/token/${token}`;
21
+ const method = "GET";
22
+ try {
23
+ const response = yield this.restApiCallWithNoHeader(endpoint, method);
24
+ return response;
25
+ }
26
+ catch (error) {
27
+ throw error;
28
+ }
29
+ });
30
+ }
31
+ }
32
+ exports.AuthorizationService = AuthorizationService;
@@ -0,0 +1 @@
1
+ export declare function validatePhoneNumber(phoneNumber: string): boolean;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validatePhoneNumber = void 0;
4
+ function validatePhoneNumber(phoneNumber) {
5
+ var _a;
6
+ const urlParams = new URLSearchParams(window.location.search);
7
+ const country = ((_a = urlParams.get("country")) === null || _a === void 0 ? void 0 : _a.trim()) || "default";
8
+ const pattern = (() => {
9
+ switch (country) {
10
+ case "vietnam":
11
+ return /^(0?)(3[2-9]|5[6|8|9]|7[0|6-9]|8[0-6|8|9]|9[0-4|6-9])[0-9]{7}$/;
12
+ case "quocte":
13
+ return /^(\+|00)[1-9][0-9]{1,3}[0-9]{4,14}$/;
14
+ default:
15
+ return /^(0?)(3[2-9]|5[6|8|9]|7[0|6-9]|8[0-6|8|9]|9[0-4|6-9])[0-9]{7}$|^(\+|00)[1-9][0-9]{1,3}[0-9]{4,14}$/;
16
+ }
17
+ })();
18
+ return pattern.test(phoneNumber);
19
+ }
20
+ exports.validatePhoneNumber = validatePhoneNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "2.2.7-beta.12",
3
+ "version": "2.2.7-beta.13",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [