1'use strict';23const { isBlank } = require('./value-utils.js');45// rp-target-wix — the DETERMINISTIC WooCommerce store-settings -> Wix Site Properties builder.6// Companion to tax-build.js/shipping-build.js; implements domains/site/entities/7// business-contact.json's mappingGuidance as code.8//9// Input is the raw WooCommerce shape from GET /wc/v3/settings/general: a flat array of10// {id, label, value, ...} records. Already-fetched — per this codebase's "transform takes shaped11// input, fetching is the caller's job" convention.12//
57 const city = trimmed(map.woocommerce_store_city);
58 const { country, state } = splitDefaultCountry(map.woocommerce_default_country);
59 let zip = trimmed(map.woocommerce_store_postcode);
60
61 if (zip.length > ZIP_MAX_LENGTH) {
62 notes.push(`Source postcode "${zip}" exceeds Wix's ${ZIP_MAX_LENGTH}-character limit for zip and was dropped rather than truncated — a truncated postcode is wrong data that looks right. Set it by hand.`);
63 zip = '';
64 }
65 if (!country) {
66 notes.push('Source has no store country (woocommerce_default_country is empty) — Wix needs an ISO 3166-1 alpha-2 country code, and there is nothing to derive one from.');
67 }
68 if (!street && !city && !zip) {
69 notes.push('Source has no street, city or postcode — there is no address here to migrate.');
98// Each of these changes what a buyer can do, and none is written by this pipeline. Surfacing them
99// with the source value beside the destination's current value is what turns "we didn't migrate
100// it" from an invisible omission into a decision the merchant can make in one look.
101const REPORT_ONLY_SETTINGS = [
102 ['woocommerce_currency', 'Store currency', 'Wix prices in the site\'s payment currency; a mismatch means every price is displayed in a currency the merchant never chose.'],
103 ['woocommerce_allowed_countries', 'Which countries may buy', 'Combined with the specific-countries list below. A store that sells to one country only will otherwise become a store that sells everywhere.'],
104 ['woocommerce_specific_allowed_countries', 'Specific selling countries', 'Only meaningful when the setting above is "specific".'],
105 ['woocommerce_ship_to_countries', 'Which countries may be shipped to', 'Empty means "inherit the selling countries". Interacts with the delivery regions built from the source shipping zones.'],
106 ['woocommerce_calc_taxes', 'Tax calculation on/off', 'A source with tax calculation OFF should not arrive with tax being calculated, and vice versa.'],
107 ['woocommerce_enable_coupons', 'Coupons on/off', 'A store with coupons disabled at source should not arrive accepting them.'],
108 ['woocommerce_currency_pos', 'Currency symbol position', 'Display only.'],