@thryveai/theme-interfaces 2.4.12 → 2.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,205 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.migrator = void 0;
51
- var input_1 = require("./input");
52
- var fs_1 = require("fs");
53
- // @ts-ignore
54
- var migrator = function (AllBannerSettings, storeFile) {
55
- if (storeFile === void 0) { storeFile = false; }
56
- return __awaiter(void 0, void 0, void 0, function () {
57
- var NewAllBannerSettings_1, JSON_SETTINGS, location_1, e_1;
58
- return __generator(this, function (_a) {
59
- switch (_a.label) {
60
- case 0:
61
- _a.trys.push([0, 3, , 4]);
62
- NewAllBannerSettings_1 = {};
63
- Object.keys(AllBannerSettings).forEach(function (bannerName) {
64
- NewAllBannerSettings_1[bannerName] = settingsMapper(AllBannerSettings[bannerName]);
65
- });
66
- JSON_SETTINGS = JSON.stringify(NewAllBannerSettings_1);
67
- if (!storeFile) return [3 /*break*/, 2];
68
- location_1 = "./scripts/newSettings.json";
69
- return [4 /*yield*/, fs_1.promises.writeFile(location_1, JSON_SETTINGS)];
70
- case 1:
71
- _a.sent();
72
- console.log("Successfully merged settings to ".concat(location_1));
73
- return [2 /*return*/];
74
- case 2: return [2 /*return*/, JSON_SETTINGS];
75
- case 3:
76
- e_1 = _a.sent();
77
- console.error("Error mapping settings", e_1);
78
- return [2 /*return*/, "An Error Occurred"];
79
- case 4: return [2 /*return*/];
80
- }
81
- });
82
- });
83
- };
84
- exports.migrator = migrator;
85
- var settingsMapper = function (oldSettings) {
86
- return __assign(__assign({}, oldSettings), { adminPanelOnly: {
87
- bannerName: oldSettings.adminPanelOnly.bannerName,
88
- logoUrl: oldSettings.adminPanelOnly.logoUrl,
89
- }, siteSettings: {
90
- defaultCountry: oldSettings.defaultCountry,
91
- defaultShoppingMode: oldSettings.defaultShoppingMode,
92
- anonymousCart: oldSettings.siteSettings.anonymousCart,
93
- daysToRemainSignedIn: oldSettings.daysToRemainSignedIn,
94
- defaultSearchParams: oldSettings.defaultSearchParams,
95
- defaultStoreLocation: oldSettings.defaultStoreLocation,
96
- googleAutocompleteSettings: oldSettings.googleAutocompleteSettings,
97
- restrictMapPlacesResults: oldSettings.restrictMapPlacesResults,
98
- gtmId: !!oldSettings.gtmId ? oldSettings.gtmId : "",
99
- isPlanningOnly: oldSettings.isPlanningOnly,
100
- mapZoom: oldSettings.mapZoom,
101
- promoTemplateVersion: oldSettings.promoTemplateVersion,
102
- retailerCountry: oldSettings.retailerCountry,
103
- retailerName: oldSettings.retailerName,
104
- searchPreview: oldSettings.searchPreview,
105
- subHeaderHeight: oldSettings.subHeaderHeight,
106
- disableTprPrice: oldSettings.disableTprPrice,
107
- footerVersion: oldSettings.layout.footerVersion,
108
- timeslotModalSettings: oldSettings.timeslotModalSettings,
109
- ctaButtons: oldSettings.ctaButtons,
110
- mainHeaderHeight: oldSettings.mainHeaderHeight,
111
- }, features: {
112
- additionalCharges: !!oldSettings.features.additionalCharges,
113
- clientCache: !!oldSettings.features.clientCache,
114
- vouchers: oldSettings.features.vouchers,
115
- giftCards: oldSettings.features.giftCards,
116
- smartbanner: oldSettings.features.smartbanner,
117
- entryModalVersion: oldSettings.features.entryModalVersion,
118
- allowInStorePurchases: !!oldSettings.allowInStorePurchases,
119
- allowPastPurchases: !!oldSettings.allowPastPurchases,
120
- advertSettings: oldSettings.advertSettings,
121
- enableGoogleTranslate: !!oldSettings.enableGoogleTranslate,
122
- enableNewsletterSignup: !!oldSettings.enableNewsletterSignup,
123
- enableNotifications: !!oldSettings.enableNotifications,
124
- externalStoreSelectorUrl: {
125
- enabled: !!oldSettings.externalStoreSelectorUrl,
126
- url: !!oldSettings.externalStoreSelectorUrl
127
- ? oldSettings.externalStoreSelectorUrl
128
- : "",
129
- },
130
- favoritesV1: !!oldSettings.favoritesV1,
131
- flipp: oldSettings.flipp,
132
- globalAnimations: oldSettings.globalAnimations,
133
- instacart: {
134
- enabled: !!oldSettings.instacartUrl,
135
- url: !!oldSettings.instacartUrl ? oldSettings.instacartUrl : "",
136
- },
137
- registrationFields: oldSettings.registrationFields,
138
- secondTierAuthorization: oldSettings.secondTierAuthorization,
139
- showCheckoutPromoCode: !!oldSettings.showCheckoutPromoCode,
140
- showImgOnOrder: !!oldSettings.showImgOnOrder,
141
- smsNotifications: oldSettings.smsNotifications,
142
- specialRequestItems: !!oldSettings.specialRequestItems,
143
- couponGallery: oldSettings.layouts.couponGallery,
144
- }, addressSettings: {
145
- // todo need to be fixed
146
- addressValidationTypes: {
147
- addressLine1: oldSettings.addressValidationTypes.addressLine1,
148
- addressLine2: oldSettings.addressValidationTypes.addressLine2,
149
- city: oldSettings.addressValidationTypes.city,
150
- countyProvinceState: oldSettings.addressValidationTypes.countyProvinceState,
151
- familyName: oldSettings.addressValidationTypes.familyName,
152
- firstName: oldSettings.addressValidationTypes.firstName,
153
- instructions: oldSettings.addressValidationTypes.instructions,
154
- phoneNumber: oldSettings.addressValidationTypes.phoneNumber,
155
- postCode: oldSettings.addressValidationTypes.postCode,
156
- smsNumber: oldSettings.checkoutValidation.smsNumber,
157
- },
158
- eircode: {
159
- enabled: !!oldSettings.eircode,
160
- url: !!oldSettings.eircode ? oldSettings.eircode : "",
161
- },
162
- integration: {
163
- addressFinderType: oldSettings.addressIntegration.addressFinderType,
164
- enabled: oldSettings.addressIntegration.enabled,
165
- useForNewAddresses: oldSettings.addressIntegration.useForNewAddresses,
166
- addNewAddressUrl: oldSettings.addresses.integration.addNewAddressUrl,
167
- editAddressUrl: oldSettings.addresses.integration.editAddressUrl,
168
- deleteAddressUrl: oldSettings.addresses.integration.deleteAddressUrl,
169
- },
170
- useAddressValidation: oldSettings.useAddressValidation,
171
- disableAddressOnDelivery: false,
172
- }, accountPage: {
173
- loyaltyTab: {
174
- disabledEdit: !!oldSettings.accountPage.loyaltyTab.disabledEdit,
175
- enabled: !!oldSettings.accountPage.loyaltyTab.enabled,
176
- loyaltyNumberLength: oldSettings.accountPage.loyaltyTab.loyaltyNumberLength,
177
- loyaltyNumberPrefix: oldSettings.accountPage.loyaltyTab.loyaltyNumberPrefix,
178
- loyaltyValidationType: oldSettings.accountPage.loyaltyTab.loyaltyValidationType,
179
- },
180
- idp: {
181
- enabled: !!oldSettings.idpUrl,
182
- target: oldSettings.idpTarget,
183
- url: !!oldSettings.idpUrl ? oldSettings.idpUrl : "",
184
- },
185
- }, productCard: {
186
- limitProductCardTitleHeight: oldSettings.limitProductCardTitleHeight,
187
- productCardTitleHeight: oldSettings.productCardTitleHeight,
188
- productCards: oldSettings.productCards,
189
- }, checkout: {
190
- numericPhonePayload: oldSettings.checkout.numericPhonePayload,
191
- houseAccountRegExValidation: oldSettings.houseAccountRegExValidation,
192
- minimumCreditCardAmount: oldSettings.minimumCreditCardAmount,
193
- paymentCards: oldSettings.paymentCards,
194
- checkoutValidation: oldSettings.checkoutValidation,
195
- }, pdpSettings: {
196
- nutritionZone: oldSettings.nutritionZone,
197
- pdpDetailsLayout: oldSettings.pdpDetailsLayout,
198
- sodiumWarning: oldSettings.sodiumWarning,
199
- }, cartSummary: {
200
- hideTaxOnSummary: !!oldSettings.hideTaxOnSummary,
201
- showTaxTotal: !!oldSettings.layouts.cartSummary.showTaxTotal,
202
- showTaxGroups: !!oldSettings.layouts.cartSummary.showTaxGroups,
203
- } });
204
- };
205
- (0, exports.migrator)(input_1.default, true);