@meetelise/chat 1.51.0 → 1.51.2

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.
@@ -1,4 +1,6 @@
1
1
  import { LitElement, PropertyValueMap, TemplateResult } from "lit";
2
+ import "../actions/international-phone-input";
3
+ import type { InternationalPhoneChangeDetail } from "../actions/international-phone-input";
2
4
  import "./tour-type-option.ts";
3
5
  import "./date-picker.ts";
4
6
  import "./time-picker.ts";
@@ -36,6 +38,10 @@ export declare class TourScheduler extends LitElement {
36
38
  private shouldShowTourType;
37
39
  private email;
38
40
  private phoneNumber;
41
+ private phoneNumberE164;
42
+ private phoneCountry;
43
+ private phoneNumberIsValid;
44
+ private phoneNumberHasBlurred;
39
45
  private availabilitiesGroupedByDay;
40
46
  private calendarTimeZone;
41
47
  private waitingForAvailabilities;
@@ -61,7 +67,6 @@ export declare class TourScheduler extends LitElement {
61
67
  firstNameInput: HTMLInputElement;
62
68
  lastNameInput: HTMLInputElement;
63
69
  emailInput: HTMLInputElement;
64
- phoneInput: HTMLInputElement;
65
70
  selectedLeadSource: MESelect;
66
71
  selectedLayoutEl?: MESelect;
67
72
  selectedUnitEl?: MESelect;
@@ -95,8 +100,7 @@ export declare class TourScheduler extends LitElement {
95
100
  protected willUpdate: (_changedProperties: PropertyValueMap<{
96
101
  tourType: TourType;
97
102
  }> | Map<PropertyKey, unknown>) => Promise<void>;
98
- handlePhoneKeydown: (e: Event) => void;
99
- handlePhoneKeyup: (e: KeyboardEvent) => void;
103
+ onChangePhoneNumber: (event: CustomEvent<InternationalPhoneChangeDetail>) => void;
100
104
  onChangeEmail: (e: Event) => void;
101
105
  validators: {
102
106
  tourType: () => boolean;
@@ -1,7 +1,8 @@
1
1
  import { LitElement, TemplateResult } from "lit";
2
- import { Ref } from "lit/directives/ref.js";
3
2
  import "../me-select.ts";
4
3
  import { MESelect } from "../me-select";
4
+ import "./international-phone-input";
5
+ import type { InternationalPhoneChangeDetail } from "./international-phone-input";
5
6
  export declare class EmailUsWindow extends LitElement {
6
7
  static styles: import("lit").CSSResult[];
7
8
  leadSources: string[];
@@ -16,13 +17,14 @@ export declare class EmailUsWindow extends LitElement {
16
17
  private leadSourceClient;
17
18
  private leadSourceMultitouchClient;
18
19
  featureFlagShowDropdown: string;
19
- phoneNumberInputRef: Ref<HTMLInputElement>;
20
20
  privatePolicyUrl: string;
21
21
  termsOfServiceUrl: string;
22
22
  firstName: string;
23
23
  lastName: string;
24
24
  email: string;
25
25
  phoneNumber: string;
26
+ phoneNumberE164: string | null;
27
+ phoneCountry: string | null;
26
28
  message: string;
27
29
  selectedLeadSource: MESelect;
28
30
  currentLeadSource: string;
@@ -37,9 +39,8 @@ export declare class EmailUsWindow extends LitElement {
37
39
  onChangeFirstName: (e: Event) => void;
38
40
  onChangeLastName: (e: Event) => void;
39
41
  onChangeEmail: (e: Event) => void;
40
- onChangePhoneNumber: (e: Event) => void;
42
+ onChangePhoneNumber: (e: CustomEvent<InternationalPhoneChangeDetail>) => void;
41
43
  onChangeMessage: (e: Event) => void;
42
- enforceFormat: (e: KeyboardEvent) => void;
43
44
  validateFormFields: () => void;
44
45
  onClick: () => Promise<void>;
45
46
  getNumErrors: () => number;
@@ -1,8 +1,27 @@
1
+ import type { CountryCode } from "libphonenumber-js/min";
2
+ export declare type PhoneCountryOption = {
3
+ value: CountryCode;
4
+ label: string;
5
+ compactLabel: string;
6
+ countryName: string;
7
+ };
8
+ export declare const getPhoneCountry: (country: string | null | undefined) => CountryCode;
9
+ export declare const phoneCountryOptions: PhoneCountryOption[];
1
10
  /**
2
- * For now, only handles the US phone number case.....
3
- * Formats into phone number as you type
11
+ * Formats a phone number as the user types. Numbers beginning with `+` infer
12
+ * their country from the calling code; national numbers use `country`.
4
13
  */
5
- export declare const formatToPhoneInput: (phoneNumber: string) => string;
14
+ export declare const formatToPhoneInput: (phoneNumber: string, country?: string | null) => string;
15
+ export declare const getCountryFromPhoneInput: (phoneNumber: string, country?: string | null) => CountryCode;
16
+ export declare const getNationalPhoneNumber: (phoneNumber: string, country?: string | null) => string;
17
+ export declare const getE164PhoneNumber: (phoneNumber: string, country?: string | null) => string | null;
18
+ export declare const isValidInternationalPhoneNumber: (phoneNumber: string, country?: string | null) => boolean;
19
+ /**
20
+ * Text Us remains limited to +1 destinations because outbound SMS currently
21
+ * skips other calling codes. Keep its ten-digit behavior isolated from the
22
+ * international Tour and Email Us input.
23
+ */
24
+ export declare const formatToUsPhoneInput: (phoneNumber: string) => string;
6
25
  /**
7
26
  * Formats a phone number into a human-readable format.
8
27
  */
@@ -0,0 +1,30 @@
1
+ import { LitElement, PropertyValues, TemplateResult } from "lit";
2
+ export declare type InternationalPhoneChangeDetail = {
3
+ country: string;
4
+ e164: string | null;
5
+ formattedValue: string;
6
+ isValid: boolean;
7
+ };
8
+ export declare class InternationalPhoneInput extends LitElement {
9
+ static styles: import("lit").CSSResult[];
10
+ country: string | null;
11
+ value: string;
12
+ invalid: boolean;
13
+ private selectedCountry;
14
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
15
+ get e164(): string | null;
16
+ get isValid(): boolean;
17
+ private dispatchPhoneChange;
18
+ private setFormattedInputValue;
19
+ private handleInput;
20
+ private handleCountryChange;
21
+ private handleKeydown;
22
+ private handleBlur;
23
+ private get selectedCountryLabel();
24
+ render(): TemplateResult;
25
+ }
26
+ declare global {
27
+ interface HTMLElementTagNameMap {
28
+ "international-phone-input": InternationalPhoneInput;
29
+ }
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.51.0",
3
+ "version": "1.51.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -51,6 +51,7 @@
51
51
  "date-fns-tz": "^2.0.1",
52
52
  "dompurify": "^3.1.2",
53
53
  "dotenv": "^16.0.1",
54
+ "libphonenumber-js": "^1.13.10",
54
55
  "lit": "^2.2.4",
55
56
  "lodash": "^4.17.21",
56
57
  "pubnub": "^7.2.2",