@huckleberry-inc/address 4.3.0

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.
Files changed (56) hide show
  1. package/README.md +151 -0
  2. package/build/cjs/AddressFormatter.js +98 -0
  3. package/build/cjs/format.js +53 -0
  4. package/build/cjs/graphqlQuery.js +76 -0
  5. package/build/cjs/index.js +23 -0
  6. package/build/cjs/loader.js +70 -0
  7. package/build/cjs/node_modules/@shopify/address-consts/build/esm/index.mjs.js +32 -0
  8. package/build/cjs/packages/address/src/AddressFormatter.js +98 -0
  9. package/build/cjs/packages/address/src/format.js +53 -0
  10. package/build/cjs/packages/address/src/graphqlQuery.js +76 -0
  11. package/build/cjs/packages/address/src/index.js +27 -0
  12. package/build/cjs/packages/address/src/loader.js +70 -0
  13. package/build/cjs/packages/address/src/utilities.js +65 -0
  14. package/build/cjs/utilities.js +65 -0
  15. package/build/esm/AddressFormatter.mjs +94 -0
  16. package/build/esm/format.mjs +48 -0
  17. package/build/esm/graphqlQuery.mjs +72 -0
  18. package/build/esm/index.mjs +4 -0
  19. package/build/esm/loader.mjs +64 -0
  20. package/build/esm/node_modules/@shopify/address-consts/build/esm/index.mjs.mjs +27 -0
  21. package/build/esm/packages/address/src/AddressFormatter.mjs +94 -0
  22. package/build/esm/packages/address/src/format.mjs +48 -0
  23. package/build/esm/packages/address/src/graphqlQuery.mjs +72 -0
  24. package/build/esm/packages/address/src/index.mjs +4 -0
  25. package/build/esm/packages/address/src/loader.mjs +64 -0
  26. package/build/esm/packages/address/src/utilities.mjs +59 -0
  27. package/build/esm/utilities.mjs +59 -0
  28. package/build/esnext/AddressFormatter.esnext +94 -0
  29. package/build/esnext/format.esnext +48 -0
  30. package/build/esnext/graphqlQuery.esnext +72 -0
  31. package/build/esnext/index.esnext +4 -0
  32. package/build/esnext/loader.esnext +64 -0
  33. package/build/esnext/node_modules/@shopify/address-consts/build/esm/index.mjs.esnext +27 -0
  34. package/build/esnext/packages/address/src/AddressFormatter.esnext +94 -0
  35. package/build/esnext/packages/address/src/format.esnext +48 -0
  36. package/build/esnext/packages/address/src/graphqlQuery.esnext +72 -0
  37. package/build/esnext/packages/address/src/index.esnext +4 -0
  38. package/build/esnext/packages/address/src/loader.esnext +64 -0
  39. package/build/esnext/packages/address/src/utilities.esnext +59 -0
  40. package/build/esnext/utilities.esnext +59 -0
  41. package/build/ts/AddressFormatter.d.ts +23 -0
  42. package/build/ts/AddressFormatter.d.ts.map +1 -0
  43. package/build/ts/format.d.ts +29 -0
  44. package/build/ts/format.d.ts.map +1 -0
  45. package/build/ts/graphqlQuery.d.ts +3 -0
  46. package/build/ts/graphqlQuery.d.ts.map +1 -0
  47. package/build/ts/index.d.ts +5 -0
  48. package/build/ts/index.d.ts.map +1 -0
  49. package/build/ts/loader.d.ts +11 -0
  50. package/build/ts/loader.d.ts.map +1 -0
  51. package/build/ts/utilities.d.ts +8 -0
  52. package/build/ts/utilities.d.ts.map +1 -0
  53. package/index.esnext +2 -0
  54. package/index.js +1 -0
  55. package/index.mjs +2 -0
  56. package/package.json +51 -0
