@servicetitan/onboarding-ui 1.14.0 → 1.16.1
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.
- package/CHANGELOG.md +211 -0
- package/dist/address-suggestion-popover/components/address-suggestion-popover.js +13 -35
- package/dist/address-suggestion-popover/components/address-suggestion-popover.js.map +1 -1
- package/dist/address-suggestion-popover/index.js +2 -14
- package/dist/address-suggestion-popover/index.js.map +1 -1
- package/dist/address-suggestion-popover/utils/google-geocoder-suggestions-provider.js +1 -5
- package/dist/address-suggestion-popover/utils/google-geocoder-suggestions-provider.js.map +1 -1
- package/dist/address-suggestion-popover/utils/index.js +1 -13
- package/dist/address-suggestion-popover/utils/index.js.map +1 -1
- package/dist/company-profile/components/company-profile-form.d.ts.map +1 -1
- package/dist/company-profile/components/company-profile-form.js +20 -23
- package/dist/company-profile/components/company-profile-form.js.map +1 -1
- package/dist/company-profile/components/country-dropdown-input.d.ts.map +1 -1
- package/dist/company-profile/components/country-dropdown-input.js +6 -11
- package/dist/company-profile/components/country-dropdown-input.js.map +1 -1
- package/dist/company-profile/components/state-and-province-dropdown-input.js +7 -10
- package/dist/company-profile/components/state-and-province-dropdown-input.js.map +1 -1
- package/dist/company-profile/index.js +6 -18
- package/dist/company-profile/index.js.map +1 -1
- package/dist/company-profile/stores/__mocks__/company-profile-form-mock-data.js +3 -6
- package/dist/company-profile/stores/__mocks__/company-profile-form-mock-data.js.map +1 -1
- package/dist/company-profile/stores/company-profile-form.store.d.ts.map +1 -1
- package/dist/company-profile/stores/company-profile-form.store.js +38 -36
- package/dist/company-profile/stores/company-profile-form.store.js.map +1 -1
- package/dist/company-profile/utils/validators.js +1 -5
- package/dist/company-profile/utils/validators.js.map +1 -1
- package/dist/contentful/contentful.api.js +2 -5
- package/dist/contentful/contentful.api.js.map +1 -1
- package/dist/contentful/contentful.data.store.js +7 -13
- package/dist/contentful/contentful.data.store.js.map +1 -1
- package/dist/contentful/document-to-react-component.js +9 -13
- package/dist/contentful/document-to-react-component.js.map +1 -1
- package/dist/contentful/index.js +7 -19
- package/dist/contentful/index.js.map +1 -1
- package/dist/contentful/interfaces.js +1 -2
- package/dist/contentful/marketing-carousel.store.js +22 -28
- package/dist/contentful/marketing-carousel.store.js.map +1 -1
- package/dist/contentful/page-contentful.store.js +18 -21
- package/dist/contentful/page-contentful.store.js.map +1 -1
- package/dist/contentful/utils.js +7 -15
- package/dist/contentful/utils.js.map +1 -1
- package/dist/hooks/index.js +1 -13
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/use-scroll-to-error/index.js +1 -13
- package/dist/hooks/use-scroll-to-error/index.js.map +1 -1
- package/dist/hooks/use-scroll-to-error/use-scroll-to-error.js +5 -9
- package/dist/hooks/use-scroll-to-error/use-scroll-to-error.js.map +1 -1
- package/dist/index.js +4 -16
- package/dist/index.js.map +1 -1
- package/dist/utils/collection-helpers.js +1 -5
- package/dist/utils/collection-helpers.js.map +1 -1
- package/dist/utils/index.js +1 -13
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -4
- package/src/company-profile/components/company-profile-form.tsx +25 -11
- package/src/company-profile/components/country-dropdown-input.tsx +2 -4
- package/src/company-profile/stores/company-profile-form.store.ts +5 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -20,12 +19,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
19
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
20
|
});
|
|
22
21
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const __1 = require("..");
|
|
28
|
-
const _1 = require(".");
|
|
22
|
+
import { inject, injectable } from '@servicetitan/react-ioc';
|
|
23
|
+
import { action, computed, makeObservable, observable, runInAction } from 'mobx';
|
|
24
|
+
import { arrayToMap } from '..';
|
|
25
|
+
import { ContentfulDataStore } from '.';
|
|
29
26
|
let PageContentfulStore = class PageContentfulStore {
|
|
30
27
|
constructor(contentfulDataStore) {
|
|
31
28
|
Object.defineProperty(this, "contentfulDataStore", {
|
|
@@ -64,13 +61,13 @@ let PageContentfulStore = class PageContentfulStore {
|
|
|
64
61
|
codeId,
|
|
65
62
|
isPreview,
|
|
66
63
|
});
|
|
67
|
-
|
|
64
|
+
runInAction(() => {
|
|
68
65
|
this.pageData = data;
|
|
69
66
|
this.isInitialized = true;
|
|
70
67
|
});
|
|
71
68
|
}
|
|
72
69
|
finally {
|
|
73
|
-
|
|
70
|
+
runInAction(() => {
|
|
74
71
|
this.isInitializing = false;
|
|
75
72
|
});
|
|
76
73
|
}
|
|
@@ -98,42 +95,42 @@ let PageContentfulStore = class PageContentfulStore {
|
|
|
98
95
|
return content === '%none%' ? undefined : content;
|
|
99
96
|
}
|
|
100
97
|
});
|
|
101
|
-
|
|
98
|
+
makeObservable(this);
|
|
102
99
|
}
|
|
103
100
|
get tooltipsByObjectId() {
|
|
104
101
|
var _a;
|
|
105
|
-
return
|
|
102
|
+
return arrayToMap((_a = this.pageData) === null || _a === void 0 ? void 0 : _a.fields.tooltips, entry => entry.fields.objectId);
|
|
106
103
|
}
|
|
107
104
|
};
|
|
108
105
|
__decorate([
|
|
109
|
-
|
|
106
|
+
observable,
|
|
110
107
|
__metadata("design:type", Object)
|
|
111
108
|
], PageContentfulStore.prototype, "isInitializing", void 0);
|
|
112
109
|
__decorate([
|
|
113
|
-
|
|
110
|
+
observable,
|
|
114
111
|
__metadata("design:type", Object)
|
|
115
112
|
], PageContentfulStore.prototype, "isInitialized", void 0);
|
|
116
113
|
__decorate([
|
|
117
|
-
|
|
114
|
+
observable,
|
|
118
115
|
__metadata("design:type", Object)
|
|
119
116
|
], PageContentfulStore.prototype, "pageData", void 0);
|
|
120
117
|
__decorate([
|
|
121
|
-
|
|
118
|
+
action,
|
|
122
119
|
__metadata("design:type", Object)
|
|
123
120
|
], PageContentfulStore.prototype, "initialize", void 0);
|
|
124
121
|
__decorate([
|
|
125
|
-
|
|
122
|
+
action,
|
|
126
123
|
__metadata("design:type", Object)
|
|
127
124
|
], PageContentfulStore.prototype, "lazyInitialize", void 0);
|
|
128
125
|
__decorate([
|
|
129
|
-
|
|
126
|
+
computed,
|
|
130
127
|
__metadata("design:type", Object),
|
|
131
128
|
__metadata("design:paramtypes", [])
|
|
132
129
|
], PageContentfulStore.prototype, "tooltipsByObjectId", null);
|
|
133
130
|
PageContentfulStore = __decorate([
|
|
134
|
-
|
|
135
|
-
__param(0,
|
|
136
|
-
__metadata("design:paramtypes", [
|
|
131
|
+
injectable(),
|
|
132
|
+
__param(0, inject(ContentfulDataStore)),
|
|
133
|
+
__metadata("design:paramtypes", [ContentfulDataStore])
|
|
137
134
|
], PageContentfulStore);
|
|
138
|
-
|
|
135
|
+
export { PageContentfulStore };
|
|
139
136
|
//# sourceMappingURL=page-contentful.store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-contentful.store.js","sourceRoot":"","sources":["../../src/contentful/page-contentful.store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"page-contentful.store.js","sourceRoot":"","sources":["../../src/contentful/page-contentful.store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAA0B,MAAM,GAAG,CAAC;AAQhE,IAAa,mBAAmB,GAAhC,MAAa,mBAAmB;IAK5B,YAAiD,mBAAwC;;;;;mBAAxC;;QAJrC;;;;mBAAiB,KAAK;WAAC;QACvB;;;;mBAAgB,KAAK;WAAC;QACtB;;;;;WAAkC;QAO9C;;;;mBAAa,CAAO,EAAE,MAAM,EAAE,SAAS,GAAG,KAAK,EAA8B,EAAE,EAAE;gBAC7E,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;gBAC3B,IAAI;oBACA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAkB;wBAC3E,SAAS,EAAE,kBAAkB;wBAC7B,MAAM;wBACN,SAAS;qBACZ,CAAC,CAAC;oBACH,WAAW,CAAC,GAAG,EAAE;wBACb,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;wBACrB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;oBAC9B,CAAC,CAAC,CAAC;iBACN;wBAAS;oBACN,WAAW,CAAC,GAAG,EAAE;wBACb,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;oBAChC,CAAC,CAAC,CAAC;iBACN;YACL,CAAC,CAAA;WAAC;QAGF;;;;mBAAiB,CAAC,OAAmC,EAAE,EAAE;gBACrD,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;oBAC7C,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;iBACnC;gBACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;YAC7B,CAAC;WAAC;QAOF;;;;mBAAa,CAAC,QAAgB,EAAE,QAAkB,EAAE,EAAE;gBAClD,IAAI,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,QAAQ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;gBACzF,OAAO,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC3D,MAAM,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAC,OAAO,CAAC;gBACxC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;YACtD,CAAC;WAAC;QAzCE,cAAc,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IA+BD,IAAI,kBAAkB;;QAClB,OAAO,UAAU,CAAC,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACtF,CAAC;CAQJ,CAAA;AA/Ce;IAAX,UAAU;;2DAAwB;AACvB;IAAX,UAAU;;0DAAuB;AACtB;IAAX,UAAU;;qDAAmC;AAO9C;IADC,MAAM;;uDAkBL;AAGF;IADC,MAAM;;2DAML;AAGF;IADC,QAAQ;;;6DAGR;AAxCQ,mBAAmB;IAD/B,UAAU,EAAE;IAMI,WAAA,MAAM,CAAC,mBAAmB,CAAC,CAAA;qCAA8B,mBAAmB;GALhF,mBAAmB,CAgD/B;SAhDY,mBAAmB"}
|
package/dist/contentful/utils.js
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isOxPermissionsEntry = exports.isDescriptionEntry = exports.isHeaderEntry = exports.isTextEntry = exports.isContentContainerEntry = void 0;
|
|
4
1
|
const isEntryTypeOf = (entry, type) => entry.sys.contentType.sys.id === type;
|
|
5
|
-
const isContentContainerEntry = (entry) => {
|
|
2
|
+
export const isContentContainerEntry = (entry) => {
|
|
6
3
|
return isEntryTypeOf(entry, 'serviceTitanContentContainer');
|
|
7
4
|
};
|
|
8
|
-
|
|
9
|
-
const isTextEntry = (entry) => {
|
|
5
|
+
export const isTextEntry = (entry) => {
|
|
10
6
|
return isEntryTypeOf(entry, 'serviceTitanText');
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return (0, exports.isTextEntry)(entry) && entry.fields.codeId.endsWith('-header');
|
|
8
|
+
export const isHeaderEntry = (entry) => {
|
|
9
|
+
return isTextEntry(entry) && entry.fields.codeId.endsWith('-header');
|
|
15
10
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return (0, exports.isTextEntry)(entry) && entry.fields.codeId.endsWith('-description');
|
|
11
|
+
export const isDescriptionEntry = (entry) => {
|
|
12
|
+
return isTextEntry(entry) && entry.fields.codeId.endsWith('-description');
|
|
19
13
|
};
|
|
20
|
-
|
|
21
|
-
const isOxPermissionsEntry = (entry) => {
|
|
14
|
+
export const isOxPermissionsEntry = (entry) => {
|
|
22
15
|
return isEntryTypeOf(entry, 'oxPermission');
|
|
23
16
|
};
|
|
24
|
-
exports.isOxPermissionsEntry = isOxPermissionsEntry;
|
|
25
17
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/contentful/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/contentful/utils.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,CAAC,KAAqB,EAAE,IAAY,EAAE,EAAE,CAC1D,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC;AAE1C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACnC,KAAqB,EACiB,EAAE;IACxC,OAAO,aAAa,CAAC,KAAK,EAAE,8BAA8B,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAqB,EAAmC,EAAE;IAClF,OAAO,aAAa,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAqB,EAAmC,EAAE;IACpF,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAqB,EAAmC,EAAE;IACzF,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;AAC9E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAqB,EAAsC,EAAE;IAC9F,OAAO,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AAChD,CAAC,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./use-scroll-to-error"), exports);
|
|
1
|
+
export * from './use-scroll-to-error';
|
|
14
2
|
//# sourceMappingURL=index.js.map
|
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./use-scroll-to-error"), exports);
|
|
1
|
+
export * from './use-scroll-to-error';
|
|
14
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/use-scroll-to-error/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/use-scroll-to-error/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.useScrollToError = exports.errorClassNamesDefault = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
exports.errorClassNamesDefault = [
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
export const errorClassNamesDefault = [
|
|
6
3
|
'.Banner--critical',
|
|
7
4
|
'.error-warning',
|
|
8
5
|
'.error',
|
|
9
6
|
'.FormField--error',
|
|
10
7
|
];
|
|
11
|
-
const useScrollToError = (errorClassNames =
|
|
12
|
-
const ref =
|
|
13
|
-
const scrollToErrorHandler =
|
|
8
|
+
export const useScrollToError = (errorClassNames = errorClassNamesDefault) => {
|
|
9
|
+
const ref = useRef(null);
|
|
10
|
+
const scrollToErrorHandler = useCallback(() => {
|
|
14
11
|
setTimeout(() => {
|
|
15
12
|
if (ref.current) {
|
|
16
13
|
for (const errorClassName of errorClassNames) {
|
|
@@ -28,5 +25,4 @@ const useScrollToError = (errorClassNames = exports.errorClassNamesDefault) => {
|
|
|
28
25
|
}, [errorClassNames]);
|
|
29
26
|
return [ref, scrollToErrorHandler];
|
|
30
27
|
};
|
|
31
|
-
exports.useScrollToError = useScrollToError;
|
|
32
28
|
//# sourceMappingURL=use-scroll-to-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-scroll-to-error.js","sourceRoot":"","sources":["../../../src/hooks/use-scroll-to-error/use-scroll-to-error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-scroll-to-error.js","sourceRoot":"","sources":["../../../src/hooks/use-scroll-to-error/use-scroll-to-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvD,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,mBAAmB;IACnB,gBAAgB;IAChB,QAAQ;IACR,mBAAmB;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC5B,eAAe,GAAG,sBAAsB,EACd,EAAE;IAC5B,MAAM,GAAG,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IAC5B,MAAM,oBAAoB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC1C,UAAU,CAAC,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,OAAO,EAAE;gBACb,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE;oBAC1C,MAAM,KAAK,GAAG,GAAG,CAAC,OAAQ,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;oBACzD,IAAI,KAAK,EAAE;wBACP,KAAK,CAAC,cAAc,CAAC;4BACjB,KAAK,EAAE,QAAQ;4BACf,QAAQ,EAAE,QAAQ;yBACrB,CAAC,CAAC;wBACH,MAAM;qBACT;iBACJ;aACJ;QACL,CAAC,EAAE,CAAC,CAAC,CAAC;IACV,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IACtB,OAAO,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;AACvC,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./company-profile"), exports);
|
|
14
|
-
__exportStar(require("./address-suggestion-popover"), exports);
|
|
15
|
-
__exportStar(require("./hooks"), exports);
|
|
16
|
-
__exportStar(require("./utils"), exports);
|
|
1
|
+
export * from './company-profile';
|
|
2
|
+
export * from './address-suggestion-popover';
|
|
3
|
+
export * from './hooks';
|
|
4
|
+
export * from './utils';
|
|
17
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.arrayToMap = void 0;
|
|
4
|
-
const arrayToMap = (array, keySelector) => {
|
|
1
|
+
export const arrayToMap = (array, keySelector) => {
|
|
5
2
|
return new Map((array !== null && array !== void 0 ? array : []).map(item => [keySelector(item), item]));
|
|
6
3
|
};
|
|
7
|
-
exports.arrayToMap = arrayToMap;
|
|
8
4
|
//# sourceMappingURL=collection-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-helpers.js","sourceRoot":"","sources":["../../src/utils/collection-helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collection-helpers.js","sourceRoot":"","sources":["../../src/utils/collection-helpers.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAO,KAAsB,EAAE,WAA2B,EAAE,EAAE;IACpF,OAAO,IAAI,GAAG,CAAO,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/E,CAAC,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./collection-helpers"), exports);
|
|
1
|
+
export * from './collection-helpers';
|
|
14
2
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/onboarding-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.1",
|
|
4
4
|
"description": "Shared components between servicetitan monolith and Onboarding",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@contentful/rich-text-react-renderer": "^15.6.2",
|
|
53
53
|
"@contentful/rich-text-types": "^15.7.0",
|
|
54
|
-
"@servicetitan/react-hooks": "^2.
|
|
54
|
+
"@servicetitan/react-hooks": "^2.6.1",
|
|
55
55
|
"@types/google.maps": "^3.45.6",
|
|
56
56
|
"classnames": "~2.3.1",
|
|
57
57
|
"contentful-resolve-response": "^1.3.0",
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
"companyProfile"
|
|
62
62
|
],
|
|
63
63
|
"author": "Suman Lama",
|
|
64
|
-
"license": "ISC",
|
|
65
64
|
"publishConfig": {
|
|
66
65
|
"access": "public"
|
|
67
66
|
},
|
|
@@ -69,5 +68,5 @@
|
|
|
69
68
|
"less": true,
|
|
70
69
|
"webpack": false
|
|
71
70
|
},
|
|
72
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "7148377158b6d403739648d5e2eea293c732c491"
|
|
73
72
|
}
|
|
@@ -9,27 +9,37 @@ import { CompanyProfileFormStore } from '../stores/company-profile-form.store';
|
|
|
9
9
|
import { MaskedInput } from '@servicetitan/form';
|
|
10
10
|
|
|
11
11
|
export const CompanyProfileForm = observer((props: { className?: string }) => {
|
|
12
|
-
const [
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const [
|
|
13
|
+
{
|
|
14
|
+
form,
|
|
15
|
+
showFormError,
|
|
16
|
+
zipCodeMask,
|
|
17
|
+
einOrBnMask,
|
|
18
|
+
einOrBnInputProps,
|
|
19
|
+
countries,
|
|
20
|
+
countryAndRegionData,
|
|
21
|
+
regionToCodeMap,
|
|
22
|
+
phoneMask,
|
|
23
|
+
},
|
|
24
|
+
] = useDependencies(CompanyProfileFormStore);
|
|
15
25
|
|
|
16
26
|
const zipCodeOnChangeHandler = (zip: string) => {
|
|
17
27
|
form.$.companyZipCode.onChange(zip);
|
|
18
28
|
};
|
|
19
29
|
|
|
20
30
|
const einOrBnOnChangeHandler = (einOrBn: string) => {
|
|
21
|
-
form.$.einOrBn.onChange(einOrBn);
|
|
31
|
+
form.$.einOrBn.onChange((einOrBn || '').replace(/[^0-9.]/g, ''));
|
|
22
32
|
};
|
|
23
33
|
|
|
24
34
|
const phoneOnChangeHandler = (phone: string) => {
|
|
25
|
-
form.$.adminPhone.onChange(phone);
|
|
35
|
+
form.$.adminPhone.onChange((phone || '').replace(/[^0-9.]/g, ''));
|
|
26
36
|
};
|
|
27
37
|
|
|
28
38
|
const countryOnChangeHandler = (
|
|
29
39
|
event: SyntheticEvent<HTMLElement>,
|
|
30
40
|
data: FormDropdownProps
|
|
31
41
|
) => {
|
|
32
|
-
if (form.$.companyCountry
|
|
42
|
+
if (form.$.companyCountry.value && data.value !== form.$.companyCountry.value) {
|
|
33
43
|
form.$.companyStateCode.onChange('');
|
|
34
44
|
}
|
|
35
45
|
form.$.companyCountry.onChangeHandler(event, data);
|
|
@@ -44,7 +54,7 @@ export const CompanyProfileForm = observer((props: { className?: string }) => {
|
|
|
44
54
|
companyZipCode,
|
|
45
55
|
adminPhone,
|
|
46
56
|
einOrBn,
|
|
47
|
-
} =
|
|
57
|
+
} = form.$;
|
|
48
58
|
|
|
49
59
|
const zipCodeHasError = companyZipCode.hasError;
|
|
50
60
|
|
|
@@ -82,8 +92,8 @@ export const CompanyProfileForm = observer((props: { className?: string }) => {
|
|
|
82
92
|
countryCode={companyCountry.value || 'USA'}
|
|
83
93
|
fieldState={companyStateCode}
|
|
84
94
|
error={(companyStateCode.dirty || showFormError) && companyStateCode.hasError}
|
|
85
|
-
countryAndRegionData={
|
|
86
|
-
regionNameToCodeMap={
|
|
95
|
+
countryAndRegionData={countryAndRegionData}
|
|
96
|
+
regionNameToCodeMap={regionToCodeMap}
|
|
87
97
|
/>
|
|
88
98
|
</Form.Group>
|
|
89
99
|
<Form.Group width="equal">
|
|
@@ -104,7 +114,11 @@ export const CompanyProfileForm = observer((props: { className?: string }) => {
|
|
|
104
114
|
value={companyCountry.value}
|
|
105
115
|
onChange={countryOnChangeHandler}
|
|
106
116
|
error={(companyCountry.dirty || showFormError) && companyCountry.hasError}
|
|
107
|
-
options={
|
|
117
|
+
options={countries.map(x => ({
|
|
118
|
+
key: x,
|
|
119
|
+
value: x,
|
|
120
|
+
text: x === 'USA' ? 'United States' : x,
|
|
121
|
+
}))}
|
|
108
122
|
/>
|
|
109
123
|
</Form.Group>
|
|
110
124
|
<Form.Group width="equal">
|
|
@@ -115,7 +129,7 @@ export const CompanyProfileForm = observer((props: { className?: string }) => {
|
|
|
115
129
|
value={adminPhone.value}
|
|
116
130
|
onChange={phoneOnChangeHandler}
|
|
117
131
|
error={(adminPhone.dirty || showFormError) && adminPhone.hasError}
|
|
118
|
-
mask={
|
|
132
|
+
mask={phoneMask}
|
|
119
133
|
width={6}
|
|
120
134
|
/>
|
|
121
135
|
<MaskedInput
|
|
@@ -8,9 +8,7 @@ export interface ICountryDropdownInput extends FormDropdownProps {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const CountryDropdownInput = observer((props: ICountryDropdownInput) => {
|
|
11
|
-
const { value
|
|
12
|
-
const value = propsValue && propsValue!.toString().toLowerCase();
|
|
13
|
-
const country = value && (value === 'canada' || value === 'ca' ? 'Canada' : 'USA');
|
|
11
|
+
const { value, width, placeholder, ...rest } = props;
|
|
14
12
|
return (
|
|
15
13
|
<Form.Select
|
|
16
14
|
fluid
|
|
@@ -18,7 +16,7 @@ export const CountryDropdownInput = observer((props: ICountryDropdownInput) => {
|
|
|
18
16
|
width={width ?? '12'}
|
|
19
17
|
label="Country"
|
|
20
18
|
placeholder={placeholder ?? 'Country'}
|
|
21
|
-
value={
|
|
19
|
+
value={value}
|
|
22
20
|
{...rest}
|
|
23
21
|
/>
|
|
24
22
|
);
|
|
@@ -142,7 +142,11 @@ export class CompanyProfileFormStore implements ICompanyProfileFormStore {
|
|
|
142
142
|
this.countryAndRegionData = options.countryAndRegionData;
|
|
143
143
|
this.phoneMask = options.phoneMask;
|
|
144
144
|
this.regionToCodeMap = options.regionToCodeMap;
|
|
145
|
-
|
|
145
|
+
let companyCountry = formData.companyCountry;
|
|
146
|
+
if (companyCountry && this.countries && !this.countries?.includes(companyCountry)) {
|
|
147
|
+
companyCountry = '';
|
|
148
|
+
}
|
|
149
|
+
setFormStateValues(this.form, { ...formData, companyCountry });
|
|
146
150
|
commitFormState(this.form);
|
|
147
151
|
};
|
|
148
152
|
|