stand_socotra_policy_transformer 2.0.0 → 2.0.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.
@@ -0,0 +1,18 @@
1
+ {
2
+ "paymentScheduleName": "upfront",
3
+ "updateExposures": [
4
+ {
5
+ "exposureLocator": "81f6f009-87bc-435e-aac7-269e240ecbb2",
6
+ "fieldValues": {
7
+ "protection_class": "3",
8
+ "dead_bolt": "No"
9
+ },
10
+ "fieldGroups": []
11
+ }
12
+ ],
13
+ "name": "example name",
14
+ "fieldValues": {
15
+ "coverage_b": 300000,
16
+ "zip": "94655"
17
+ }
18
+ }
@@ -1,12 +1,14 @@
1
1
  const {load_payload} = require("../__utils__/load_payload");
2
- const {new_policy_payload, policy_holder_payload, quote_to_retool_payload, retool_to_quote_updated } = require("../../src/retool_utils/socotra_payloads");
2
+ const { SocotraPayloadConverter } = require("../../src/retool_utils/socotra_payloads");
3
+ const { entries_v2} = require("../../src/retool_utils/versions/stand_v2_entries")
3
4
 
4
5
  describe("Policy Holder Payload", () => {
6
+ let converter = new SocotraPayloadConverter(entries_v2)
5
7
  test('fails with descriptive error if just one field is missing', () => {
6
8
  let retool_payload = load_payload('__tests__/__utils__/payloads/sample_retool.json')
7
9
  delete retool_payload['owner_first_name']
8
10
 
9
- let res = policy_holder_payload(retool_payload);
11
+ let res = converter.policy_holder_payload(retool_payload);
10
12
  expect(res.payload).toEqual({});
11
13
  expect(res.error_message).toBe("must include the following fields [owner_first_name]")
12
14
  expect(res.status).toBe("error")
@@ -18,7 +20,7 @@ describe("Policy Holder Payload", () => {
18
20
  delete retool_payload['owner_email']
19
21
  delete retool_payload['owner_phone_number']
20
22
 
21
- let res = policy_holder_payload(retool_payload);
23
+ let res = converter.policy_holder_payload(retool_payload);
22
24
  expect(res.payload).toEqual({});
23
25
  expect(res.error_message).toBe("must include the following fields [owner_first_name,owner_last_name,owner_email]")
24
26
  expect(res.status).toBe("error")
@@ -26,7 +28,7 @@ describe("Policy Holder Payload", () => {
26
28
 
27
29
  test('succeeds if all required fields are there', () => {
28
30
  let retool_payload = load_payload('__tests__/__utils__/payloads/sample_retool.json')
29
- let res = policy_holder_payload(retool_payload);
31
+ let res = converter.policy_holder_payload(retool_payload);
30
32
 
31
33
  expect(res.payload).toEqual(load_payload('__tests__/__utils__/payloads/sample_new_policy_holder.json'));
32
34
  expect(res.error_message).toBe("")
@@ -35,9 +37,10 @@ describe("Policy Holder Payload", () => {
35
37
  });
36
38
 
37
39
  describe("New Policy Payload", () => {
40
+ let converter = new SocotraPayloadConverter(entries_v2)
38
41
  test("Happy Path works", () => {
39
42
  let retool_payload = load_payload('__tests__/__utils__/payloads/sample_retool.json')
40
- let res = new_policy_payload(retool_payload, '9bdadf0c-5ce0-4ea7-8f9d-7e7d235522d0');
43
+ let res = converter.new_policy_payload(retool_payload, '9bdadf0c-5ce0-4ea7-8f9d-7e7d235522d0');
41
44
 
42
45
  expect(res.payload).toEqual(load_payload('__tests__/__utils__/payloads/sample_new_quote.json'));
43
46
  expect(res.error_message).toBe("")
@@ -47,7 +50,7 @@ describe("New Policy Payload", () => {
47
50
  test("Works when number set to empty string", () => {
48
51
  let retool_payload = load_payload('__tests__/__utils__/payloads/sample_retool.json')
49
52
  retool_payload['home_heating_update_year'] = ""
50
- let res = new_policy_payload(retool_payload, '9bdadf0c-5ce0-4ea7-8f9d-7e7d235522d0');
53
+ let res = converter.new_policy_payload(retool_payload, '9bdadf0c-5ce0-4ea7-8f9d-7e7d235522d0');
51
54
 
52
55
  let expected_payload = load_payload('__tests__/__utils__/payloads/sample_new_quote.json')
53
56
  delete expected_payload['fieldValues']['home_heater_last_updated']
@@ -59,7 +62,7 @@ describe("New Policy Payload", () => {
59
62
  test("Works with payment schedule override", () => {
60
63
  let retool_payload = load_payload('__tests__/__utils__/payloads/sample_retool.json')
61
64
  retool_payload['payment_schedule'] = 'quarterly'
62
- let res = new_policy_payload(retool_payload, '9bdadf0c-5ce0-4ea7-8f9d-7e7d235522d0');
65
+ let res = converter.new_policy_payload(retool_payload, '9bdadf0c-5ce0-4ea7-8f9d-7e7d235522d0');
63
66
 
64
67
  let socotra_quote_payload = load_payload('__tests__/__utils__/payloads/sample_new_quote.json')
65
68
  socotra_quote_payload['paymentScheduleName'] = 'quarterly'
@@ -71,7 +74,7 @@ describe("New Policy Payload", () => {
71
74
 
72
75
  test("Works with minimal payload with no unneeded fields", () => {
73
76
  let retool_payload = load_payload('__tests__/__utils__/payloads/sample_minimal_retool.json')
74
- let res = new_policy_payload(retool_payload, 'f0d09c62-3ec1-4830-b4b3-17e7bed46560');
77
+ let res = converter.new_policy_payload(retool_payload, 'f0d09c62-3ec1-4830-b4b3-17e7bed46560');
75
78
 
76
79
  expect(res.payload).toEqual(load_payload('__tests__/__utils__/payloads/sample_minimal_socotra_payload.json'));
77
80
  expect(res.error_message).toBe("")
@@ -80,9 +83,10 @@ describe("New Policy Payload", () => {
80
83
  })
81
84
 
82
85
  describe("Retool Payload", () => {
86
+ let converter = new SocotraPayloadConverter(entries_v2)
83
87
  test('Happy path converts to retool payload', () => {
84
88
  let socotra_payload = load_payload('__tests__/__utils__/payloads/sample_socotra_quote.json')
85
- let res = quote_to_retool_payload(socotra_payload)
89
+ let res = converter.quote_to_retool_payload(socotra_payload)
86
90
 
87
91
  let retool_payload = load_payload('__tests__/__utils__/payloads/sample_retool_socotra_subset.json')
88
92
  delete retool_payload['socotra_config_version']
@@ -93,6 +97,7 @@ describe("Retool Payload", () => {
93
97
  })
94
98
 
95
99
  describe("Update Socotra Quote", () => {
100
+ let converter = new SocotraPayloadConverter(entries_v2)
96
101
  test('Happy path converts to retool payload', () => {
97
102
  let retool_payload = load_payload('__tests__/__utils__/payloads/sample_retool_socotra_subset.json')
98
103
  retool_payload["protection_class"] = "3"
@@ -105,7 +110,7 @@ describe("Update Socotra Quote", () => {
105
110
  delete old_quote['name']
106
111
 
107
112
 
108
- let res = retool_to_quote_updated(retool_payload, old_quote)
113
+ let res = converter.retool_to_quote_updated(retool_payload, old_quote)
109
114
 
110
115
  expect(res.payload).toEqual(load_payload('__tests__/__utils__/payloads/sample_update_quote.json'));
111
116
  expect(res.error_message).toBe("")
@@ -118,7 +123,7 @@ describe("Update Socotra Quote", () => {
118
123
  delete old_quote['name']
119
124
 
120
125
 
121
- let res = retool_to_quote_updated(retool_payload, old_quote)
126
+ let res = converter.retool_to_quote_updated(retool_payload, old_quote)
122
127
 
123
128
  expect(res.payload).toEqual(load_payload('__tests__/__utils__/payloads/minimal_change_resulting_socotra.json'));
124
129
  expect(res.error_message).toBe("")
@@ -131,7 +136,7 @@ describe("Update Socotra Quote", () => {
131
136
  delete old_quote['name']
132
137
 
133
138
 
134
- let res = retool_to_quote_updated(retool_payload, old_quote)
139
+ let res = converter.retool_to_quote_updated(retool_payload, old_quote)
135
140
 
136
141
  expect(res.payload).toEqual(load_payload('__tests__/__utils__/payloads/minimal_change_resulting_socotra2.json'));
137
142
  expect(res.error_message).toBe("")
@@ -145,7 +150,7 @@ describe("Update Socotra Quote", () => {
145
150
  let old_quote = load_payload('__tests__/__utils__/payloads/sample_socotra_quote.json')
146
151
 
147
152
 
148
- let res = retool_to_quote_updated(retool_payload, old_quote)
153
+ let res = converter.retool_to_quote_updated(retool_payload, old_quote)
149
154
 
150
155
 
151
156
  expect(res.payload).not.toHaveProperty("updateExposures")
@@ -160,7 +165,7 @@ describe("Update Socotra Quote", () => {
160
165
  let old_quote = load_payload('__tests__/__utils__/payloads/sample_socotra_quote.json')
161
166
 
162
167
 
163
- let res = retool_to_quote_updated(retool_payload, old_quote)
168
+ let res = converter.retool_to_quote_updated(retool_payload, old_quote)
164
169
 
165
170
 
166
171
  expect(res.payload).not.toHaveProperty("fieldValues")
@@ -0,0 +1,51 @@
1
+ const {SocotraPayloadConverter} = require("../../../src/retool_utils/socotra_payloads");
2
+ const {entries_v1} = require("../../../src/retool_utils/versions/stand_v1_entries");
3
+ const {load_payload} = require("../../__utils__/load_payload");
4
+ const {entries_v2} = require("../../../src/retool_utils/versions/stand_v2_entries");
5
+ describe("New Policy Payload V1", () => {
6
+ let converter = new SocotraPayloadConverter(entries_v1)
7
+ test("Happy Path works", () => {
8
+ let retool_payload = load_payload('__tests__/__utils__/payloads/versions/v1/sample_retool.json')
9
+ let res = converter.new_policy_payload(retool_payload, '9bdadf0c-5ce0-4ea7-8f9d-7e7d235522d0');
10
+
11
+ expect(res.payload).toEqual(load_payload('__tests__/__utils__/payloads/versions/v1/sample_new_quote.json'));
12
+ expect(res.error_message).toBe("")
13
+ expect(res.status).toBe("success")
14
+ })
15
+ });
16
+
17
+ describe("Retool Payload V1", () => {
18
+ let converter = new SocotraPayloadConverter(entries_v1)
19
+ test('Happy path converts to retool payload', () => {
20
+ let socotra_payload = load_payload('__tests__/__utils__/payloads/versions/v1/sample_socotra_quote.json')
21
+ let res = converter.quote_to_retool_payload(socotra_payload)
22
+
23
+ let retool_payload = load_payload('__tests__/__utils__/payloads/versions/v1/sample_retool_socotra_subset.json')
24
+ delete retool_payload['socotra_config_version']
25
+ expect(res.payload).toEqual(retool_payload);
26
+ expect(res.error_message).toBe("")
27
+ expect(res.status).toBe("success")
28
+ })
29
+ })
30
+
31
+ describe("Update Socotra Quote", () => {
32
+ let converter = new SocotraPayloadConverter(entries_v2)
33
+ test('Happy path converts to retool payload', () => {
34
+ let retool_payload = load_payload('__tests__/__utils__/payloads/versions/v1/sample_retool_socotra_subset.json')
35
+ retool_payload["protection_class"] = "3"
36
+ retool_payload["deadbolt"] = "No"
37
+ retool_payload["coverage_b"] = 300000
38
+ retool_payload["zip"] = "94655"
39
+ retool_payload["payment_schedule"] = "upfront"
40
+
41
+ let old_quote = load_payload('__tests__/__utils__/payloads/versions/v1/sample_socotra_quote.json')
42
+ delete old_quote['name']
43
+
44
+
45
+ let res = converter.retool_to_quote_updated(retool_payload, old_quote)
46
+
47
+ expect(res.payload).toEqual(load_payload('__tests__/__utils__/payloads/versions/v1/sample_update_quote.json'));
48
+ expect(res.error_message).toBe("")
49
+ expect(res.status).toBe("success")
50
+ })
51
+ })
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.stand_underwriter=t():e.stand_underwriter=t()}(this,(()=>{return e={10:e=>{e.exports={is_vacant:function(e){return"No"===e?{decision:"accept",note:null}:"Yes"===e?{decision:"reject",note:"Home is vacant"}:{decision:"reject",note:"Vacant must be yes or no"}},under_renovation:function(e){return"No"===e?{decision:"accept",note:null}:"Yes"===e?{decision:"reject",note:"Home is under renovation"}:{decision:"reject",note:"Under renovation must be yes or no"}},plumbing_last_update_year:function(e){return Number.isInteger(e)?e<1600||e>3e3?{decision:"reject",note:"Plumbing input should be the year it was last updated not the age"}:(year_threshold=(new Date).getFullYear()-30,e>=year_threshold?{decision:"accept",note:null}:{decision:"reject",note:"Plumbing must have been updated in the last 30 years"}):{decision:"reject",note:"Plumbing year must be an integer"}},water_heater_last_update_year:function(e){return Number.isInteger(e)?e<1600||e>3e3?{decision:"reject",note:"Water heater input should be the year it was last updated not the age"}:(year_threshold=(new Date).getFullYear()-10,e>=year_threshold?{decision:"accept",note:null}:{decision:"reject",note:"Water heater must have been updated in the last 10 years"}):{decision:"reject",note:"Water heater year must be an integer"}},electrical_last_update_year:function(e){return Number.isInteger(e)?e<1600||e>3e3?{decision:"reject",note:"Electrical input should be the year it was last updated not the age"}:(year_threshold=(new Date).getFullYear()-30,e>=year_threshold?{decision:"accept",note:null}:{decision:"reject",note:"Electrical must have been updated in the last 30 years"}):{decision:"reject",note:"Electrical year must be an integer"}},home_heating_last_update_year:function(e){return Number.isInteger(e)?e<1600||e>3e3?{decision:"reject",note:"Home heating input should be the year it was last updated not the age"}:(year_threshold=(new Date).getFullYear()-30,e>=year_threshold?{decision:"accept",note:null}:{decision:"reject",note:"Home heating must have been updated in the last 30 years"}):{decision:"reject",note:"Home heating year must be an integer"}},heating_source:function(e){return heating_type_enum=["central gas heat","thermostatically controlled electrical heat","wood","coal","pellet stove"],"string"!=typeof e?{decision:"reject",note:"Home heating year must be a string"}:heating_type_enum.includes(e)?["wood","coal","pellet stove"].includes(e)?{decision:"refer",note:null}:{decision:"accept",note:null}:{decision:"reject",note:"Heat source must be in [central gas heat, thermostatically controlled electrical heat, wood, coal, pellet stove]"}},has_underground_fuel_tank:function(e){return"No"===e?{decision:"accept",note:null}:"Yes"===e?{decision:"reject",note:"Home has underground fuel tank"}:{decision:"reject",note:"Underground fuel tank must be yes or no"}},has_steel_braided_hose:function(e){return"Yes"===e?{decision:"accept",note:null}:"No"===e?{decision:"refer",note:null}:{decision:"reject",note:"Steel braided hose must be yes or no"}},has_water_shutoff:function(e){return"Yes"===e?{decision:"accept",note:null}:"No"===e?{decision:"refer",note:null}:{decision:"reject",note:"Water shutoff must be yes or no"}},has_circuit_breaker:function(e,t){return"No"===e||t>=1980?{decision:"accept",note:null}:"Yes"===e?{decision:"reject",note:"Home built before 1980 cannot have circuit breakers"}:{decision:"reject",note:"Circuit breaker must be yes or no"}}}},44:(e,t,i)=>{const{underwrite:o,knockout_names:n}=i(273),{policy_holder_payload:r,new_policy_payload:s,quote_to_retool_payload:a,retool_to_quote_updated:l}=i(991);e.exports={underwrite:o,knockout_names:n,policy_holder_payload:r,new_policy_payload:s,quote_to_retool_payload:a,retool_to_quote_updated:l}},66:e=>{e.exports={multi_family_unit_count:function(e){return Number.isInteger(e)?e>2?{decision:"reject",note:"We only allow homes with two units or less."}:e<=0?{decision:"reject",note:"Number of units must be greater than 0"}:{decision:"accept",note:null}:{decision:"reject",note:"Number of units must be an integer"}},primary_dwelling_is_insured:function(e){return"No"==e?{decision:"refer",note:null}:"Yes"==e?{decision:"accept",note:null}:{decision:"reject",note:"Primary dwelling insured value must be in ['yes', 'no']"}},full_replacement_value:function(e){return Number.isInteger(e)?e>6e6?{decision:"refer",note:null}:e<2e6?{decision:"reject",note:"We only insure homes greater than $1M"}:{decision:"accept",note:null}:{decision:"reject",note:"Full replacement value must be an integer"}},prior_carrier:function(e){return""===e?{decision:"refer",note:null}:"string"==typeof e?{decision:"accept",note:null}:{decision:"reject",note:"Prior Carrier Must be a string"}},occupation:function(e){return"string"!=typeof e?{decision:"reject",note:"Occupation must be a string"}:["Professional Athlete","Entertainer","Journalist"," Politician"].includes(e)?{decision:"refer",note:null}:{decision:"accept",note:null}}}},78:(e,t,i)=>{const{multi_family_unit_count:o,primary_dwelling_is_insured:n,full_replacement_value:r,prior_carrier:s,occupation:a}=i(66),{wf_variance:l,stand_wf_knockout:c}=i(575),{distance_to_coast:d,pool_features:u,farming_type:_,has_attractive_nuisance:p,degree_of_slope:f,flood_score:m}=i(752),{number_of_dogs:y,dog_history:g,dog_breeds:h,exotic_pets:w,number_of_mortgages:b,number_of_bankruptcies_judgements_or_liens:v,home_business_type:j,home_rental_type:x,same_address:k}=i(729),{is_vacant:F,under_renovation:N,plumbing_last_update_year:S,water_heater_last_update_year:Y,electrical_last_update_year:V,home_heating_last_update_year:I,heating_source:C,has_underground_fuel_tank:E,has_steel_braided_hose:A,has_water_shutoff:D,has_circuit_breaker:H}=i(10),{construction_type:q,siding_material:O,protection_class:G,roof_material:P,foundation_type:T,has_slab_foundation_plumbing:M,fire_protective_devices:$,theft_protective_devices:W,has_class_a_roof:z}=i(479),{check_claims_history:B}=i(529),L={multi_family_unit_count:o,primary_dwelling_insured:n,full_replacement_value:r,prior_carrier:s,wf_variance:l,flood_score:m,distance_to_coast:d,pool_features:u,number_of_dogs:y,dog_history:g,dog_breeds:h,exotic_pets:w,farming_type:_,number_of_mortgages:b,number_of_bankruptcies_judgements_or_liens:v,is_vacant:F,under_renovation:N,plumbing_last_update_year:S,water_heater_last_update_year:Y,electrical_last_update_year:V,home_heating_last_update_year:I,heating_source:C,has_underground_fuel_tank:E,has_steel_braided_hose:A,has_water_shutoff:D,home_business_type:j,has_attractive_nuisance:p,home_rental_type:x,degree_of_slope:f,construction_type:q,siding_material:O,protection_class:G,roof_material:P,foundation_type:T,has_slab_foundation_plumbing:M,fire_protective_devices:$,theft_protective_devices:W,occupation:a};e.exports={knockout:function(e,t){return L.hasOwnProperty(e)?L[e](t):{decision:"question_not_found",note:null}},has_circuit_breaker:H,same_address:k,knockout_names:function(){return Object.keys(L)},stand_wf_knockout:c,has_class_a_roof:z,check_claims_history:B}},273:(e,t,i)=>{const{knockout:o,knockout_names:n,same_address:r,stand_wf_knockout:s,has_circuit_breaker:a,has_class_a_roof:l,check_claims_history:c}=i(78);function d(e){let t=[];for(let i in e)"refer"===e[i]&&t.push(i);return t}function u(e){for(let t in e)if("reject"===e[t])return"reject";for(let t in e)if("refer"===e[t])return"refer";return"accept"}function _(e,t,i,o,n={}){o[t]=e.decision,n[t]=e.note,e.note&&i.push(e.note)}e.exports={underwrite:function(e,t=!0){let i,p={},f=[],m={};for(let i of n())(t||Object.keys(e).includes(i))&&_(o(i,e[i]),i,f,p,m);return(t||"address"in e&&"co_applicant_address"in e)&&_(r(e.address,e.co_applicant_address),"co_applicant_address",f,p,m),(t||"wf_score_mean"in e&&"arf"in e)&&(i=s(e.wf_score_mean,e.arf),_(i.underwriter_result,"wf_score_mean",f,p,m)),(t||"circuit_breaker"in e&&"year_built"in e)&&_(a(e.circuit_breaker,e.year_built),"circuit_breaker",f,p,m),(t||"class_a_roof"in e)&&_(l(e.class_a_roof,i.category),"roof_rating",f,p,m),(t||"claims"in e)&&_(c(e.claims),"claims",f,p,m),{decision:u(p),notes:f,refers:d(p),all_decisions:p,notes_dict:m}},knockout_names:n}},479:e=>{e.exports={construction_type:function(e){return"string"!=typeof e?{decision:"reject",note:"Construction type must be a string"}:["Concrete","Frame","Log","Masonry","Mobile / Manufactured","Steel","Modular"].includes(e)?["Concrete","Frame","Masonry","Steel"].includes(e)?{decision:"accept",note:null}:{decision:"reject",note:"Construction type not supported"}:{decision:"reject",note:"Construction type must be one of [Concrete, Frame, Log, Masonry, Mobile / Manufactured, Steel, Modular]"}},siding_material:function(e){return"string"!=typeof e?{decision:"reject",note:"Siding material must be a string"}:["Adobe","Aluminum / Steel","Asbestos","Brick / Masonry Veneer","Brick / Stone - Solid","Cement Fiber","Clapboard","Exterior Insulation Finishing System (EIFS)","Log","Stone Veneer","Stucco","Vinyl","Wood","Other - above descriptions do not apply"].includes(e)?["Log","Asbestos","Exterior Insulation Finishing System (EIFS)"].includes(e)?{decision:"reject",note:"Siding material not supported"}:"Wood"!==e?{decision:"accept",note:null}:void 0:{decision:"reject",note:"Siding material must be one of [Adobe, Aluminum / Steel, Asbestos, Brick / Masonry Veneer, Brick / Stone - Solid, Cement Fiber, Clapboard, Exterior Insulation Finishing System (EIFS), Log, Stone Veneer, Stucco, Vinyl, Wood, Other - above descriptions do not apply]"}},protection_class:function(e){let t=["1","2","3","4","5","6","7","8","8B","1Y","2Y","3Y","4Y","5Y","6Y","7Y","8Y","9","1X","2X","3X","4X","5X","6X","7X","8X","9","10","10W"];return"string"!=typeof e?{decision:"reject",note:"Protection class must be a string"}:t.includes(e)?["9","10"].includes(e)?{decision:"reject",note:"Protection class not supported"}:{decision:"accept",note:null}:{decision:"reject",note:`Protection class must be one of ${t}`}},roof_material:function(e){let t=["Architecture Shingles","Asphalt Fiberglass Composite","Clay-Tile-Slate","Concrete Tile","Corrugated Steel - Metal","Flat Foam Composite"," Flat Membrane","Flat Tar Gravel","Other","Wood Shake","Wood Shingle"];return"string"!=typeof e?{decision:"reject",note:"Roof material must be a string"}:t.includes(e)?["Wood Shake","Wood Shingle"].includes(e)?{decision:"reject",note:"Roof material not supported"}:{decision:"accept",note:null}:{decision:"reject",note:`Roof material must be one of ${t}`}},has_class_a_roof:function(e,t){return"string"!=typeof e?{decision:"reject",note:"Has class a roof must be a string"}:["Yes","No"].includes(e)?"Yes"===e||["A","B"].includes(t)?{decision:"accept",note:null}:{decision:"reject",note:"Homes in this wildfire category must have class a roofs"}:{decision:"reject",note:"Has class a roof must be Yes or No"}},foundation_type:function(e){let t=["Basement Finished","Basement Partially Finished","Basement Unfinished","Crawlspace","Other","Piers","Pilings","Stilts","Slab"];return"string"!=typeof e?{decision:"reject",note:"Foundation type must be a string"}:t.includes(e)?"Other"==e?{decision:"refer",note:null}:["Piers","Pilings","Stilts"].includes(e)?{decision:"reject",note:"Foundation type not supported"}:{decision:"accept",note:null}:{decision:"reject",note:`Foundation type must be one of ${t}`}},has_slab_foundation_plumbing:function(e){return"string"!=typeof e?{decision:"reject",note:"Has slab foundation plumbing must be a string"}:["Yes","No"].includes(e)?"Yes"===e?{decision:"reject",note:"Homes with slab foundation plumbing are not allowed"}:{decision:"accept",note:null}:{decision:"reject",note:"Has slab foundation plumbing must be Yes or No"}},fire_protective_devices:function(e){if(!Array.isArray(e))return{decision:"reject",note:"Fire protective devices must be a list"};let t=["Local","Central","Direct","Sprinkler","Fire Ext","Smoke","No"];return e.every((e=>t.includes(e)))?e.includes("Direct")||e.includes("Central")?{decision:"accept",note:null}:{decision:"reject",note:"Insufficient fire devices"}:{decision:"reject",note:`Unrecognized fire device type. Valid devices: ${t}`}},theft_protective_devices:function(e){return Array.isArray(e)?(device_types=["Dead Bolt","Local","Central","Direct","24 Hour Security Guard","No"],e.every((e=>device_types.includes(e)))?e.includes("Central")||e.includes("Direct")||e.includes("24 Hour Security Guard")?{decision:"accept",note:null}:{decision:"reject",note:"Insufficient theft device"}:{decision:"reject",note:`Unrecognized theft device type. Valid devices: ${device_types}`}):{decision:"reject",note:"Theft protective devices must be a list"}}}},529:e=>{e.exports={check_claims_history:function(e){if(!e)return{decision:"reject",note:"For Claims use empty instead of null"};let t=new Date,i=new Date,o=new Date;i.setFullYear(t.getFullYear()-5),o.setFullYear(t.getFullYear()-3);let n=e.filter((e=>e.date>i)),r=e.filter((e=>e.date>o));return n.length>2?{decision:"reject",note:"To many claims in the past 5 years"}:r.length>1?{decision:"reject",note:"To many claims in the past 3 years"}:{decision:"accept",note:null}}}},575:e=>{e.exports={stand_wf_knockout:function(e,t){return e<0||t<0?{category:"",underwriter_result:{decision:"reject",note:"Mean and ARF must be positive numbers"}}:Number.isFinite(t)&&Number.isFinite(e)?e>=.7?{category:"D",underwriter_result:{decision:"reject",note:"Stand WF mean must be less than or equal to 0.7"}}:t>=8?{category:"C",underwriter_result:{decision:"refer",note:null}}:t>=5||e>=.2?{category:"C",underwriter_result:{decision:"accept",note:null}}:e>=.1?{category:"B",underwriter_result:{decision:"accept",note:null}}:{category:"A",underwriter_result:{decision:"accept",note:null}}:{category:"",underwriter_result:{decision:"reject",note:"ARF must be a number"}}},wf_variance:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Variance must be a positive number."}:e<=.09?{decision:"accept",note:null}:{decision:"refer",note:null}:{decision:"reject",note:"Variance must be a number."}}}},630:e=>{const t=Object.freeze(["policy.fields","policy.fields.array","exposure.dwelling.fields","policy.group","policy","exposure.dwelling.group","quote.name","effective_date","payment_schedule","quote.version"]);e.exports={SocotraEntry:class{constructor(e,i,o,n=e=>e,r=e=>e){if(!t.includes(o))throw new Error(`Unsupported Socotra Location: ${o}`);this.retool_id=e,this.socotra_id=i,this.socotra_location=o,this.to_scotra_func=r,this.to_retool_func=n}socotra_create_response(e,t){let i=this.to_scotra_func(e[this.retool_id]);if(this.socotra_location.includes("policy.fields"))t.fieldValues[this.socotra_id]=i;else if("exposure.dwelling.fields"===this.socotra_location)t.exposures[0].fieldValues[this.socotra_id]=i;else if("quote.name"===this.socotra_location);else if("effective_date"===this.socotra_location){const e=new Date(`${i}T00:00:00-08:00`),o=e.getTime();t.policyStartTimestamp=o;const n=new Date(e);n.setFullYear(e.getFullYear()+1),t.policyEndTimestamp=n.getTime()}else if("payment_schedule"===this.socotra_location)["upfront","quarterly"].includes(i)&&(t.paymentScheduleName=i);else{if("quote.version"!==this.socotra_location)throw new Error(`Location Not implemented: ${JSON.stringify(this)}`);t.configVersion=i}}retool_response(e,t){let i,o;if(this.socotra_location.includes("policy.fields"))i=e.characteristics.fieldValues[this.socotra_id];else{if("exposure.dwelling.fields"!==this.socotra_location){if("quote.name"===this.socotra_location)return void(t[this.retool_id]=e.name);if("effective_date"===this.socotra_location){let i=parseInt(e.characteristics[this.socotra_id])/1e3;var n=new Date(0);return n.setUTCSeconds(i),void(t[this.retool_id]=`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`)}if("payment_schedule"===this.socotra_location)return void(t[this.retool_id]=e[this.socotra_id]);if("quote.version"==this.socotra_location)return;throw new Error(`Location Not implemented: ${JSON.stringify(this)}`)}i=e.exposures.find((e=>"dwelling"===e.name)).characteristics.at(-1).fieldValues[this.socotra_id]}o=this.socotra_location.includes("array")?i:i?.[0]??null,o=this.to_retool_func(o),t[this.retool_id]=o}socotra_update(e,t){let i=this.to_scotra_func(e[this.retool_id]);if(this.socotra_location.includes("policy.fields"))t.fieldValues[this.socotra_id]=i;else if("exposure.dwelling.fields"===this.socotra_location)t.updateExposures[0].fieldValues[this.socotra_id]=i;else if("quote.name"===this.socotra_location)t.name=i;else if("effective_date"===this.socotra_location){const e=new Date(`${i}T00:00:00-08:00`);t.policyStartTimestamp=e.getTime();const o=new Date(e);o.setFullYear(e.getFullYear()+1),t.policyEndTimestamp=o.getTime()}else{if("payment_schedule"!==this.socotra_location){if("quote.version"===this.socotra_location)return;throw new Error(`Location Not implemented: ${JSON.stringify(this)}`)}["upfront","quarterly"].includes(i)&&(t.paymentScheduleName=i)}}static build_group(e,t){return{name:t}}static socotra_create_policy_template(e){return{policyholderLocator:e,productName:"homeowners",finalize:!1,paymentScheduleName:"upfront",exposures:[{exposureName:"dwelling",perils:[{name:"wildfire_expense",fieldValues:{},fieldGroups:[]},{name:"fire_following_earthquake",fieldValues:{},fieldGroups:[]},{name:"liability",fieldValues:{},fieldGroups:[]},{name:"other",fieldValues:{},fieldGroups:[]},{name:"theft",fieldValues:{},fieldGroups:[]},{name:"water_cat",fieldValues:{},fieldGroups:[]},{name:"water_excluding_cat",fieldValues:{},fieldGroups:[]},{name:"wildfire",fieldValues:{},fieldGroups:[]},{name:"wind_cat",fieldValues:{},fieldGroups:[]},{name:"wind_excluding_cat",fieldValues:{},fieldGroups:[]},{name:"fire",fieldValues:{},fieldGroups:[]},{name:"fac_prem",fieldValues:{},fieldGroups:[]},{name:"minimum_premium",fieldValues:{},fieldGroups:[]}],fieldValues:{},fieldGroups:[]}],fieldValues:{},fieldGroups:[],configVersion:-1}}static socotra_create_update_template(e){return{updateExposures:[{exposureLocator:e,fieldValues:{},fieldGroups:[]}],fieldValues:{}}}}}},729:e=>{e.exports={number_of_dogs:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Number of dogs must be a positive number."}:e<4?{decision:"accept",note:null}:{decision:"reject",note:"Owner has 4 or more dogs"}:{decision:"reject",note:"Number of dogs must be a number."}},dog_history:function(e){return"Yes"==e?{decision:"reject",note:"Has a dog with a history of aggressive behavior"}:"No"==e?{decision:"accept",note:null}:{decision:"reject",note:"Dog has history must be Yes or No."}},dog_breeds:function(e){return Array.isArray(e)?e.every((e=>"non-guard dog of other breeds"===e))?{decision:"accept",note:null}:{decision:"reject",note:"Dog of given breed not allowed"}:{decision:"reject",note:"Dog breed must be a list"}},exotic_pets:function(e){return"Yes"==e?{decision:"reject",note:"Has an exotic pet"}:"No"==e?{decision:"accept",note:null}:{decision:"reject",note:"Has exotic pet must be Yes or No."}},number_of_mortgages:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Number of mortgages must be a positive number."}:e<2?{decision:"accept",note:null}:{decision:"refer",note:null}:{decision:"reject",note:"Number of mortgages must be a number."}},number_of_bankruptcies_judgements_or_liens:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Number of bankruptcies, judgements, or liens must be a positive number"}:0===e?{decision:"accept",note:null}:{decision:"reject",note:"Has bankruptcies, judgements, or liens"}:{decision:"reject",note:"Number of bankruptcies, judgements, or liens must be a number"}},home_business_type:function(e){return"string"!=typeof e?{decision:"reject",note:"Home business type must be a string"}:["yes - day care","yes - other","no"].includes(e)?"no"==e?{decision:"accept",note:null}:"yes - day care"==e?{decision:"reject",note:"Cannot insure daycare"}:{decision:"refer",note:null}:{decision:"reject",note:"Home business type must be in [yes - day care, yes - other, no]"}},home_rental_type:function(e){return"string"!=typeof e?{decision:"reject",note:"Home rental type must be a string"}:["short-term rentals less than 6 months of the year","short term rentals more than 6 months of the year","timeshare","no"].includes(e)?"no"==e?{decision:"accept",note:null}:["short-term rentals less than 6 months of the year","timeshare"].includes(e)?{decision:"refer",note:null}:{decision:"reject",note:"Cannot insure rentals longer than 6 months"}:{decision:"reject",note:"Home rental type must be in [short-term rentals less than 6 months of the year, short term rentals more than 6 months of the year, timeshare, no]"}},same_address:function(e,t){return e===t?{decision:"accept",note:null}:{decision:"reject",note:"Co-Applicant must have same address as Applicant."}}}},752:e=>{e.exports={distance_to_coast:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Distance to coast must be a positive number."}:e>.19?{decision:"accept",note:null}:{decision:"refer",note:null}:{decision:"reject",note:"Distance to coast must be a number."}},pool_features:function(e){if(!Array.isArray(e))return{decision:"reject",note:"Pool features must be a list."};let t=e.includes("Inground")&&(e.includes("Electric retractable safety cover")||e.includes("Fenced with self-locking gate"));return t=t||e.includes("Above Ground")&&e.includes("Retractable/removable ladder"),e.includes("Diving Board")||e.includes("Slide")?{decision:"refer",note:null}:t?{decision:"accept",note:null}:{decision:"refer",note:null}},farming_type:function(e){let t=["Farming activities produce income","Incidental or hobby farming","Vineyard","None"];return"string"!=typeof e?{decision:"reject",note:"Farming type must be a string"}:t.includes(e)?"Vineyard"==e?{decision:"refer",note:null}:"Farming activities produce income"==e?{decision:"reject",note:"Cannot insure commercial farms"}:{decision:"accept",note:null}:{decision:"reject",note:`Farming type must be in [${t}]`}},has_attractive_nuisance:function(e){return"Yes"==e?{decision:"refer",note:null}:"No"==e?{decision:"accept",note:null}:{decision:"reject",note:"Has attractive nuisance must be Yes or No."}},degree_of_slope:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Degree of slope must be a positive number."}:e>30?{decision:"reject",note:"Slope greater than 30 degrees"}:{decision:"accept",note:null}:{decision:"reject",note:"Degree of slope must be a number."}},flood_score:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Flood score must be a positive number."}:e<9?{decision:"accept",note:null}:{decision:"reject",note:"Flood risk is too high"}:{decision:"reject",note:"Flood score must be a number."}}}},991:(e,t,i)=>{const{SocotraEntry:o}=i(630);function n(e){let t={};return a.forEach((i=>{i.retool_response(e,t)})),{payload:r(t,!1,!0,!1),error_message:"",status:"success"}}function r(e,t,i,o){return t&&(e=s(e,(e=>null==e))),i&&(e=s(e,(e=>void 0===e))),o&&(e=s(e,(e=>Number.isNaN(e)))),e}function s(e,t){let i=e=>s(e,t);return Array.isArray(e)?e.map(i).filter((e=>!t(e))):"object"==typeof e&&null!==e?Object.fromEntries(Object.entries(e).map((([e,t])=>[e,i(t)])).filter((([e,i])=>!t(i)))):e}const a=[new o("quote_name","quote_name","quote.name"),new o("socotra_config_version","config_version","quote.version"),new o("fire_deductible","wf_deductible","exposure.dwelling.fields",parseFloat),new o("other_deductible","aop_deductible","exposure.dwelling.fields",parseInt),new o("water_deductible","water_deductible","exposure.dwelling.fields",parseInt),new o("square_feet","square_feet","exposure.dwelling.fields",void 0,parseInt),new o("stand_protect_discount","stand_protect_discount","exposure.dwelling.fields"),new o("multi_policy_discount","multi_policy_discount","exposure.dwelling.fields"),new o(void 0,"has_any_claim_history","exposure.dwelling.fields",(e=>{}),(e=>"No")),new o("roof_rating","roof_rating","exposure.dwelling.fields"),new o("slab_plumbing","slab_plumbing","exposure.dwelling.fields"),new o("foundation_type","foundation_type","exposure.dwelling.fields"),new o("siding_material","siding_material","exposure.dwelling.fields"),new o("distance_to_fire_department","dist_to_fire_department","exposure.dwelling.fields"),new o("protection_class","protection_class","exposure.dwelling.fields"),new o("purchase_year","property_purchase_year","exposure.dwelling.fields",void 0,parseInt),new o("roof_material","roof_material","exposure.dwelling.fields"),new o("presence_of_fence","fence","exposure.dwelling.fields"),new o("year_built","year_built","exposure.dwelling.fields"),new o("construction_type","construction_type","exposure.dwelling.fields"),new o("water_damage_limit","water_damage_limit","exposure.dwelling.fields"),new o("extended_dwelling_coverage","extended_dwelling_coverage","exposure.dwelling.fields"),new o("sprinkler","sprinkler","exposure.dwelling.fields"),new o("smoke","smoke","exposure.dwelling.fields"),new o("fire_alarm","fire_alarm_type","exposure.dwelling.fields"),new o("fire_ext","fire_ext","exposure.dwelling.fields"),new o("deadbolt","dead_bolt","exposure.dwelling.fields"),new o(void 0,"24_hour_security_guard","exposure.dwelling.fields",(e=>{}),(e=>"No")),new o("theft_alarm","theft_alarm_type","exposure.dwelling.fields"),new o("distance_to_neighboring_home","distance_to_nearest_home_ft","exposure.dwelling.fields"),new o("chimney_spark_arrestors","chimney_mesh_cover","exposure.dwelling.fields"),new o("ember_resistant_vents","ember_vents","exposure.dwelling.fields"),new o("enclosed_eaves","enclosed_eaves","exposure.dwelling.fields"),new o("fuel_tank_distance","propane_tank_proximity","exposure.dwelling.fields"),new o("ground_clearance","exterior_clearance","exposure.dwelling.fields"),new o("windows_frame_type","window_frame_type","exposure.dwelling.fields"),new o("windows_type","window_glass_type","exposure.dwelling.fields"),new o("replacement_cost","full_replacement_value","policy.fields",parseInt),new o("street_address","address","policy.fields"),new o("state","state","policy.fields"),new o("is_rental","is_rental","policy.fields"),new o("pool_type","swimming_pool_type","policy.fields"),new o("has_home_business","home_business","policy.fields"),new o("occupation","occupation","policy.fields"),new o("water_shutoff","water_shutoff_system","policy.fields"),new o("waterflow_alarm","waterflow_alarm","policy.fields"),new o("city","city","policy.fields"),new o("electrical_updated_year","electrical_last_updated","policy.fields"),new o("coverage_b","coverage_b","policy.fields",parseInt),new o("coverage_c","coverage_c","policy.fields",parseInt),new o("coverage_a","coverage_a","policy.fields",parseInt),new o("retrofitted","retrofit_1997","policy.fields"),new o("roof_replacement_year","roof_replaced_year","policy.fields"),new o("seismic_shutoff","seismic_shutoff","policy.fields"),new o("coverage_f","coverage_f","policy.fields"),new o("first_street_score","first_street_wf_score","policy.fields",parseInt),new o("degree_of_slope","degrees_of_slope","policy.fields"),new o("number_of_bankrupcies","bankruptcies_judgements_liens","policy.fields"),new o("coverage_d","coverage_d","policy.fields",parseInt),new o("coverage_e","coverage_e","policy.fields"),new o("gre_wf_score","gre_wf_score","policy.fields",parseFloat),new o("state","state","policy.fields"),new o("has_steel_braided_hoses","steel_braided_hoses","policy.fields"),new o("core_logic_wf_score","core_logic_score","policy.fields",parseInt),new o(void 0,"channel","policy.fields",(e=>{}),(e=>"Broker")),new o(void 0,"coverageForm","policy.fields",(e=>{}),(e=>"HO-5 Comprehensive")),new o("zip","zip","policy.fields"),new o("has_underground_fuel_tank","underground_fuel_tank","policy.fields"),new o("residence_type","dwelling_use_type","policy.fields"),new o("attractive_nuisance","has_attractive_nuisance","policy.fields"),new o("zesty_l2","zesty_l2","policy.fields",parseInt),new o("zesty_l1","zesty_l1","policy.fields",parseInt),new o("water_heater_update_year","water_heaters_last_updated","policy.fields"),new o("plumbing_updated_year","plumbing_last_updated","policy.fields"),new o("home_heating_update_year","home_heater_last_updated","policy.fields",void 0,(e=>""===e?null:e)),new o("insured_dob","date_of_birth","policy.fields"),new o("gre_arf","arf","policy.fields",parseFloat),new o("insured_dob","date_of_birth","policy.fields"),new o("flood_score","first_street_flood_score","policy.fields"),new o("home_heating_source","heating_source","policy.fields"),new o("horses","has_horses","policy.fields"),new o("metal_fittings_toilet_supply_line","metal_fittings","policy.fields"),new o("is_under_renovation","renovation","policy.fields"),new o("pool_type","swimming_pool_type","policy.fields"),new o("residence_type","dwelling_use_type","policy.fields"),new o("previous_insurance_company","pastCarrier","policy.fields"),new o("previous_policy_expiration_date","prevPolicyExpiration","policy.fields"),new o("previous_premium","prevPolicyPremium","policy.fields",void 0,parseInt),new o("fireshed_ID","fireshed_id","policy.fields"),new o("fireshed_code","fireshed_code","policy.fields"),new o("fireshed_capacity","fireshed_capacity","policy.fields",parseFloat),new o("county","county","policy.fields"),new o("ensemble_mean","wf_score_mean","policy.fields",parseFloat),new o("ensemble_variance","wf_score_variance","policy.fields",parseFloat),new o("wildfire_category","wf_score_category","policy.fields"),new o("has_additional_insured","has_co_applicant","policy.fields"),new o("months_unoccupied","months_unoccupied","policy.fields",(e=>null==e?"0":e)),new o("multifamily_unit_count","multi_family_unit_count","policy.fields",void 0,parseInt),new o("spouse_first_name","has_co_applicant","policy.fields",(e=>null),(e=>e?"Yes":"No")),new o("spouse_first_name","co_applicant_first_name","policy.fields"),new o("spouse_last_name","co_applicant_last_name","policy.fields"),new o("spouse_email","co_applicant_email","policy.fields"),new o("spouse_phone_number","co_applicant_phone_number","policy.fields"),new o("number_of_mortgages","num_mortgages","policy.fields"),new o("past_liens","bankruptcies_judgements_liens","policy.fields"),new o("property_id","retool_property_id","policy.fields"),new o("primary_dwelling_insured","primary_insured_by_stand","policy.fields",(e=>e||"Yes")),new o("lat","latitude","policy.fields",parseFloat),new o("lng","longitude","policy.fields",parseFloat),new o("count_of_solar_panels","has_solar_panels","exposure.dwelling.fields",...function(){let e={0:"No","1+":"Yes"},t={No:0,Yes:"1+"};return[e=>t[e],t=>e[t]]}()),new o("producer_license_number","producer_license_number","policy.fields"),new o("producer_id","producerId","policy.fields"),new o("producer_email","producerEmail","policy.fields"),new o("producer_name","producerName","policy.fields"),new o("producer_ascend_id","producer_ascend_id","policy.fields"),new o("producer_license_number","producer_license_number","policy.fields"),new o("producer_phone_number","producer_phone_number","policy.fields"),new o("producer_state","producer_state","policy.fields"),new o("producer_commission","commissionRate","policy.fields"),new o("producer_zip","producer_zip","policy.fields"),new o("producer_city","producer_city","policy.fields"),new o("producer_street_address","producer_street_address","policy.fields"),new o("producer_street_address2","producer_street_address_2","policy.fields"),new o("broker_license_number","distributor_license_number","policy.fields"),new o("broker_name","distributor_name","policy.fields"),new o("premium_calculated","indicated_policy_cost","policy.fields"),new o("withdrawal_reasons","withdrawal_reason","policy.fields.array"),new o("rejection_reasons","declination_reason","policy.fields.array"),new o("competing_carrier","competing_carrier","policy.fields"),new o("competing_pricing","competing_pricing","policy.fields"),new o("stand_second_approval","stand_second_approval","policy.fields"),new o("fronting_carrier_approval","fronting_carrier_approval","policy.fields"),new o("reinsurance_carrier_approved","reinsurance_carrier_approved","policy.fields"),new o("reinsurance_rate","reinsurance_rate","policy.fields"),new o("is_agreed_value","is_agreed_value","policy.fields"),new o("is_difference_in_condition","is_difference_in_condition","policy.fields"),new o("lead_source","lead_source","policy.fields",(e=>null)),new o("start_date","startTimestamp","effective_date"),new o("payment_schedule","paymentScheduleName","payment_schedule")];e.exports={policy_holder_payload:function(e){let t=[],i=["owner_first_name","owner_last_name","owner_email"];for(const o of i)e[o]||t.push(o);return 0==t.length?{status:"success",error_message:"",payload:{completed:!0,values:r({first_name:e.owner_first_name,last_name:e.owner_last_name,email:e.owner_email,phone_number:e.owner_phone_number,mailing_street_address:e.mailing_street_address,mailing_street_address_2:e.mailing_street_address2,mailing_city:e.mailing_city,mailing_state:e.mailing_state,mailing_zip:e.mailing_zip,ofac_date:e.ofac_date_pulled,ofac_reason:e.ofac_reason,ofac_outcome:e.ofac_outcome},!0,!0,!1)}}:{payload:{},status:"error",error_message:`must include the following fields [${t}]`}},new_policy_payload:function(e,t){let i=o.socotra_create_policy_template(t);return a.forEach((t=>{t.socotra_create_response(e,i)})),{payload:r(i,!0,!0,!0),error_message:"",status:"success"}},quote_to_retool_payload:n,retool_to_quote_updated:function(e,t){let i=n(t).payload;Object.keys(e).forEach((t=>{if(Array.isArray(e[t])){let o=e[t],n=i[t];JSON.stringify(o)===JSON.stringify(n)&&delete e[t]}else i[t]===e[t]&&delete e[t]}));let s=t.exposures.find((e=>"dwelling"===e.name)).locator,l=o.socotra_create_update_template(s);return a.forEach((t=>{Object.keys(e).includes(t.retool_id)&&t.socotra_update(e,l)})),l=r(l,!0,!0,!1),0===Object.keys(l.updateExposures[0].fieldValues).length&&delete l.updateExposures,0===Object.keys(l.fieldValues).length&&delete l.fieldValues,{payload:l,error_message:"",status:"success"}}}}},t={},function i(o){var n=t[o];if(void 0!==n)return n.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,i),r.exports}(44);var e,t}));
1
+ !function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.stand_underwriter=i():e.stand_underwriter=i()}(this,(()=>{return e={10:e=>{e.exports={is_vacant:function(e){return"No"===e?{decision:"accept",note:null}:"Yes"===e?{decision:"reject",note:"Home is vacant"}:{decision:"reject",note:"Vacant must be yes or no"}},under_renovation:function(e){return"No"===e?{decision:"accept",note:null}:"Yes"===e?{decision:"reject",note:"Home is under renovation"}:{decision:"reject",note:"Under renovation must be yes or no"}},plumbing_last_update_year:function(e){return Number.isInteger(e)?e<1600||e>3e3?{decision:"reject",note:"Plumbing input should be the year it was last updated not the age"}:(year_threshold=(new Date).getFullYear()-30,e>=year_threshold?{decision:"accept",note:null}:{decision:"reject",note:"Plumbing must have been updated in the last 30 years"}):{decision:"reject",note:"Plumbing year must be an integer"}},water_heater_last_update_year:function(e){return Number.isInteger(e)?e<1600||e>3e3?{decision:"reject",note:"Water heater input should be the year it was last updated not the age"}:(year_threshold=(new Date).getFullYear()-10,e>=year_threshold?{decision:"accept",note:null}:{decision:"reject",note:"Water heater must have been updated in the last 10 years"}):{decision:"reject",note:"Water heater year must be an integer"}},electrical_last_update_year:function(e){return Number.isInteger(e)?e<1600||e>3e3?{decision:"reject",note:"Electrical input should be the year it was last updated not the age"}:(year_threshold=(new Date).getFullYear()-30,e>=year_threshold?{decision:"accept",note:null}:{decision:"reject",note:"Electrical must have been updated in the last 30 years"}):{decision:"reject",note:"Electrical year must be an integer"}},home_heating_last_update_year:function(e){return Number.isInteger(e)?e<1600||e>3e3?{decision:"reject",note:"Home heating input should be the year it was last updated not the age"}:(year_threshold=(new Date).getFullYear()-30,e>=year_threshold?{decision:"accept",note:null}:{decision:"reject",note:"Home heating must have been updated in the last 30 years"}):{decision:"reject",note:"Home heating year must be an integer"}},heating_source:function(e){return heating_type_enum=["central gas heat","thermostatically controlled electrical heat","wood","coal","pellet stove"],"string"!=typeof e?{decision:"reject",note:"Home heating year must be a string"}:heating_type_enum.includes(e)?["wood","coal","pellet stove"].includes(e)?{decision:"refer",note:null}:{decision:"accept",note:null}:{decision:"reject",note:"Heat source must be in [central gas heat, thermostatically controlled electrical heat, wood, coal, pellet stove]"}},has_underground_fuel_tank:function(e){return"No"===e?{decision:"accept",note:null}:"Yes"===e?{decision:"reject",note:"Home has underground fuel tank"}:{decision:"reject",note:"Underground fuel tank must be yes or no"}},has_steel_braided_hose:function(e){return"Yes"===e?{decision:"accept",note:null}:"No"===e?{decision:"refer",note:null}:{decision:"reject",note:"Steel braided hose must be yes or no"}},has_water_shutoff:function(e){return"Yes"===e?{decision:"accept",note:null}:"No"===e?{decision:"refer",note:null}:{decision:"reject",note:"Water shutoff must be yes or no"}},has_circuit_breaker:function(e,i){return"No"===e||i>=1980?{decision:"accept",note:null}:"Yes"===e?{decision:"reject",note:"Home built before 1980 cannot have circuit breakers"}:{decision:"reject",note:"Circuit breaker must be yes or no"}}}},44:(e,i,t)=>{const{underwrite:o,knockout_names:n}=t(273),{SocotraPayloadConverter:r}=t(991),{entries_v1:s}=t(401),{entries_v2:l}=t(540),a={1:new r(s),2:new r(l)};e.exports={underwrite:o,knockout_names:n,transformer_hash:a}},66:e=>{e.exports={multi_family_unit_count:function(e){return Number.isInteger(e)?e>2?{decision:"reject",note:"We only allow homes with two units or less."}:e<=0?{decision:"reject",note:"Number of units must be greater than 0"}:{decision:"accept",note:null}:{decision:"reject",note:"Number of units must be an integer"}},primary_dwelling_is_insured:function(e){return"No"==e?{decision:"refer",note:null}:"Yes"==e?{decision:"accept",note:null}:{decision:"reject",note:"Primary dwelling insured value must be in ['yes', 'no']"}},full_replacement_value:function(e){return Number.isInteger(e)?e>6e6?{decision:"refer",note:null}:e<2e6?{decision:"reject",note:"We only insure homes greater than $1M"}:{decision:"accept",note:null}:{decision:"reject",note:"Full replacement value must be an integer"}},prior_carrier:function(e){return""===e?{decision:"refer",note:null}:"string"==typeof e?{decision:"accept",note:null}:{decision:"reject",note:"Prior Carrier Must be a string"}},occupation:function(e){return"string"!=typeof e?{decision:"reject",note:"Occupation must be a string"}:["Professional Athlete","Entertainer","Journalist"," Politician"].includes(e)?{decision:"refer",note:null}:{decision:"accept",note:null}}}},78:(e,i,t)=>{const{multi_family_unit_count:o,primary_dwelling_is_insured:n,full_replacement_value:r,prior_carrier:s,occupation:l}=t(66),{wf_variance:a,stand_wf_knockout:c}=t(575),{distance_to_coast:d,pool_features:_,farming_type:u,has_attractive_nuisance:p,degree_of_slope:f,flood_score:m}=t(752),{number_of_dogs:y,dog_history:w,dog_breeds:g,exotic_pets:h,number_of_mortgages:b,number_of_bankruptcies_judgements_or_liens:v,home_business_type:x,home_rental_type:j,same_address:k}=t(729),{is_vacant:N,under_renovation:F,plumbing_last_update_year:S,water_heater_last_update_year:I,electrical_last_update_year:Y,home_heating_last_update_year:V,heating_source:C,has_underground_fuel_tank:E,has_steel_braided_hose:A,has_water_shutoff:D,has_circuit_breaker:q}=t(10),{construction_type:H,siding_material:P,protection_class:O,roof_material:z,foundation_type:G,has_slab_foundation_plumbing:T,fire_protective_devices:M,theft_protective_devices:$,has_class_a_roof:W}=t(479),{check_claims_history:B}=t(529),L={multi_family_unit_count:o,primary_dwelling_insured:n,full_replacement_value:r,prior_carrier:s,wf_variance:a,flood_score:m,distance_to_coast:d,pool_features:_,number_of_dogs:y,dog_history:w,dog_breeds:g,exotic_pets:h,farming_type:u,number_of_mortgages:b,number_of_bankruptcies_judgements_or_liens:v,is_vacant:N,under_renovation:F,plumbing_last_update_year:S,water_heater_last_update_year:I,electrical_last_update_year:Y,home_heating_last_update_year:V,heating_source:C,has_underground_fuel_tank:E,has_steel_braided_hose:A,has_water_shutoff:D,home_business_type:x,has_attractive_nuisance:p,home_rental_type:j,degree_of_slope:f,construction_type:H,siding_material:P,protection_class:O,roof_material:z,foundation_type:G,has_slab_foundation_plumbing:T,fire_protective_devices:M,theft_protective_devices:$,occupation:l};e.exports={knockout:function(e,i){return L.hasOwnProperty(e)?L[e](i):{decision:"question_not_found",note:null}},has_circuit_breaker:q,same_address:k,knockout_names:function(){return Object.keys(L)},stand_wf_knockout:c,has_class_a_roof:W,check_claims_history:B}},273:(e,i,t)=>{const{knockout:o,knockout_names:n,same_address:r,stand_wf_knockout:s,has_circuit_breaker:l,has_class_a_roof:a,check_claims_history:c}=t(78);function d(e){let i=[];for(let t in e)"refer"===e[t]&&i.push(t);return i}function _(e){for(let i in e)if("reject"===e[i])return"reject";for(let i in e)if("refer"===e[i])return"refer";return"accept"}function u(e,i,t,o,n={}){o[i]=e.decision,n[i]=e.note,e.note&&t.push(e.note)}e.exports={underwrite:function(e,i=!0){let t,p={},f=[],m={};for(let t of n())(i||Object.keys(e).includes(t))&&u(o(t,e[t]),t,f,p,m);return(i||"address"in e&&"co_applicant_address"in e)&&u(r(e.address,e.co_applicant_address),"co_applicant_address",f,p,m),(i||"wf_score_mean"in e&&"arf"in e)&&(t=s(e.wf_score_mean,e.arf),u(t.underwriter_result,"wf_score_mean",f,p,m)),(i||"circuit_breaker"in e&&"year_built"in e)&&u(l(e.circuit_breaker,e.year_built),"circuit_breaker",f,p,m),(i||"class_a_roof"in e)&&u(a(e.class_a_roof,t.category),"roof_rating",f,p,m),(i||"claims"in e)&&u(c(e.claims),"claims",f,p,m),{decision:_(p),notes:f,refers:d(p),all_decisions:p,notes_dict:m}},knockout_names:n}},401:(e,i,t)=>{const{SocotraEntry:o}=t(630);entries_v1=[new o("quote_name","quote_name","quote.name"),new o("socotra_config_version","config_version","quote.version"),new o("fire_deductible","wf_deductible","exposure.dwelling.fields",parseFloat),new o("other_deductible","aop_deductible","exposure.dwelling.fields",parseInt),new o("water_deductible","water_deductible","exposure.dwelling.fields",parseInt),new o("square_feet","square_feet","exposure.dwelling.fields",void 0,parseInt),new o("stand_protect_discount","stand_protect_discount","exposure.dwelling.fields"),new o("multi_policy_discount","multi_policy_discount","exposure.dwelling.fields"),new o(void 0,"has_any_claim_history","exposure.dwelling.fields",(e=>{}),(e=>"No")),new o("roof_rating","roof_rating","exposure.dwelling.fields"),new o("slab_plumbing","slab_plumbing","exposure.dwelling.fields"),new o("foundation_type","foundation_type","exposure.dwelling.fields"),new o("siding_material","siding_material","exposure.dwelling.fields"),new o("distance_to_fire_department","dist_to_fire_department","exposure.dwelling.fields"),new o("protection_class","protection_class","exposure.dwelling.fields"),new o("purchase_year","property_purchase_year","exposure.dwelling.fields",void 0,parseInt),new o("roof_material","roof_material","exposure.dwelling.fields"),new o("presence_of_fence","fence","exposure.dwelling.fields"),new o("year_built","year_built","exposure.dwelling.fields"),new o("construction_type","construction_type","exposure.dwelling.fields"),new o("water_damage_limit","water_damage_limit","exposure.dwelling.fields"),new o("extended_dwelling_coverage","extended_dwelling_coverage","exposure.dwelling.fields"),new o("sprinkler","sprinkler","exposure.dwelling.fields"),new o("smoke","smoke","exposure.dwelling.fields"),new o("fire_alarm","fire_alarm_type","exposure.dwelling.fields"),new o("fire_ext","fire_ext","exposure.dwelling.fields"),new o("deadbolt","dead_bolt","exposure.dwelling.fields"),new o(void 0,"24_hour_security_guard","exposure.dwelling.fields",(e=>{}),(e=>"No")),new o("theft_alarm","theft_alarm_type","exposure.dwelling.fields"),new o("distance_to_neighboring_home","distance_to_nearest_home_ft","exposure.dwelling.fields"),new o("chimney_spark_arrestors","chimney_mesh_cover","exposure.dwelling.fields"),new o("ember_resistant_vents","ember_vents","exposure.dwelling.fields"),new o("enclosed_eaves","enclosed_eaves","exposure.dwelling.fields"),new o("fuel_tank_distance","propane_tank_proximity","exposure.dwelling.fields"),new o("ground_clearance","exterior_clearance","exposure.dwelling.fields"),new o("windows_frame_type","window_frame_type","exposure.dwelling.fields"),new o("windows_type","window_glass_type","exposure.dwelling.fields"),new o("replacement_cost","full_replacement_value","policy.fields",parseInt),new o("street_address","address","policy.fields"),new o("state","state","policy.fields"),new o("is_rental","is_rental","policy.fields"),new o("pool_type","swimming_pool_type","policy.fields"),new o("has_home_business","home_business","policy.fields"),new o("occupation","occupation","policy.fields"),new o("water_shutoff","water_shutoff_system","policy.fields"),new o("waterflow_alarm","waterflow_alarm","policy.fields"),new o("city","city","policy.fields"),new o("electrical_updated_year","electrical_last_updated","policy.fields"),new o("coverage_b","coverage_b","policy.fields",parseInt),new o("coverage_c","coverage_c","policy.fields",parseInt),new o("coverage_a","coverage_a","policy.fields",parseInt),new o("retrofitted","retrofit_1997","policy.fields"),new o("roof_replacement_year","roof_replaced_year","policy.fields"),new o("seismic_shutoff","seismic_shutoff","policy.fields"),new o("coverage_f","coverage_f","policy.fields"),new o("first_street_score","first_street_wf_score","policy.fields",parseInt),new o("degree_of_slope","degrees_of_slope","policy.fields"),new o("number_of_bankrupcies","bankruptcies_judgements_liens","policy.fields"),new o("coverage_d","coverage_d","policy.fields",parseInt),new o("coverage_e","coverage_e","policy.fields"),new o("gre_wf_score","gre_wf_score","policy.fields",parseFloat),new o("state","state","policy.fields"),new o("has_steel_braided_hoses","steel_braided_hoses","policy.fields"),new o("core_logic_wf_score","core_logic_score","policy.fields",parseInt),new o(void 0,"channel","policy.fields",(e=>{}),(e=>"Broker")),new o(void 0,"coverageForm","policy.fields",(e=>{}),(e=>"HO-5 Comprehensive")),new o("zip","zip","policy.fields"),new o("has_underground_fuel_tank","underground_fuel_tank","policy.fields"),new o("residence_type","dwelling_use_type","policy.fields"),new o("attractive_nuisance","has_attractive_nuisance","policy.fields"),new o("zesty_l2","zesty_l2","policy.fields",parseInt),new o("zesty_l1","zesty_l1","policy.fields",parseInt),new o("water_heater_update_year","water_heaters_last_updated","policy.fields"),new o("plumbing_updated_year","plumbing_last_updated","policy.fields"),new o("home_heating_update_year","home_heater_last_updated","policy.fields",void 0,(e=>""===e?null:e)),new o("insured_dob","date_of_birth","policy.fields"),new o("gre_arf","arf","policy.fields",parseFloat),new o("insured_dob","date_of_birth","policy.fields"),new o("flood_score","first_street_flood_score","policy.fields"),new o("home_heating_source","heating_source","policy.fields"),new o("horses","has_horses","policy.fields"),new o("metal_fittings_toilet_supply_line","metal_fittings","policy.fields"),new o("is_under_renovation","renovation","policy.fields"),new o("pool_type","swimming_pool_type","policy.fields"),new o("residence_type","dwelling_use_type","policy.fields"),new o("previous_insurance_company","pastCarrier","policy.fields"),new o("previous_policy_expiration_date","prevPolicyExpiration","policy.fields"),new o("previous_premium","prevPolicyPremium","policy.fields",void 0,parseInt),new o("fireshed_ID","fireshed_id","policy.fields"),new o("fireshed_code","fireshed_code","policy.fields"),new o("fireshed_capacity","fireshed_capacity","policy.fields",parseFloat),new o("county","county","policy.fields"),new o("ensemble_mean","wf_score_mean","policy.fields",parseFloat),new o("ensemble_variance","wf_score_variance","policy.fields",parseFloat),new o("wildfire_category","wf_score_category","policy.fields"),new o("has_additional_insured","has_co_applicant","policy.fields"),new o("months_unoccupied","months_unoccupied","policy.fields",(e=>null==e?"0":e)),new o("multifamily_unit_count","multi_family_unit_count","policy.fields",void 0,parseInt),new o("spouse_first_name","has_co_applicant","policy.fields",(e=>null),(e=>e?"Yes":"No")),new o("spouse_first_name","co_applicant_first_name","policy.fields"),new o("spouse_last_name","co_applicant_last_name","policy.fields"),new o("spouse_email","co_applicant_email","policy.fields"),new o("spouse_phone_number","co_applicant_phone_number","policy.fields"),new o("number_of_mortgages","num_mortgages","policy.fields"),new o("past_liens","bankruptcies_judgements_liens","policy.fields"),new o("property_id","retool_property_id","policy.fields"),new o("primary_dwelling_insured","primary_insured_by_stand","policy.fields",(e=>e||"Yes")),new o("lat","latitude","policy.fields",parseFloat),new o("lng","longitude","policy.fields",parseFloat),new o("count_of_solar_panels","has_solar_panels","exposure.dwelling.fields",...function(){let e={0:"No","1+":"Yes"},i={No:0,Yes:"1+"};return[e=>i[e],i=>e[i]]}()),new o("producer_license_number","producer_license_number","policy.fields"),new o("producer_id","producerId","policy.fields"),new o("producer_email","producerEmail","policy.fields"),new o("producer_name","producerName","policy.fields"),new o("producer_ascend_id","producer_ascend_id","policy.fields"),new o("producer_license_number","producer_license_number","policy.fields"),new o("producer_phone_number","producer_phone_number","policy.fields"),new o("producer_state","producer_state","policy.fields"),new o("producer_commission","commissionRate","policy.fields"),new o("producer_zip","producer_zip","policy.fields"),new o("producer_city","producer_city","policy.fields"),new o("producer_street_address","producer_street_address","policy.fields"),new o("producer_street_address2","producer_street_address_2","policy.fields"),new o("broker_license_number","distributor_license_number","policy.fields"),new o("broker_name","distributor_name","policy.fields"),new o("premium_calculated","indicated_policy_cost","policy.fields"),new o("withdrawal_reasons","withdrawal_reason","policy.fields.array"),new o("rejection_reasons","declination_reason","policy.fields.array"),new o("competing_carrier","competing_carrier","policy.fields"),new o("competing_pricing","competing_pricing","policy.fields"),new o("stand_second_approval","stand_second_approval","policy.fields"),new o("fronting_carrier_approval","fronting_carrier_approval","policy.fields"),new o("reinsurance_carrier_approved","reinsurance_carrier_approved","policy.fields"),new o("reinsurance_rate","reinsurance_rate","policy.fields"),new o("start_date","startTimestamp","effective_date"),new o("payment_schedule","paymentScheduleName","payment_schedule")],e.exports={entries_v1}},479:e=>{e.exports={construction_type:function(e){return"string"!=typeof e?{decision:"reject",note:"Construction type must be a string"}:["Concrete","Frame","Log","Masonry","Mobile / Manufactured","Steel","Modular"].includes(e)?["Concrete","Frame","Masonry","Steel"].includes(e)?{decision:"accept",note:null}:{decision:"reject",note:"Construction type not supported"}:{decision:"reject",note:"Construction type must be one of [Concrete, Frame, Log, Masonry, Mobile / Manufactured, Steel, Modular]"}},siding_material:function(e){return"string"!=typeof e?{decision:"reject",note:"Siding material must be a string"}:["Adobe","Aluminum / Steel","Asbestos","Brick / Masonry Veneer","Brick / Stone - Solid","Cement Fiber","Clapboard","Exterior Insulation Finishing System (EIFS)","Log","Stone Veneer","Stucco","Vinyl","Wood","Other - above descriptions do not apply"].includes(e)?["Log","Asbestos","Exterior Insulation Finishing System (EIFS)"].includes(e)?{decision:"reject",note:"Siding material not supported"}:"Wood"!==e?{decision:"accept",note:null}:void 0:{decision:"reject",note:"Siding material must be one of [Adobe, Aluminum / Steel, Asbestos, Brick / Masonry Veneer, Brick / Stone - Solid, Cement Fiber, Clapboard, Exterior Insulation Finishing System (EIFS), Log, Stone Veneer, Stucco, Vinyl, Wood, Other - above descriptions do not apply]"}},protection_class:function(e){let i=["1","2","3","4","5","6","7","8","8B","1Y","2Y","3Y","4Y","5Y","6Y","7Y","8Y","9","1X","2X","3X","4X","5X","6X","7X","8X","9","10","10W"];return"string"!=typeof e?{decision:"reject",note:"Protection class must be a string"}:i.includes(e)?["9","10"].includes(e)?{decision:"reject",note:"Protection class not supported"}:{decision:"accept",note:null}:{decision:"reject",note:`Protection class must be one of ${i}`}},roof_material:function(e){let i=["Architecture Shingles","Asphalt Fiberglass Composite","Clay-Tile-Slate","Concrete Tile","Corrugated Steel - Metal","Flat Foam Composite"," Flat Membrane","Flat Tar Gravel","Other","Wood Shake","Wood Shingle"];return"string"!=typeof e?{decision:"reject",note:"Roof material must be a string"}:i.includes(e)?["Wood Shake","Wood Shingle"].includes(e)?{decision:"reject",note:"Roof material not supported"}:{decision:"accept",note:null}:{decision:"reject",note:`Roof material must be one of ${i}`}},has_class_a_roof:function(e,i){return"string"!=typeof e?{decision:"reject",note:"Has class a roof must be a string"}:["Yes","No"].includes(e)?"Yes"===e||["A","B"].includes(i)?{decision:"accept",note:null}:{decision:"reject",note:"Homes in this wildfire category must have class a roofs"}:{decision:"reject",note:"Has class a roof must be Yes or No"}},foundation_type:function(e){let i=["Basement Finished","Basement Partially Finished","Basement Unfinished","Crawlspace","Other","Piers","Pilings","Stilts","Slab"];return"string"!=typeof e?{decision:"reject",note:"Foundation type must be a string"}:i.includes(e)?"Other"==e?{decision:"refer",note:null}:["Piers","Pilings","Stilts"].includes(e)?{decision:"reject",note:"Foundation type not supported"}:{decision:"accept",note:null}:{decision:"reject",note:`Foundation type must be one of ${i}`}},has_slab_foundation_plumbing:function(e){return"string"!=typeof e?{decision:"reject",note:"Has slab foundation plumbing must be a string"}:["Yes","No"].includes(e)?"Yes"===e?{decision:"reject",note:"Homes with slab foundation plumbing are not allowed"}:{decision:"accept",note:null}:{decision:"reject",note:"Has slab foundation plumbing must be Yes or No"}},fire_protective_devices:function(e){if(!Array.isArray(e))return{decision:"reject",note:"Fire protective devices must be a list"};let i=["Local","Central","Direct","Sprinkler","Fire Ext","Smoke","No"];return e.every((e=>i.includes(e)))?e.includes("Direct")||e.includes("Central")?{decision:"accept",note:null}:{decision:"reject",note:"Insufficient fire devices"}:{decision:"reject",note:`Unrecognized fire device type. Valid devices: ${i}`}},theft_protective_devices:function(e){return Array.isArray(e)?(device_types=["Dead Bolt","Local","Central","Direct","24 Hour Security Guard","No"],e.every((e=>device_types.includes(e)))?e.includes("Central")||e.includes("Direct")||e.includes("24 Hour Security Guard")?{decision:"accept",note:null}:{decision:"reject",note:"Insufficient theft device"}:{decision:"reject",note:`Unrecognized theft device type. Valid devices: ${device_types}`}):{decision:"reject",note:"Theft protective devices must be a list"}}}},529:e=>{e.exports={check_claims_history:function(e){if(!e)return{decision:"reject",note:"For Claims use empty instead of null"};let i=new Date,t=new Date,o=new Date;t.setFullYear(i.getFullYear()-5),o.setFullYear(i.getFullYear()-3);let n=e.filter((e=>e.date>t)),r=e.filter((e=>e.date>o));return n.length>2?{decision:"reject",note:"To many claims in the past 5 years"}:r.length>1?{decision:"reject",note:"To many claims in the past 3 years"}:{decision:"accept",note:null}}}},540:(e,i,t)=>{const{SocotraEntry:o}=t(630);entries_v2=[new o("quote_name","quote_name","quote.name"),new o("socotra_config_version","config_version","quote.version"),new o("fire_deductible","wf_deductible","exposure.dwelling.fields",parseFloat),new o("other_deductible","aop_deductible","exposure.dwelling.fields",parseInt),new o("water_deductible","water_deductible","exposure.dwelling.fields",parseInt),new o("square_feet","square_feet","exposure.dwelling.fields",void 0,parseInt),new o("stand_protect_discount","stand_protect_discount","exposure.dwelling.fields"),new o("multi_policy_discount","multi_policy_discount","exposure.dwelling.fields"),new o(void 0,"has_any_claim_history","exposure.dwelling.fields",(e=>{}),(e=>"No")),new o("roof_rating","roof_rating","exposure.dwelling.fields"),new o("slab_plumbing","slab_plumbing","exposure.dwelling.fields"),new o("foundation_type","foundation_type","exposure.dwelling.fields"),new o("siding_material","siding_material","exposure.dwelling.fields"),new o("distance_to_fire_department","dist_to_fire_department","exposure.dwelling.fields"),new o("protection_class","protection_class","exposure.dwelling.fields"),new o("purchase_year","property_purchase_year","exposure.dwelling.fields",void 0,parseInt),new o("roof_material","roof_material","exposure.dwelling.fields"),new o("presence_of_fence","fence","exposure.dwelling.fields"),new o("year_built","year_built","exposure.dwelling.fields"),new o("construction_type","construction_type","exposure.dwelling.fields"),new o("water_damage_limit","water_damage_limit","exposure.dwelling.fields"),new o("extended_dwelling_coverage","extended_dwelling_coverage","exposure.dwelling.fields"),new o("sprinkler","sprinkler","exposure.dwelling.fields"),new o("smoke","smoke","exposure.dwelling.fields"),new o("fire_alarm","fire_alarm_type","exposure.dwelling.fields"),new o("fire_ext","fire_ext","exposure.dwelling.fields"),new o("deadbolt","dead_bolt","exposure.dwelling.fields"),new o(void 0,"24_hour_security_guard","exposure.dwelling.fields",(e=>{}),(e=>"No")),new o("theft_alarm","theft_alarm_type","exposure.dwelling.fields"),new o("distance_to_neighboring_home","distance_to_nearest_home_ft","exposure.dwelling.fields"),new o("chimney_spark_arrestors","chimney_mesh_cover","exposure.dwelling.fields"),new o("ember_resistant_vents","ember_vents","exposure.dwelling.fields"),new o("enclosed_eaves","enclosed_eaves","exposure.dwelling.fields"),new o("fuel_tank_distance","propane_tank_proximity","exposure.dwelling.fields"),new o("ground_clearance","exterior_clearance","exposure.dwelling.fields"),new o("windows_frame_type","window_frame_type","exposure.dwelling.fields"),new o("windows_type","window_glass_type","exposure.dwelling.fields"),new o("replacement_cost","full_replacement_value","policy.fields",parseInt),new o("street_address","address","policy.fields"),new o("state","state","policy.fields"),new o("is_rental","is_rental","policy.fields"),new o("pool_type","swimming_pool_type","policy.fields"),new o("has_home_business","home_business","policy.fields"),new o("occupation","occupation","policy.fields"),new o("water_shutoff","water_shutoff_system","policy.fields"),new o("waterflow_alarm","waterflow_alarm","policy.fields"),new o("city","city","policy.fields"),new o("electrical_updated_year","electrical_last_updated","policy.fields"),new o("coverage_b","coverage_b","policy.fields",parseInt),new o("coverage_c","coverage_c","policy.fields",parseInt),new o("coverage_a","coverage_a","policy.fields",parseInt),new o("retrofitted","retrofit_1997","policy.fields"),new o("roof_replacement_year","roof_replaced_year","policy.fields"),new o("seismic_shutoff","seismic_shutoff","policy.fields"),new o("coverage_f","coverage_f","policy.fields"),new o("first_street_score","first_street_wf_score","policy.fields",parseInt),new o("degree_of_slope","degrees_of_slope","policy.fields"),new o("number_of_bankrupcies","bankruptcies_judgements_liens","policy.fields"),new o("coverage_d","coverage_d","policy.fields",parseInt),new o("coverage_e","coverage_e","policy.fields"),new o("gre_wf_score","gre_wf_score","policy.fields",parseFloat),new o("state","state","policy.fields"),new o("has_steel_braided_hoses","steel_braided_hoses","policy.fields"),new o("core_logic_wf_score","core_logic_score","policy.fields",parseInt),new o(void 0,"channel","policy.fields",(e=>{}),(e=>"Broker")),new o(void 0,"coverageForm","policy.fields",(e=>{}),(e=>"HO-5 Comprehensive")),new o("zip","zip","policy.fields"),new o("has_underground_fuel_tank","underground_fuel_tank","policy.fields"),new o("residence_type","dwelling_use_type","policy.fields"),new o("attractive_nuisance","has_attractive_nuisance","policy.fields"),new o("zesty_l2","zesty_l2","policy.fields",parseInt),new o("zesty_l1","zesty_l1","policy.fields",parseInt),new o("water_heater_update_year","water_heaters_last_updated","policy.fields"),new o("plumbing_updated_year","plumbing_last_updated","policy.fields"),new o("home_heating_update_year","home_heater_last_updated","policy.fields",void 0,(e=>""===e?null:e)),new o("insured_dob","date_of_birth","policy.fields"),new o("gre_arf","arf","policy.fields",parseFloat),new o("insured_dob","date_of_birth","policy.fields"),new o("flood_score","first_street_flood_score","policy.fields"),new o("home_heating_source","heating_source","policy.fields"),new o("horses","has_horses","policy.fields"),new o("metal_fittings_toilet_supply_line","metal_fittings","policy.fields"),new o("is_under_renovation","renovation","policy.fields"),new o("pool_type","swimming_pool_type","policy.fields"),new o("residence_type","dwelling_use_type","policy.fields"),new o("previous_insurance_company","pastCarrier","policy.fields"),new o("previous_policy_expiration_date","prevPolicyExpiration","policy.fields"),new o("previous_premium","prevPolicyPremium","policy.fields",void 0,parseInt),new o("fireshed_ID","fireshed_id","policy.fields"),new o("fireshed_code","fireshed_code","policy.fields"),new o("fireshed_capacity","fireshed_capacity","policy.fields",parseFloat),new o("county","county","policy.fields"),new o("ensemble_mean","wf_score_mean","policy.fields",parseFloat),new o("ensemble_variance","wf_score_variance","policy.fields",parseFloat),new o("wildfire_category","wf_score_category","policy.fields"),new o("has_additional_insured","has_co_applicant","policy.fields"),new o("months_unoccupied","months_unoccupied","policy.fields",(e=>null==e?"0":e)),new o("multifamily_unit_count","multi_family_unit_count","policy.fields",void 0,parseInt),new o("spouse_first_name","has_co_applicant","policy.fields",(e=>null),(e=>e?"Yes":"No")),new o("spouse_first_name","co_applicant_first_name","policy.fields"),new o("spouse_last_name","co_applicant_last_name","policy.fields"),new o("spouse_email","co_applicant_email","policy.fields"),new o("spouse_phone_number","co_applicant_phone_number","policy.fields"),new o("number_of_mortgages","num_mortgages","policy.fields"),new o("past_liens","bankruptcies_judgements_liens","policy.fields"),new o("property_id","retool_property_id","policy.fields"),new o("primary_dwelling_insured","primary_insured_by_stand","policy.fields",(e=>e||"Yes")),new o("lat","latitude","policy.fields",parseFloat),new o("lng","longitude","policy.fields",parseFloat),new o("count_of_solar_panels","has_solar_panels","exposure.dwelling.fields",...function(){let e={0:"No","1+":"Yes"},i={No:0,Yes:"1+"};return[e=>i[e],i=>e[i]]}()),new o("producer_license_number","producer_license_number","policy.fields"),new o("producer_id","producerId","policy.fields"),new o("producer_email","producerEmail","policy.fields"),new o("producer_name","producerName","policy.fields"),new o("producer_ascend_id","producer_ascend_id","policy.fields"),new o("producer_license_number","producer_license_number","policy.fields"),new o("producer_phone_number","producer_phone_number","policy.fields"),new o("producer_state","producer_state","policy.fields"),new o("producer_commission","commissionRate","policy.fields"),new o("producer_zip","producer_zip","policy.fields"),new o("producer_city","producer_city","policy.fields"),new o("producer_street_address","producer_street_address","policy.fields"),new o("producer_street_address2","producer_street_address_2","policy.fields"),new o("broker_license_number","distributor_license_number","policy.fields"),new o("broker_name","distributor_name","policy.fields"),new o("premium_calculated","indicated_policy_cost","policy.fields"),new o("withdrawal_reasons","withdrawal_reason","policy.fields.array"),new o("rejection_reasons","declination_reason","policy.fields.array"),new o("competing_carrier","competing_carrier","policy.fields"),new o("competing_pricing","competing_pricing","policy.fields"),new o("stand_second_approval","stand_second_approval","policy.fields"),new o("fronting_carrier_approval","fronting_carrier_approval","policy.fields"),new o("reinsurance_carrier_approved","reinsurance_carrier_approved","policy.fields"),new o("reinsurance_rate","reinsurance_rate","policy.fields"),new o("is_agreed_value","is_agreed_value","policy.fields"),new o("is_difference_in_condition","is_difference_in_condition","policy.fields"),new o("lead_source","lead_source","policy.fields",(e=>null)),new o("start_date","startTimestamp","effective_date"),new o("payment_schedule","paymentScheduleName","payment_schedule")],e.exports={entries_v2}},575:e=>{e.exports={stand_wf_knockout:function(e,i){return e<0||i<0?{category:"",underwriter_result:{decision:"reject",note:"Mean and ARF must be positive numbers"}}:Number.isFinite(i)&&Number.isFinite(e)?e>=.7?{category:"D",underwriter_result:{decision:"reject",note:"Stand WF mean must be less than or equal to 0.7"}}:i>=8?{category:"C",underwriter_result:{decision:"refer",note:null}}:i>=5||e>=.2?{category:"C",underwriter_result:{decision:"accept",note:null}}:e>=.1?{category:"B",underwriter_result:{decision:"accept",note:null}}:{category:"A",underwriter_result:{decision:"accept",note:null}}:{category:"",underwriter_result:{decision:"reject",note:"ARF must be a number"}}},wf_variance:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Variance must be a positive number."}:e<=.09?{decision:"accept",note:null}:{decision:"refer",note:null}:{decision:"reject",note:"Variance must be a number."}}}},630:e=>{const i=Object.freeze(["policy.fields","policy.fields.array","exposure.dwelling.fields","policy.group","policy","exposure.dwelling.group","quote.name","effective_date","payment_schedule","quote.version"]);e.exports={SocotraEntry:class{constructor(e,t,o,n=e=>e,r=e=>e){if(!i.includes(o))throw new Error(`Unsupported Socotra Location: ${o}`);this.retool_id=e,this.socotra_id=t,this.socotra_location=o,this.to_scotra_func=r,this.to_retool_func=n}socotra_create_response(e,i){let t=this.to_scotra_func(e[this.retool_id]);if(this.socotra_location.includes("policy.fields"))i.fieldValues[this.socotra_id]=t;else if("exposure.dwelling.fields"===this.socotra_location)i.exposures[0].fieldValues[this.socotra_id]=t;else if("quote.name"===this.socotra_location);else if("effective_date"===this.socotra_location){const e=new Date(`${t}T00:00:00-08:00`),o=e.getTime();i.policyStartTimestamp=o;const n=new Date(e);n.setFullYear(e.getFullYear()+1),i.policyEndTimestamp=n.getTime()}else if("payment_schedule"===this.socotra_location)["upfront","quarterly"].includes(t)&&(i.paymentScheduleName=t);else{if("quote.version"!==this.socotra_location)throw new Error(`Location Not implemented: ${JSON.stringify(this)}`);i.configVersion=t}}retool_response(e,i){let t,o;if(this.socotra_location.includes("policy.fields"))t=e.characteristics.fieldValues[this.socotra_id];else{if("exposure.dwelling.fields"!==this.socotra_location){if("quote.name"===this.socotra_location)return void(i[this.retool_id]=e.name);if("effective_date"===this.socotra_location){let t=parseInt(e.characteristics[this.socotra_id])/1e3;var n=new Date(0);return n.setUTCSeconds(t),void(i[this.retool_id]=`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`)}if("payment_schedule"===this.socotra_location)return void(i[this.retool_id]=e[this.socotra_id]);if("quote.version"==this.socotra_location)return;throw new Error(`Location Not implemented: ${JSON.stringify(this)}`)}t=e.exposures.find((e=>"dwelling"===e.name)).characteristics.at(-1).fieldValues[this.socotra_id]}o=this.socotra_location.includes("array")?t:t?.[0]??null,o=this.to_retool_func(o),i[this.retool_id]=o}socotra_update(e,i){let t=this.to_scotra_func(e[this.retool_id]);if(this.socotra_location.includes("policy.fields"))i.fieldValues[this.socotra_id]=t;else if("exposure.dwelling.fields"===this.socotra_location)i.updateExposures[0].fieldValues[this.socotra_id]=t;else if("quote.name"===this.socotra_location)i.name=t;else if("effective_date"===this.socotra_location){const e=new Date(`${t}T00:00:00-08:00`);i.policyStartTimestamp=e.getTime();const o=new Date(e);o.setFullYear(e.getFullYear()+1),i.policyEndTimestamp=o.getTime()}else{if("payment_schedule"!==this.socotra_location){if("quote.version"===this.socotra_location)return;throw new Error(`Location Not implemented: ${JSON.stringify(this)}`)}["upfront","quarterly"].includes(t)&&(i.paymentScheduleName=t)}}static build_group(e,i){return{name:i}}static socotra_create_policy_template(e){return{policyholderLocator:e,productName:"homeowners",finalize:!1,paymentScheduleName:"upfront",exposures:[{exposureName:"dwelling",perils:[{name:"wildfire_expense",fieldValues:{},fieldGroups:[]},{name:"fire_following_earthquake",fieldValues:{},fieldGroups:[]},{name:"liability",fieldValues:{},fieldGroups:[]},{name:"other",fieldValues:{},fieldGroups:[]},{name:"theft",fieldValues:{},fieldGroups:[]},{name:"water_cat",fieldValues:{},fieldGroups:[]},{name:"water_excluding_cat",fieldValues:{},fieldGroups:[]},{name:"wildfire",fieldValues:{},fieldGroups:[]},{name:"wind_cat",fieldValues:{},fieldGroups:[]},{name:"wind_excluding_cat",fieldValues:{},fieldGroups:[]},{name:"fire",fieldValues:{},fieldGroups:[]},{name:"fac_prem",fieldValues:{},fieldGroups:[]},{name:"minimum_premium",fieldValues:{},fieldGroups:[]}],fieldValues:{},fieldGroups:[]}],fieldValues:{},fieldGroups:[],configVersion:-1}}static socotra_create_update_template(e){return{updateExposures:[{exposureLocator:e,fieldValues:{},fieldGroups:[]}],fieldValues:{}}}}}},729:e=>{e.exports={number_of_dogs:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Number of dogs must be a positive number."}:e<4?{decision:"accept",note:null}:{decision:"reject",note:"Owner has 4 or more dogs"}:{decision:"reject",note:"Number of dogs must be a number."}},dog_history:function(e){return"Yes"==e?{decision:"reject",note:"Has a dog with a history of aggressive behavior"}:"No"==e?{decision:"accept",note:null}:{decision:"reject",note:"Dog has history must be Yes or No."}},dog_breeds:function(e){return Array.isArray(e)?e.every((e=>"non-guard dog of other breeds"===e))?{decision:"accept",note:null}:{decision:"reject",note:"Dog of given breed not allowed"}:{decision:"reject",note:"Dog breed must be a list"}},exotic_pets:function(e){return"Yes"==e?{decision:"reject",note:"Has an exotic pet"}:"No"==e?{decision:"accept",note:null}:{decision:"reject",note:"Has exotic pet must be Yes or No."}},number_of_mortgages:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Number of mortgages must be a positive number."}:e<2?{decision:"accept",note:null}:{decision:"refer",note:null}:{decision:"reject",note:"Number of mortgages must be a number."}},number_of_bankruptcies_judgements_or_liens:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Number of bankruptcies, judgements, or liens must be a positive number"}:0===e?{decision:"accept",note:null}:{decision:"reject",note:"Has bankruptcies, judgements, or liens"}:{decision:"reject",note:"Number of bankruptcies, judgements, or liens must be a number"}},home_business_type:function(e){return"string"!=typeof e?{decision:"reject",note:"Home business type must be a string"}:["yes - day care","yes - other","no"].includes(e)?"no"==e?{decision:"accept",note:null}:"yes - day care"==e?{decision:"reject",note:"Cannot insure daycare"}:{decision:"refer",note:null}:{decision:"reject",note:"Home business type must be in [yes - day care, yes - other, no]"}},home_rental_type:function(e){return"string"!=typeof e?{decision:"reject",note:"Home rental type must be a string"}:["short-term rentals less than 6 months of the year","short term rentals more than 6 months of the year","timeshare","no"].includes(e)?"no"==e?{decision:"accept",note:null}:["short-term rentals less than 6 months of the year","timeshare"].includes(e)?{decision:"refer",note:null}:{decision:"reject",note:"Cannot insure rentals longer than 6 months"}:{decision:"reject",note:"Home rental type must be in [short-term rentals less than 6 months of the year, short term rentals more than 6 months of the year, timeshare, no]"}},same_address:function(e,i){return e===i?{decision:"accept",note:null}:{decision:"reject",note:"Co-Applicant must have same address as Applicant."}}}},752:e=>{e.exports={distance_to_coast:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Distance to coast must be a positive number."}:e>.19?{decision:"accept",note:null}:{decision:"refer",note:null}:{decision:"reject",note:"Distance to coast must be a number."}},pool_features:function(e){if(!Array.isArray(e))return{decision:"reject",note:"Pool features must be a list."};let i=e.includes("Inground")&&(e.includes("Electric retractable safety cover")||e.includes("Fenced with self-locking gate"));return i=i||e.includes("Above Ground")&&e.includes("Retractable/removable ladder"),e.includes("Diving Board")||e.includes("Slide")?{decision:"refer",note:null}:i?{decision:"accept",note:null}:{decision:"refer",note:null}},farming_type:function(e){let i=["Farming activities produce income","Incidental or hobby farming","Vineyard","None"];return"string"!=typeof e?{decision:"reject",note:"Farming type must be a string"}:i.includes(e)?"Vineyard"==e?{decision:"refer",note:null}:"Farming activities produce income"==e?{decision:"reject",note:"Cannot insure commercial farms"}:{decision:"accept",note:null}:{decision:"reject",note:`Farming type must be in [${i}]`}},has_attractive_nuisance:function(e){return"Yes"==e?{decision:"refer",note:null}:"No"==e?{decision:"accept",note:null}:{decision:"reject",note:"Has attractive nuisance must be Yes or No."}},degree_of_slope:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Degree of slope must be a positive number."}:e>30?{decision:"reject",note:"Slope greater than 30 degrees"}:{decision:"accept",note:null}:{decision:"reject",note:"Degree of slope must be a number."}},flood_score:function(e){return Number.isFinite(e)?e<0?{decision:"reject",note:"Flood score must be a positive number."}:e<9?{decision:"accept",note:null}:{decision:"reject",note:"Flood risk is too high"}:{decision:"reject",note:"Flood score must be a number."}}}},991:(e,i,t)=>{const{SocotraEntry:o}=t(630);e.exports={SocotraPayloadConverter:class{constructor(e){this.entries=e}policy_holder_payload(e){let i=[],t=["owner_first_name","owner_last_name","owner_email"];for(const o of t)e[o]||i.push(o);if(0==i.length){let i={first_name:e.owner_first_name,last_name:e.owner_last_name,email:e.owner_email,phone_number:e.owner_phone_number,mailing_street_address:e.mailing_street_address,mailing_street_address_2:e.mailing_street_address2,mailing_city:e.mailing_city,mailing_state:e.mailing_state,mailing_zip:e.mailing_zip,ofac_date:e.ofac_date_pulled,ofac_reason:e.ofac_reason,ofac_outcome:e.ofac_outcome};return{status:"success",error_message:"",payload:{completed:!0,values:this.stripNoneValues(i,!0,!0,!1)}}}return{payload:{},status:"error",error_message:`must include the following fields [${i}]`}}new_policy_payload(e,i){let t=o.socotra_create_policy_template(i);return this.entries.forEach((i=>{i.socotra_create_response(e,t)})),{payload:this.stripNoneValues(t,!0,!0,!0),error_message:"",status:"success"}}quote_to_retool_payload(e){let i={};return this.entries.forEach((t=>{t.retool_response(e,i)})),{payload:this.stripNoneValues(i,!1,!0,!1),error_message:"",status:"success"}}retool_to_quote_updated(e,i){let t=this.quote_to_retool_payload(i).payload;Object.keys(e).forEach((i=>{if(Array.isArray(e[i])){let o=e[i],n=t[i];JSON.stringify(o)===JSON.stringify(n)&&delete e[i]}else t[i]===e[i]&&delete e[i]}));let n=i.exposures.find((e=>"dwelling"===e.name)).locator,r=o.socotra_create_update_template(n);return this.entries.forEach((i=>{Object.keys(e).includes(i.retool_id)&&i.socotra_update(e,r)})),r=this.stripNoneValues(r,!0,!0,!1),0===Object.keys(r.updateExposures[0].fieldValues).length&&delete r.updateExposures,0===Object.keys(r.fieldValues).length&&delete r.fieldValues,{payload:r,error_message:"",status:"success"}}stripNoneValues(e,i,t,o){return i&&(e=this.stripNulls(e,(e=>null==e))),t&&(e=this.stripNulls(e,(e=>void 0===e))),o&&(e=this.stripNulls(e,(e=>Number.isNaN(e)))),e}stripNulls(e,i){let t=e=>this.stripNulls(e,i);return Array.isArray(e)?e.map(t).filter((e=>!i(e))):"object"==typeof e&&null!==e?Object.fromEntries(Object.entries(e).map((([e,i])=>[e,t(i)])).filter((([e,t])=>!i(t)))):e}}}}},i={},function t(o){var n=i[o];if(void 0!==n)return n.exports;var r=i[o]={exports:{}};return e[o](r,r.exports,t),r.exports}(44);var e,i}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stand_socotra_policy_transformer",
3
- "version": "2.0.0",
4
- "description": "Stands internal javscipt module for executing underwritting",
3
+ "version": "2.0.2",
4
+ "description": "Stands internal javascipt module for executing underwritting",
5
5
  "main": "dist/stand_underwriter.js",
6
6
  "scripts": {
7
7
  "test": "jest",
package/src/index.js CHANGED
@@ -1,3 +1,8 @@
1
1
  const {underwrite, knockout_names} = require('./underwriter')
2
- const {policy_holder_payload, new_policy_payload, quote_to_retool_payload, retool_to_quote_updated} = require('./retool_utils/socotra_payloads')
3
- module.exports = {underwrite, knockout_names, policy_holder_payload, new_policy_payload, quote_to_retool_payload, retool_to_quote_updated}
2
+ const {SocotraPayloadConverter} = require('./retool_utils/socotra_payloads')
3
+ const {entries_v1} = require('./retool_utils/versions/stand_v1_entries')
4
+ const {entries_v2} = require('./retool_utils/versions/stand_v2_entries')
5
+
6
+ const transformer_hash = {'1': new SocotraPayloadConverter(entries_v1), '2': new SocotraPayloadConverter(entries_v2)}
7
+
8
+ module.exports = {underwrite, knockout_names, transformer_hash}