-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
4,012 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
/node_modules/* | ||
dist | ||
/dist | ||
|
||
## IDE | ||
/.vscode/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import SocialTitles from '@data/demo/socialTitles'; | ||
import CustomerData from '@data/faker/customer'; | ||
|
||
export default { | ||
johnDoe: new CustomerData({ | ||
id: 2, | ||
socialTitle: SocialTitles.Mr.name, | ||
firstName: 'John', | ||
lastName: 'DOE', | ||
birthDate: new Date('1970-01-15'), | ||
email: '[email protected]', | ||
password: '123456789', | ||
enabled: true, | ||
newsletter: true, | ||
partnerOffers: true, | ||
defaultCustomerGroup: 'Customer', | ||
}), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import GroupData from '@data/faker/group'; | ||
|
||
export default { | ||
visitor: new GroupData({ | ||
id: 1, | ||
name: 'Visitor', | ||
discount: 0, | ||
shownPrices: true, | ||
}), | ||
guest: new GroupData({ | ||
id: 2, | ||
name: 'Guest', | ||
discount: 0, | ||
shownPrices: true, | ||
}), | ||
customer: new GroupData({ | ||
id: 3, | ||
name: 'Customer', | ||
discount: 0, | ||
shownPrices: true, | ||
}), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import ModuleData from '@data/faker/module'; | ||
|
||
export default { | ||
blockwishlist: new ModuleData({ | ||
tag: 'blockwishlist', | ||
name: 'Wishlist', | ||
}), | ||
psApiResources: new ModuleData({ | ||
tag: 'ps_apiresources', | ||
name: 'PrestaShop API Resources', | ||
}), | ||
psCashOnDelivery: new ModuleData({ | ||
tag: 'ps_cashondelivery', | ||
name: 'Cash on delivery (COD)', | ||
}), | ||
psCheckPayment: new ModuleData({ | ||
tag: 'ps_checkpayment', | ||
name: 'Payments by check', | ||
}), | ||
psEmailAlerts: new ModuleData({ | ||
tag: 'ps_emailalerts', | ||
name: 'Mail alerts', | ||
releaseZip: 'https://github.com/PrestaShop/ps_emailalerts/releases/download/v2.4.2/ps_emailalerts.zip', | ||
}), | ||
psEmailSubscription: new ModuleData({ | ||
tag: 'ps_emailsubscription', | ||
name: 'Newsletter subscription', | ||
}), | ||
psFacetedSearch: new ModuleData({ | ||
tag: 'ps_facetedsearch', | ||
name: 'Faceted search', | ||
releaseZip: 'https://github.com/PrestaShop/ps_facetedsearch/releases/download/v3.14.1/ps_facetedsearch.zip', | ||
}), | ||
psThemeCusto: new ModuleData({ | ||
tag: 'ps_themecusto', | ||
name: 'Theme Customization', | ||
}), | ||
contactForm: new ModuleData({ | ||
tag: 'contactform', | ||
name: 'Contact form', | ||
}), | ||
themeCustomization: new ModuleData({ | ||
tag: 'ps_themecusto', | ||
name: 'Theme Customization', | ||
}), | ||
availableQuantities: new ModuleData({ | ||
tag: 'statsstock', | ||
name: 'Available quantities', | ||
}), | ||
mainMenu: new ModuleData({ | ||
tag: 'ps_mainmenu', | ||
name: 'Main menu', | ||
}), | ||
keycloak: new ModuleData({ | ||
tag: 'keycloak_connector_demo', | ||
name: 'Keycloak OAuth2 connector demo', | ||
releaseZip: 'https://github.com/PrestaShop/keycloak_connector_demo/releases/download/v1.0.4/keycloak_connector_demo.zip', | ||
}), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export default { | ||
Mr: { | ||
id: 1, | ||
name: 'Mr.', | ||
}, | ||
Mrs: { | ||
id: 2, | ||
name: 'Mrs', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import TitleData from '@data/faker/title'; | ||
|
||
export default { | ||
Mrs: new TitleData({ | ||
id: 2, | ||
name: 'Mrs.', | ||
gender: 'Female', | ||
}), | ||
Mr: new TitleData({ | ||
id: 1, | ||
name: 'Mr.', | ||
gender: 'Male', | ||
}), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import Groups from '@data/demo/groups'; | ||
import Titles from '@data/demo/titles'; | ||
import type GroupData from '@data/faker/group'; | ||
import type TitleData from '@data/faker/title'; | ||
import type {CustomerCreator} from '@data/types/customer'; | ||
|
||
import {faker} from '@faker-js/faker'; | ||
|
||
const genders: string[] = Object.values(Titles).map((title: TitleData) => title.name); | ||
const groups: string[] = Object.values(Groups).map((group: GroupData) => group.name); | ||
const risksRating: string[] = ['None', 'Low', 'Medium', 'High']; | ||
|
||
/** | ||
* Create new customer to use on creation form on customer page on BO and FO | ||
* @class | ||
*/ | ||
export default class CustomerData { | ||
public readonly id: number; | ||
|
||
public readonly socialTitle: string; | ||
|
||
public readonly firstName: string; | ||
|
||
public readonly lastName: string; | ||
|
||
public email: string; | ||
|
||
public password: string; | ||
|
||
public readonly birthDate: Date; | ||
|
||
public readonly yearOfBirth: string; | ||
|
||
public readonly monthOfBirth: string; | ||
|
||
public readonly dayOfBirth: string; | ||
|
||
public readonly enabled: boolean; | ||
|
||
public readonly partnerOffers: boolean; | ||
|
||
public readonly newsletter: boolean; | ||
|
||
public readonly defaultCustomerGroup: string; | ||
|
||
public readonly company: string; | ||
|
||
public readonly allowedOutstandingAmount: number; | ||
|
||
public readonly riskRating: string; | ||
|
||
/** | ||
* Constructor for class CustomerData | ||
* @param customerToCreate {CustomerCreator} Could be used to force the value of some members | ||
*/ | ||
constructor(customerToCreate: CustomerCreator = {}) { | ||
/** @type {number} ID of the customer */ | ||
this.id = customerToCreate.id || 0; | ||
|
||
/** @type {string} Social title of the customer (Mr, Mrs) */ | ||
this.socialTitle = customerToCreate.socialTitle || faker.helpers.arrayElement(genders); | ||
|
||
/** @type {string} Firstname of the customer */ | ||
this.firstName = customerToCreate.firstName || faker.person.firstName(); | ||
|
||
/** @type {string} Lastname of the customer */ | ||
this.lastName = customerToCreate.lastName || faker.person.lastName(); | ||
|
||
/** @type {string} Email for the customer account */ | ||
this.email = customerToCreate.email || faker.internet.email( | ||
{ | ||
firstName: this.firstName, | ||
lastName: this.lastName, | ||
provider: 'prestashop.com', | ||
}, | ||
); | ||
|
||
/** @type {string} Password for the customer account */ | ||
this.password = customerToCreate.password === undefined ? faker.internet.password() : customerToCreate.password; | ||
|
||
/** @type {Date} Birthdate of the customer */ | ||
this.birthDate = customerToCreate.birthDate || faker.date.between({from: '1950-01-01', to: '2000-12-31'}); | ||
|
||
/** @type {string} Year of the birth 'yyyy' */ | ||
this.yearOfBirth = customerToCreate.yearOfBirth || this.birthDate.getFullYear().toString(); | ||
|
||
/** @type {string} Month of the birth 'mm' */ | ||
this.monthOfBirth = customerToCreate.monthOfBirth || (`0${this.birthDate.getMonth() + 1}`).slice(-2); | ||
|
||
/** @type {string} Day of the birth 'dd' */ | ||
this.dayOfBirth = customerToCreate.dayOfBirth || (`0${this.birthDate.getDate()}`).slice(-2).toString(); | ||
|
||
/** @type {boolean} Status of the customer */ | ||
this.enabled = customerToCreate.enabled === undefined ? true : customerToCreate.enabled; | ||
|
||
/** @type {boolean} True to enable partner offers */ | ||
this.partnerOffers = customerToCreate.partnerOffers === undefined ? true : customerToCreate.partnerOffers; | ||
|
||
/** @type {string} Default group for the customer */ | ||
this.defaultCustomerGroup = customerToCreate.defaultCustomerGroup || faker.helpers.arrayElement(groups); | ||
|
||
/** @type {boolean} True to enable sending newsletter to the customer */ | ||
this.newsletter = customerToCreate.newsletter === undefined ? false : customerToCreate.newsletter; | ||
|
||
/** @type {string} Company for the customer */ | ||
this.company = customerToCreate.company || faker.company.name(); | ||
|
||
/** @type {Number} Allowed outstanding amount for the customer */ | ||
this.allowedOutstandingAmount = customerToCreate.allowedOutstandingAmount || faker.number.int({ | ||
min: 0, | ||
max: 100, | ||
}); | ||
|
||
/** @type {string} Risk rating for the customer */ | ||
this.riskRating = customerToCreate.riskRating || faker.helpers.arrayElement(risksRating); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {GroupCreator} from '@data/types/group'; | ||
|
||
import {faker} from '@faker-js/faker'; | ||
|
||
const priceDisplayMethod: string[] = ['Tax included', 'Tax excluded']; | ||
|
||
/** | ||
* Create new group to use on creation form on group page on BO | ||
* @class | ||
*/ | ||
export default class GroupData { | ||
public readonly id: number; | ||
|
||
public readonly name: string; | ||
|
||
public readonly frName: string; | ||
|
||
public readonly discount: number; | ||
|
||
public readonly priceDisplayMethod: string; | ||
|
||
public readonly shownPrices: boolean; | ||
|
||
/** | ||
* Constructor for class GroupData | ||
* @param groupToCreate {GroupCreator} Could be used to force the value of some members | ||
*/ | ||
constructor(groupToCreate: GroupCreator = {}) { | ||
/** @type {number} ID of the group */ | ||
this.id = groupToCreate.id || 0; | ||
|
||
/** @type {string} Name of the group */ | ||
this.name = groupToCreate.name || faker.person.jobType(); | ||
|
||
/** @type {string} French name of the group */ | ||
this.frName = groupToCreate.frName || this.name; | ||
|
||
/** @type {number} Basic discount for the group */ | ||
this.discount = groupToCreate.discount || 0; | ||
|
||
/** @type {string} Price display method of the group */ | ||
this.priceDisplayMethod = groupToCreate.priceDisplayMethod || faker.helpers.arrayElement(priceDisplayMethod); | ||
|
||
/** @type {boolean} True to show prices for the group */ | ||
this.shownPrices = groupToCreate.shownPrices === undefined ? true : groupToCreate.shownPrices; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type {ModuleDataCreator} from '@data/types/module'; | ||
|
||
/** | ||
* @class | ||
*/ | ||
export default class ModuleData { | ||
public readonly tag: string; | ||
|
||
public readonly name: string; | ||
|
||
public readonly releaseZip: string; | ||
|
||
/** | ||
* Constructor for class ModuleData | ||
* @param valueToCreate {ModuleDataCreator} Could be used to force the value of some members | ||
*/ | ||
constructor(valueToCreate: ModuleDataCreator = {}) { | ||
/** @type {string} Technical Name of the module */ | ||
this.tag = valueToCreate.tag || ''; | ||
|
||
/** @type {string} Name of the module */ | ||
this.name = valueToCreate.name || ''; | ||
|
||
/** @type {string} Release URL */ | ||
this.releaseZip = valueToCreate.releaseZip || ''; | ||
} | ||
} |
Oops, something went wrong.