@@ -0,0 +1,76 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const query = `
6
+ query getCountries($locale: SupportedLocale!) {
7
+ countries(locale: $locale) {
8
+ name
9
+ code
10
+ continent
11
+ phoneNumberPrefix
12
+ autocompletionField
13
+ provinceKey
14
+ labels {
15
+ address1
16
+ address2
17
+ city
18
+ company
19
+ country
20
+ firstName
21
+ lastName
22
+ phone
23
+ postalCode
24
+ zone
25
+ }
26
+ optionalLabels {
27
+ address2
28
+ }
29
+ formatting {
30
+ edit
31
+ show
32
+ }
33
+ zones {
34
+ name
35
+ code
36
+ }
37
+ }
38
+ }
39
+
40
+ query getCountry($countryCode: SupportedCountry!, $locale: SupportedLocale!) {
41
+ country(countryCode: $countryCode, locale: $locale) {
42
+ name
43
+ code
44
+ continent
45
+ phoneNumberPrefix
46
+ autocompletionField
47
+ provinceKey
48
+ labels {
49
+ address1
50
+ address2
51
+ city
52
+ company
53
+ country
54
+ firstName
55
+ lastName
56
+ phone
57
+ postalCode
58
+ zone
59
+ }
60
+ optionalLabels {
61
+ address2
62
+ }
63
+ formatting {
64
+ edit
65
+ show
66
+ }
67
+ zones {
68
+ name
69
+ code
70
+ }
71
+ }
72
+ }
73
+ `;
74
+ var query$1 = query;
75
+
76
+ exports["default"] = query$1;
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var loader = require('./loader.js');
6
+ var format = require('./format.js');
7
+ var AddressFormatter = require('./AddressFormatter.js');
8
+ var index = require('../../../node_modules/@shopify/address-consts/build/esm/index.mjs.js');
9
+
10
+
11
+
12
+ exports.CountryLoaderError = loader.CountryLoaderError;
13
+ exports.loadCountries = loader.loadCountries;
14
+ exports.loadCountry = loader.loadCountry;
15
+ exports.buildOrderedFields = format.buildOrderedFields;
16
+ exports.formatAddress = format.formatAddress;
17
+ exports["default"] = AddressFormatter["default"];
18
+ Object.defineProperty(exports, 'FieldName', {
19
+ enumerable: true,
20
+ get: function () { return index.FieldName; }
21
+ });
22
+ exports.GRAPHQL_ENDPOINT = index.GRAPHQL_ENDPOINT;
23
+ Object.defineProperty(exports, 'GraphqlOperationName', {
24
+ enumerable: true,
25
+ get: function () { return index.GraphqlOperationName; }
26
+ });
27
+ exports.HEADERS = index.HEADERS;
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var graphqlQuery = require('./graphqlQuery.js');
6
+ var index = require('../../../node_modules/@shopify/address-consts/build/esm/index.mjs.js');
7
+
8
+ const loadCountries = memoizeAsync(async (locale, {
9
+ includeHiddenZones = false
10
+ } = {}) => {
11
+ const response = await fetch(index.GRAPHQL_ENDPOINT, {
12
+ method: 'POST',
13
+ headers: index.HEADERS,
14
+ body: JSON.stringify({
15
+ query: graphqlQuery["default"],
16
+ operationName: index.GraphqlOperationName.Countries,
17
+ variables: {
18
+ locale: locale.replace(/-/, '_').toUpperCase(),
19
+ includeHiddenZones
20
+ }
21
+ })
22
+ });
23
+ const countries = await response.json();
24
+ if (!('data' in countries) && 'errors' in countries) {
25
+ throw new CountryLoaderError(countries);
26
+ }
27
+ return countries.data.countries;
28
+ });
29
+ const loadCountry = memoizeAsync(async (locale, countryCode, {
30
+ includeHiddenZones = false
31
+ } = {}) => {
32
+ const response = await fetch(index.GRAPHQL_ENDPOINT, {
33
+ method: 'POST',
34
+ headers: index.HEADERS,
35
+ body: JSON.stringify({
36
+ query: graphqlQuery["default"],
37
+ operationName: index.GraphqlOperationName.Country,
38
+ variables: {
39
+ countryCode,
40
+ locale: locale.replace(/-/, '_').toUpperCase(),
41
+ includeHiddenZones
42
+ }
43
+ })
44
+ });
45
+ const country = await response.json();
46
+ if (!('data' in country) && 'errors' in country) {
47
+ throw new CountryLoaderError(country);
48
+ }
49
+ return country.data.country;
50
+ });
51
+ class CountryLoaderError extends Error {
52
+ constructor(errors) {
53
+ const errorMessage = errors.errors.map(error => error.message).join('; ');
54
+ super(errorMessage);
55
+ }
56
+ }
57
+ function memoizeAsync(asyncFunction) {
58
+ const cache = {};
59
+ return (...args) => {
60
+ const stringifiedArgs = JSON.stringify(args);
61
+ if (!cache[stringifiedArgs]) {
62
+ cache[stringifiedArgs] = asyncFunction.apply(this, args);
63
+ }
64
+ return cache[stringifiedArgs];
65
+ };
66
+ }
67
+
68
+ exports.CountryLoaderError = CountryLoaderError;
69
+ exports.loadCountries = loadCountries;
70
+ exports.loadCountry = loadCountry;
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var index = require('../../../node_modules/@shopify/address-consts/build/esm/index.mjs.js');
6
+
7
+ const FIELD_REGEXP = /({\w+})/g;
8
+ /* eslint-disable @typescript-eslint/naming-convention */
9
+ const FIELDS_MAPPING = {
10
+ '{firstName}': index.FieldName.FirstName,
11
+ '{lastName}': index.FieldName.LastName,
12
+ '{country}': index.FieldName.Country,
13
+ '{city}': index.FieldName.City,
14
+ '{zip}': index.FieldName.PostalCode,
15
+ '{province}': index.FieldName.Zone,
16
+ '{address1}': index.FieldName.Address1,
17
+ '{address2}': index.FieldName.Address2,
18
+ '{phone}': index.FieldName.Phone,
19
+ '{company}': index.FieldName.Company
20
+ };
21
+ /* eslint-enable @typescript-eslint/naming-convention */
22
+
23
+ /*
24
+ * Returns empty string if all replacement fields are empty.
25
+ */
26
+ function renderLineTemplate(country, template, address) {
27
+ const result = template.match(FIELD_REGEXP);
28
+ let line = template;
29
+ if (!result) {
30
+ return '';
31
+ }
32
+ let lineIsEmpty = true;
33
+ result.forEach(key => {
34
+ const addressKey = key.replace('{', '').replace('}', '');
35
+ if (address[addressKey]) {
36
+ lineIsEmpty = false;
37
+ }
38
+ switch (addressKey) {
39
+ case index.FieldName.Country:
40
+ line = line.replace(`{${index.FieldName.Country}}`, country.name);
41
+ break;
42
+ case index.FieldName.Zone:
43
+ line = line.replace(`{${index.FieldName.Zone}}`, address.province ? getZone(country.zones, address.province).name : '');
44
+ break;
45
+ default:
46
+ line = line.replace(key, address[addressKey] || '');
47
+ break;
48
+ }
49
+ });
50
+ if (lineIsEmpty) {
51
+ return '';
52
+ } else {
53
+ return line.trim().replace(' ', ' ');
54
+ }
55
+ }
56
+ function getZone(zones, zoneCode) {
57
+ return zones.find(zone => zone.code === zoneCode) || {
58
+ name: '',
59
+ code: ''
60
+ };
61
+ }
62
+
63
+ exports.FIELDS_MAPPING = FIELDS_MAPPING;
64
+ exports.FIELD_REGEXP = FIELD_REGEXP;
65
+ exports.renderLineTemplate = renderLineTemplate;
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var addressConsts = require('@huckleberry-inc/address-consts');
6
+
7
+ const FIELD_REGEXP = /({\w+})/g;
8
+ /* eslint-disable @typescript-eslint/naming-convention */
9
+ const FIELDS_MAPPING = {
10
+ '{firstName}': addressConsts.FieldName.FirstName,
11
+ '{lastName}': addressConsts.FieldName.LastName,
12
+ '{country}': addressConsts.FieldName.Country,
13
+ '{city}': addressConsts.FieldName.City,
14
+ '{zip}': addressConsts.FieldName.PostalCode,
15
+ '{province}': addressConsts.FieldName.Zone,
16
+ '{address1}': addressConsts.FieldName.Address1,
17
+ '{address2}': addressConsts.FieldName.Address2,
18
+ '{phone}': addressConsts.FieldName.Phone,
19
+ '{company}': addressConsts.FieldName.Company
20
+ };
21
+ /* eslint-enable @typescript-eslint/naming-convention */
22
+
23
+ /*
24
+ * Returns empty string if all replacement fields are empty.
25
+ */
26
+ function renderLineTemplate(country, template, address) {
27
+ const result = template.match(FIELD_REGEXP);
28
+ let line = template;
29
+ if (!result) {
30
+ return '';
31
+ }
32
+ let lineIsEmpty = true;
33
+ result.forEach(key => {
34
+ const addressKey = key.replace('{', '').replace('}', '');
35
+ if (address[addressKey]) {
36
+ lineIsEmpty = false;
37
+ }
38
+ switch (addressKey) {
39
+ case addressConsts.FieldName.Country:
40
+ line = line.replace(`{${addressConsts.FieldName.Country}}`, country.name);
41
+ break;
42
+ case addressConsts.FieldName.Zone:
43
+ line = line.replace(`{${addressConsts.FieldName.Zone}}`, address.province ? getZone(country.zones, address.province).name : '');
44
+ break;
45
+ default:
46
+ line = line.replace(key, address[addressKey] || '');
47
+ break;
48
+ }
49
+ });
50
+ if (lineIsEmpty) {
51
+ return '';
52
+ } else {
53
+ return line.trim().replace(' ', ' ');
54
+ }
55
+ }
56
+ function getZone(zones, zoneCode) {
57
+ return zones.find(zone => zone.code === zoneCode) || {
58
+ name: '',
59
+ code: ''
60
+ };
61
+ }
62
+
63
+ exports.FIELDS_MAPPING = FIELDS_MAPPING;
64
+ exports.FIELD_REGEXP = FIELD_REGEXP;
65
+ exports.renderLineTemplate = renderLineTemplate;
@@ -0,0 +1,94 @@
1
+ import { formatAddress, buildOrderedFields } from './format.mjs';
2
+ import { loadCountry, loadCountries } from './loader.mjs';
3
+
4
+ const ORDERED_COUNTRIES_CACHE = new Map();
5
+ class AddressFormatter {
6
+ /**
7
+ * Useful in tests or any situation where the cache has undesirable
8
+ * side-effects.
9
+ */
10
+ static resetCache() {
11
+ ORDERED_COUNTRIES_CACHE.clear();
12
+ }
13
+ constructor(locale) {
14
+ this.locale = locale;
15
+ this.locale = locale;
16
+ }
17
+ updateLocale(locale) {
18
+ this.locale = locale;
19
+ }
20
+ async getCountry(countryCode, {
21
+ includeHiddenZones = false
22
+ } = {}) {
23
+ const country = this.loadCountryFromCache(countryCode, includeHiddenZones);
24
+ if (country) return country;
25
+ return loadCountry(this.locale, countryCode, {
26
+ includeHiddenZones
27
+ });
28
+ }
29
+ async getCountries({
30
+ includeHiddenZones = false
31
+ } = {}) {
32
+ const cacheKey = this.cacheKey(this.locale, includeHiddenZones);
33
+ const cachedCountries = ORDERED_COUNTRIES_CACHE.get(cacheKey);
34
+ if (cachedCountries) return cachedCountries;
35
+ const countries = await loadCountries(this.locale, {
36
+ includeHiddenZones
37
+ });
38
+ ORDERED_COUNTRIES_CACHE.set(cacheKey, countries);
39
+ return countries;
40
+ }
41
+ async getZoneName(countryCode, zoneCode) {
42
+ const country = await this.getCountry(countryCode);
43
+ const countryZone = country.zones.find(item => item.code === zoneCode);
44
+ if (!(countryZone !== null && countryZone !== void 0 && countryZone.name)) return undefined;
45
+ return countryZone.name;
46
+ }
47
+
48
+ /* Returns the address ordered in an array based based on the country code
49
+ * Eg.:
50
+ * [
51
+ * 'Shopify',
52
+ * 'First Name Last Name',
53
+ * 'Address 1',
54
+ * 'address2',
55
+ * 'Montréal',
56
+ * 'Canada Quebec H2J 4B7',
57
+ * '514 444 3333'
58
+ * ]
59
+ */
60
+ async format(address) {
61
+ const country = await this.getCountry(address.country);
62
+ return formatAddress(address, country);
63
+ }
64
+
65
+ /* Returns an array that shows how to order fields based on the country code
66
+ * Eg.:
67
+ * [
68
+ * ['company'],
69
+ * ['firstName', 'lastName'],
70
+ * ['address1'],
71
+ * ['address2'],
72
+ * ['city'],
73
+ * ['country', 'province', 'zip'],
74
+ * ['phone']
75
+ * ]
76
+ */
77
+ async getOrderedFields(countryCode) {
78
+ const country = await this.getCountry(countryCode);
79
+ return buildOrderedFields(country);
80
+ }
81
+ cacheKey(locale, includeHiddenZones) {
82
+ /* Cache list of countries per locale, both with and without hidden zones included */
83
+ return `${locale}-${includeHiddenZones}`;
84
+ }
85
+ loadCountryFromCache(countryCode, includeHiddenZones) {
86
+ const cachedCountries = ORDERED_COUNTRIES_CACHE.get(this.cacheKey(this.locale, includeHiddenZones));
87
+ if (!cachedCountries) return null;
88
+ return cachedCountries.find(({
89
+ code
90
+ }) => code === countryCode);
91
+ }
92
+ }
93
+
94
+ export { AddressFormatter as default };
@@ -0,0 +1,48 @@
1
+ import { renderLineTemplate, FIELD_REGEXP, FIELDS_MAPPING } from './utilities.mjs';
2
+
3
+ const LINE_DELIMITER = '_';
4
+ const DEFAULT_FORM_LAYOUT = '{firstName}{lastName}_{company}_{address1}_{address2}_{city}_{country}{province}{zip}_{phone}';
5
+ const DEFAULT_SHOW_LAYOUT = '{lastName} {firstName}_{company}_{address1} {address2}_{city} {province} {zip}_{country}_{phone}';
6
+
7
+ /**
8
+ * When it's time to render any address, use this function so that it's properly
9
+ * formatted for the country's locale.
10
+ *
11
+ * ```typescript
12
+ * ['Shopify', 'Lindenstraße 9-14', '10969 Berlin', 'Germany'];
13
+ * ```
14
+ * @returns all lines of a formatted address as an array of strings.
15
+ */
16
+ function formatAddress(address, country) {
17
+ const layout = country.formatting.show || DEFAULT_SHOW_LAYOUT;
18
+ return layout.split(LINE_DELIMITER).map(lineTemplate => renderLineTemplate(country, lineTemplate, address).trim());
19
+ }
20
+
21
+ /**
22
+ * In an edit form, this function can be used to properly order all the input
23
+ * fields.
24
+ *
25
+ * ```typescript
26
+ * [
27
+ * ['firstName', 'lastName'],
28
+ * ['company'],
29
+ * ['address1'],
30
+ * ['address2'],
31
+ * ['city'],
32
+ * ['country', 'province', 'zip'],
33
+ * ['phone'],
34
+ * ];
35
+ * ```
36
+ */
37
+ function buildOrderedFields(country) {
38
+ const format = country ? country.formatting.edit : DEFAULT_FORM_LAYOUT;
39
+ return format.split(LINE_DELIMITER).map(lineTemplate => {
40
+ const result = lineTemplate.match(FIELD_REGEXP);
41
+ if (!result) {
42
+ return [];
43
+ }
44
+ return result.map(field => FIELDS_MAPPING[field]);
45
+ });
46
+ }
47
+
48
+ export { buildOrderedFields, formatAddress };
@@ -0,0 +1,72 @@
1
+ const query = `
2
+ query countries($locale: SupportedLocale!) {
3
+ getCountries(locale: $locale) {
4
+ name
5
+ code
6
+ continent
7
+ phoneNumberPrefix
8
+ autocompletionField
9
+ provinceKey
10
+ labels {
11
+ address1
12
+ address2
13
+ city
14
+ company
15
+ country
16
+ firstName
17
+ lastName
18
+ phone
19
+ postalCode
20
+ zone
21
+ }
22
+ optionalLabels {
23
+ address2
24
+ }
25
+ formatting {
26
+ edit
27
+ show
28
+ }
29
+ zones {
30
+ name
31
+ code
32
+ }
33
+ }
34
+ }
35
+
36
+ query country($countryCode: SupportedCountry!, $locale: SupportedLocale!) {
37
+ getCountry(countryCode: $countryCode, locale: $locale) {
38
+ name
39
+ code
40
+ continent
41
+ phoneNumberPrefix
42
+ autocompletionField
43
+ provinceKey
44
+ labels {
45
+ address1
46
+ address2
47
+ city
48
+ company
49
+ country
50
+ firstName
51
+ lastName
52
+ phone
53
+ postalCode
54
+ zone
55
+ }
56
+ optionalLabels {
57
+ address2
58
+ }
59
+ formatting {
60
+ edit
61
+ show
62
+ }
63
+ zones {
64
+ name
65
+ code
66
+ }
67
+ }
68
+ }
69
+ `;
70
+ var query$1 = query;
71
+
72
+ export { query$1 as default };
@@ -0,0 +1,4 @@
1
+ export * from '@huckleberry-inc/address-consts';
2
+ export { CountryLoaderError, loadCountries, loadCountry } from './loader.mjs';
3
+ export { buildOrderedFields, formatAddress } from './format.mjs';
4
+ export { default } from './AddressFormatter.mjs';
@@ -0,0 +1,64 @@
1
+ import { GRAPHQL_ENDPOINT, HEADERS, GraphqlOperationName } from '@huckleberry-inc/address-consts';
2
+ import query from './graphqlQuery.mjs';
3
+
4
+ const loadCountries = memoizeAsync(async (locale, {
5
+ includeHiddenZones = false
6
+ } = {}) => {
7
+ const response = await fetch(GRAPHQL_ENDPOINT, {
8
+ method: 'POST',
9
+ headers: HEADERS,
10
+ body: JSON.stringify({
11
+ query,
12
+ operationName: GraphqlOperationName.Countries,
13
+ variables: {
14
+ locale: locale.replace(/-/, '_').toUpperCase(),
15
+ includeHiddenZones
16
+ }
17
+ })
18
+ });
19
+ const countries = await response.json();
20
+ if (!('data' in countries) && 'errors' in countries) {
21
+ throw new CountryLoaderError(countries);
22
+ }
23
+ return countries.data.countries;
24
+ });
25
+ const loadCountry = memoizeAsync(async (locale, countryCode, {
26
+ includeHiddenZones = false
27
+ } = {}) => {
28
+ const response = await fetch(GRAPHQL_ENDPOINT, {
29
+ method: 'POST',
30
+ headers: HEADERS,
31
+ body: JSON.stringify({
32
+ query,
33
+ operationName: GraphqlOperationName.Country,
34
+ variables: {
35
+ countryCode,
36
+ locale: locale.replace(/-/, '_').toUpperCase(),
37
+ includeHiddenZones
38
+ }
39
+ })
40
+ });
41
+ const country = await response.json();
42
+ if (!('data' in country) && 'errors' in country) {
43
+ throw new CountryLoaderError(country);
44
+ }
45
+ return country.data.country;
46
+ });
47
+ class CountryLoaderError extends Error {
48
+ constructor(errors) {
49
+ const errorMessage = errors.errors.map(error => error.message).join('; ');
50
+ super(errorMessage);
51
+ }
52
+ }
53
+ function memoizeAsync(asyncFunction) {
54
+ const cache = {};
55
+ return (...args) => {
56
+ const stringifiedArgs = JSON.stringify(args);
57
+ if (!cache[stringifiedArgs]) {
58
+ cache[stringifiedArgs] = asyncFunction.apply(this, args);
59
+ }
60
+ return cache[stringifiedArgs];
61
+ };
62
+ }
63
+
64
+ export { CountryLoaderError, loadCountries, loadCountry };
@@ -0,0 +1,27 @@
1
+ let FieldName;
2
+ (function (FieldName) {
3
+ FieldName["FirstName"] = "firstName";
4
+ FieldName["LastName"] = "lastName";
5
+ FieldName["Country"] = "country";
6
+ FieldName["City"] = "city";
7
+ FieldName["PostalCode"] = "zip";
8
+ FieldName["Zone"] = "province";
9
+ FieldName["Address1"] = "address1";
10
+ FieldName["Address2"] = "address2";
11
+ FieldName["Phone"] = "phone";
12
+ FieldName["Company"] = "company";
13
+ })(FieldName || (FieldName = {}));
14
+ const GRAPHQL_ENDPOINT = 'https://atlas.shopifysvc.com/graphql';
15
+ let GraphqlOperationName;
16
+
17
+ /* eslint-disable @typescript-eslint/naming-convention */
18
+ (function (GraphqlOperationName) {
19
+ GraphqlOperationName["Countries"] = "countries";
20
+ GraphqlOperationName["Country"] = "country";
21
+ })(GraphqlOperationName || (GraphqlOperationName = {}));
22
+ const HEADERS = {
23
+ 'Content-Type': 'application/json',
24
+ 'Access-Control-Allow-Origin': '*'
25
+ };
26
+
27
+ export { FieldName, GRAPHQL_ENDPOINT, GraphqlOperationName, HEADERS };