@4site/engrid-scripts 0.23.7 → 0.23.10

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.
@@ -20,7 +20,6 @@ export declare class DataLayer {
20
20
  private handleFieldValueChange;
21
21
  private geRetainedFieldsValue;
22
22
  private hash;
23
- private shaHash;
24
23
  private getFieldLabel;
25
24
  addEndOfGiftProcessEvent(eventName: string, eventProperties?: object): void;
26
25
  addEndOfGiftProcessVariable(variableName: string, variableValue?: any): void;
@@ -188,7 +188,7 @@ export class DataLayer {
188
188
  if (el.value === "" || this.excludedFields.includes(el.name))
189
189
  return;
190
190
  const value = this.hashedFields.includes(el.name)
191
- ? this.hash(el.value)
191
+ ? yield this.hash(el.value)
192
192
  : el.value;
193
193
  if (["checkbox", "radio"].includes(el.type)) {
194
194
  if (el.checked) {
@@ -216,7 +216,7 @@ export class DataLayer {
216
216
  }
217
217
  if (el.name === this.retainedEmailField) {
218
218
  const retainedEmailValue = this.geRetainedFieldsValue("email");
219
- const sha256value = yield this.shaHash(retainedEmailValue);
219
+ const sha256value = yield this.hash(retainedEmailValue);
220
220
  localStorage.setItem(`EN_HASH_EMAIL`, sha256value);
221
221
  this.dataLayer.push({
222
222
  event: "EN_HASH_VALUE_UPDATED",
@@ -228,7 +228,7 @@ export class DataLayer {
228
228
  }
229
229
  else if (this.retainedAddressFields.includes(el.name)) {
230
230
  const retainedAddressValue = this.geRetainedFieldsValue("address");
231
- const sha256value = yield this.shaHash(retainedAddressValue);
231
+ const sha256value = yield this.hash(retainedAddressValue);
232
232
  localStorage.setItem(`EN_HASH_ADDRESS`, sha256value);
233
233
  this.dataLayer.push({
234
234
  event: "EN_HASH_VALUE_UPDATED",
@@ -239,7 +239,7 @@ export class DataLayer {
239
239
  }
240
240
  else if (this.retainedPhoneFields.includes(el.name)) {
241
241
  const retainedPhoneValue = this.geRetainedFieldsValue("phone");
242
- const sha256value = yield this.shaHash(retainedPhoneValue);
242
+ const sha256value = yield this.hash(retainedPhoneValue);
243
243
  localStorage.setItem(`EN_HASH_PHONE`, sha256value);
244
244
  this.dataLayer.push({
245
245
  event: "EN_HASH_VALUE_UPDATED",
@@ -281,10 +281,6 @@ export class DataLayer {
281
281
  }
282
282
  }
283
283
  hash(value) {
284
- return btoa(value);
285
- }
286
- // TODO: Replace the hash function with this secure SHA-256 implementation later
287
- shaHash(value) {
288
284
  return __awaiter(this, void 0, void 0, function* () {
289
285
  const data = this.encoder.encode(value);
290
286
  const hashBuffer = yield crypto.subtle.digest("SHA-256", data);
@@ -109,6 +109,9 @@ export interface Options {
109
109
  };
110
110
  ariaLabel?: string;
111
111
  placeholder?: string;
112
+ validCardBrands?: {
113
+ type: string;
114
+ }[] | null;
112
115
  };
113
116
  "transaction.ccvv"?: {
114
117
  showCardIcon?: boolean | object;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const AppVersion = "0.23.7";
1
+ export declare const AppVersion = "0.23.10";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const AppVersion = "0.23.7";
1
+ export const AppVersion = "0.23.10";
package/dist/vgs.js CHANGED
@@ -141,6 +141,7 @@ export class VGS {
141
141
  // Autocomplete is not customizable
142
142
  autoComplete: "cc-number",
143
143
  validations: ["required", "validCardNumber"],
144
+ validCardBrands: null
144
145
  },
145
146
  "transaction.ccvv": {
146
147
  showCardIcon: false,
@@ -158,6 +159,12 @@ export class VGS {
158
159
  css: styles,
159
160
  },
160
161
  };
162
+ // Override the validCardBrands if set in the theme options, as this should not be deep merged.
163
+ if (options &&
164
+ options["transaction.ccnumber"] &&
165
+ options["transaction.ccnumber"].validCardBrands) {
166
+ defaultOptions["transaction.ccnumber"].validCardBrands = options["transaction.ccnumber"].validCardBrands;
167
+ }
161
168
  // Deep merge the default options with the options set in the theme
162
169
  this.options = ENGrid.deepMerge(defaultOptions, options);
163
170
  this.logger.log("Options", this.options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4site/engrid-scripts",
3
- "version": "0.23.7",
3
+ "version": "0.23.10",
4
4
  "description": "Scripts for the ENGRID Project",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "strongly-typed-events": "^2.0.9"
26
26
  },
27
27
  "homepage": "https://github.com/4site-interactive-studios/engrid#readme",
28
- "gitHead": "77dcbefc6f55d7c287581631d08a3b3a99e8b618",
28
+ "gitHead": "2d90ef4a31d54d5e0ebbd5d59d542e8795b752d2",
29
29
  "devDependencies": {
30
30
  "nodemon": "^2.0.20"
31
31
  }