@vendure/admin-ui-plugin 2.0.0-next.1 → 2.0.0-next.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.
- package/lib/admin-ui/165.6aeb6ecf722558ee.js +2 -0
- package/lib/admin-ui/165.6aeb6ecf722558ee.js.map +1 -0
- package/lib/admin-ui/239.a68e402e10b798f1.js +2 -0
- package/lib/admin-ui/{239.a5ff17f86dbb8ca2.js.map → 239.a68e402e10b798f1.js.map} +1 -1
- package/lib/admin-ui/26.477d6446134d960e.js +2 -0
- package/lib/admin-ui/{26.2b116578fae1ff6d.js.map → 26.477d6446134d960e.js.map} +1 -1
- package/lib/admin-ui/316.07f9c805e4c95dc8.js +2 -0
- package/lib/admin-ui/{316.bc52480ffba2e8c2.js.map → 316.07f9c805e4c95dc8.js.map} +1 -1
- package/lib/admin-ui/349.abe4847f7fe9b3da.js +2 -0
- package/lib/admin-ui/349.abe4847f7fe9b3da.js.map +1 -0
- package/lib/admin-ui/356.3a6951fe80b5a001.js +2 -0
- package/lib/admin-ui/{356.52ad52413445b7ae.js.map → 356.3a6951fe80b5a001.js.map} +1 -1
- package/lib/admin-ui/600.8f0165a8d1255cd0.js +2 -0
- package/lib/admin-ui/{600.7fb6e9620c160fac.js.map → 600.8f0165a8d1255cd0.js.map} +1 -1
- package/lib/admin-ui/625.adebc6a7222bde82.js +2 -0
- package/lib/admin-ui/{625.dcecbc707b7d4b98.js.map → 625.adebc6a7222bde82.js.map} +1 -1
- package/lib/admin-ui/849.cc032ddf77c67cc3.js +2 -0
- package/lib/admin-ui/849.cc032ddf77c67cc3.js.map +1 -0
- package/lib/admin-ui/i18n-messages/cs.json +2 -0
- package/lib/admin-ui/i18n-messages/de.json +2 -0
- package/lib/admin-ui/i18n-messages/en.json +3 -1
- package/lib/admin-ui/i18n-messages/es.json +2 -0
- package/lib/admin-ui/i18n-messages/fr.json +2 -0
- package/lib/admin-ui/i18n-messages/it.json +2 -0
- package/lib/admin-ui/i18n-messages/pl.json +2 -0
- package/lib/admin-ui/i18n-messages/pt_BR.json +2 -0
- package/lib/admin-ui/i18n-messages/pt_PT.json +2 -0
- package/lib/admin-ui/i18n-messages/ru.json +2 -0
- package/lib/admin-ui/i18n-messages/uk.json +2 -0
- package/lib/admin-ui/i18n-messages/zh_Hans.json +2 -0
- package/lib/admin-ui/i18n-messages/zh_Hant.json +2 -0
- package/lib/admin-ui/index.html +1 -1
- package/lib/admin-ui/main.0b0d9a8ae6759254.js +2740 -0
- package/lib/admin-ui/main.0b0d9a8ae6759254.js.map +1 -0
- package/lib/admin-ui/runtime.1dd1cbaf09547dd2.js +2 -0
- package/lib/admin-ui/{runtime.8bab7ff9a8ad6db6.js.map → runtime.1dd1cbaf09547dd2.js.map} +1 -1
- package/lib/admin-ui/vendure-ui-config.json +25 -10
- package/lib/src/plugin.js +1 -0
- package/lib/src/plugin.js.map +1 -1
- package/package.json +4 -4
- package/lib/admin-ui/165.acb9630c44bb0271.js +0 -2
- package/lib/admin-ui/165.acb9630c44bb0271.js.map +0 -1
- package/lib/admin-ui/239.a5ff17f86dbb8ca2.js +0 -2
- package/lib/admin-ui/26.2b116578fae1ff6d.js +0 -2
- package/lib/admin-ui/316.bc52480ffba2e8c2.js +0 -2
- package/lib/admin-ui/349.6f8a30060cc86ada.js +0 -2
- package/lib/admin-ui/349.6f8a30060cc86ada.js.map +0 -1
- package/lib/admin-ui/356.52ad52413445b7ae.js +0 -2
- package/lib/admin-ui/600.7fb6e9620c160fac.js +0 -2
- package/lib/admin-ui/625.dcecbc707b7d4b98.js +0 -2
- package/lib/admin-ui/849.56aaa5a0d453cfdf.js +0 -2
- package/lib/admin-ui/849.56aaa5a0d453cfdf.js.map +0 -1
- package/lib/admin-ui/main.8a7673f3d80ec5da.js +0 -2739
- package/lib/admin-ui/main.8a7673f3d80ec5da.js.map +0 -1
- package/lib/admin-ui/runtime.8bab7ff9a8ad6db6.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|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YACZO,GAAI,GACJqD,UAAW,GACXC,UAAW,GACX/G,KAAM,GACNE,SAAS,EACTK,WAAY,GACZE,QAAS,IAEbrB,GAAMD,EAAYgC,UAAU6F,aAAa5H,GAAI6H,UAAU5H,GAAQA,EAAK8B,mDAdnE+F,GAAiB1I,qDAAjB0I,EAAiBC,QAAjBD,EAAiB,qBAFd,SCKT,MAAME,EAA2B,CACpC,CACIC,KAAM,aACNC,UAAWT,EACXU,KAAM,CACFC,cAAYrB,KAAE,2BAGtB,CACIkB,KAAM,iBACNC,UAAWtC,EACXyC,WAASzI,OAAkBkI,GAC3BQ,cAAe,CAAC1I,OAChBuI,KAAM,CACFC,WAAYG,KAKjB,WAA6BC,EAAW1I,GAC3C,SAAOF,OAAoC,CACvCqE,OAAQuE,EAAKvE,OACbI,GAAIvE,EAAOuE,GACXoE,cAAe,wBACfC,QAAS3I,GAAaA,EAAUa,KAChC2D,MAAO,eC1BR,+CAAMoE,4DAHA,CAAC/I,MAAcgJ,cAAsBZ","names":["o","create","save","removeCondition","oxw","addCondition","removeAction","addAction","d","constructor","t","n","i","a","s","m","p","super","this","customFields","getCustomFieldConfig","detailForm","formBuilder","group","name","c","enabled","couponCode","perCustomerUsageLimit","startsAt","endsAt","conditions","array","actions","reduce","_","b","Object","ngOnInit","init","promotion$","entity$","dataService","promotion","getPromotionActionsAndConditions","single$","subscribe","allActions","promotionActions","allConditions","promotionConditions","changeDetector","markForCheck","ngOnDestroy","destroy","getAvailableConditions","filter","find","code","getConditionDefinition","getAvailableActions","getActionDefinition","saveButtonEnabled","dirty","valid","length","value","addOperation","markAsDirty","removeOperation","formArrayOf","get","mapOperationsToInputs","createPromotion","__typename","notificationService","success","entity","markAsPristine","router","navigate","id","relativeTo","route","error","message","pipe","I","updatePromotion","setFormValues","patchValue","forEach","setCustomFieldFormValues","map","arguments","values","args","findIndex","getDefaultArgValue","push","control","Error","removeAt","splice","h","selectors","deletePromotion","setQueryFn","getPromotions","refetchOnChannelChange","promotions","createQueryOptions","searchForm","to","valueChanges","queryParamMap","destroy$","params","setPageNumber","refresh","modalService","dialog","title","l","buttons","type","label","returnValue","no","contains","options","skip","take","v","createdAt","updatedAt","getPromotion","mapStream","g","factory","N","path","component","data","breadcrumb","resolve","canDeactivate","Q","e","breadcrumbKey","getName","Z","u"],"sources":["./src/lib/marketing/src/components/promotion-detail/promotion-detail.component.html","./src/lib/marketing/src/components/promotion-detail/promotion-detail.component.ts","./src/lib/marketing/src/components/promotion-list/promotion-list.component.html","./src/lib/marketing/src/components/promotion-list/promotion-list.component.ts","./src/lib/marketing/src/providers/routing/promotion-resolver.ts","./src/lib/marketing/src/marketing.routes.ts","./src/lib/marketing/src/marketing.module.ts"],"sourcesContent":["<vdr-action-bar>\r\n <vdr-ab-left>\r\n <div class=\"flex clr-align-items-center\">\r\n <vdr-entity-info [entity]=\"entity$ | async\"></vdr-entity-info>\r\n <clr-toggle-wrapper *vdrIfPermissions=\"'UpdatePromotion'\">\r\n <input type=\"checkbox\" clrToggle name=\"enabled\" [formControl]=\"detailForm.get(['enabled'])\" />\r\n <label>{{ 'common.enabled' | translate }}</label>\r\n </clr-toggle-wrapper>\r\n </div>\r\n </vdr-ab-left>\r\n\r\n <vdr-ab-right>\r\n <vdr-action-bar-items locationId=\"promotion-detail\"></vdr-action-bar-items>\r\n <button\r\n class=\"btn btn-primary\"\r\n *ngIf=\"isNew$ | async; else updateButton\"\r\n (click)=\"create()\"\r\n [disabled]=\"!saveButtonEnabled()\"\r\n >\r\n {{ 'common.create' | translate }}\r\n </button>\r\n <ng-template #updateButton>\r\n <button\r\n class=\"btn btn-primary\"\r\n (click)=\"save()\"\r\n *vdrIfPermissions=\"'UpdatePromotion'\"\r\n [disabled]=\"!saveButtonEnabled()\"\r\n >\r\n {{ 'common.update' | translate }}\r\n </button>\r\n </ng-template>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<form class=\"form\" [formGroup]=\"detailForm\">\r\n <vdr-form-field [label]=\"'common.name' | translate\" for=\"name\">\r\n <input\r\n id=\"name\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n type=\"text\"\r\n formControlName=\"name\"\r\n />\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'marketing.starts-at' | translate\" for=\"startsAt\">\r\n <vdr-datetime-picker formControlName=\"startsAt\"></vdr-datetime-picker>\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'marketing.ends-at' | translate\" for=\"endsAt\">\r\n <vdr-datetime-picker formControlName=\"endsAt\"></vdr-datetime-picker>\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'marketing.coupon-code' | translate\" for=\"couponCode\">\r\n <input\r\n id=\"couponCode\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n type=\"text\"\r\n formControlName=\"couponCode\"\r\n />\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'marketing.per-customer-limit' | translate\" for=\"perCustomerUsageLimit\">\r\n <input\r\n id=\"perCustomerUsageLimit\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n type=\"number\"\r\n min=\"1\"\r\n max=\"999\"\r\n formControlName=\"perCustomerUsageLimit\"\r\n />\r\n </vdr-form-field>\r\n <section formGroupName=\"customFields\" *ngIf=\"customFields.length\">\r\n <label>{{ 'common.custom-fields' | translate }}</label>\r\n <vdr-tabbed-custom-fields\r\n entityName=\"Promotion\"\r\n [customFields]=\"customFields\"\r\n [customFieldsFormGroup]=\"detailForm.get('customFields')\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n ></vdr-tabbed-custom-fields>\r\n </section>\r\n\r\n <vdr-custom-detail-component-host\r\n locationId=\"promotion-detail\"\r\n [entity$]=\"entity$\"\r\n [detailForm]=\"detailForm\"\r\n ></vdr-custom-detail-component-host>\r\n\r\n <div class=\"clr-row\">\r\n <div class=\"clr-col\" formArrayName=\"conditions\">\r\n <label class=\"clr-control-label\">{{ 'marketing.conditions' | translate }}</label>\r\n <ng-container *ngFor=\"let condition of conditions; index as i\">\r\n <vdr-configurable-input\r\n (remove)=\"removeCondition($event)\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n [operation]=\"condition\"\r\n [operationDefinition]=\"getConditionDefinition(condition)\"\r\n [formControlName]=\"i\"\r\n ></vdr-configurable-input>\r\n </ng-container>\r\n\r\n <div>\r\n <vdr-dropdown *vdrIfPermissions=\"'UpdatePromotion'\">\r\n <button class=\"btn btn-outline\" vdrDropdownTrigger>\r\n <clr-icon shape=\"plus\"></clr-icon>\r\n {{ 'marketing.add-condition' | translate }}\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-left\">\r\n <button\r\n *ngFor=\"let condition of getAvailableConditions()\"\r\n type=\"button\"\r\n vdrDropdownItem\r\n (click)=\"addCondition(condition)\"\r\n >\r\n {{ condition.description }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </div>\r\n </div>\r\n <div class=\"clr-col\" formArrayName=\"actions\">\r\n <label class=\"clr-control-label\">{{ 'marketing.actions' | translate }}</label>\r\n <vdr-configurable-input\r\n *ngFor=\"let action of actions; index as i\"\r\n (remove)=\"removeAction($event)\"\r\n [operation]=\"action\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n [operationDefinition]=\"getActionDefinition(action)\"\r\n [formControlName]=\"i\"\r\n ></vdr-configurable-input>\r\n <div>\r\n <vdr-dropdown *vdrIfPermissions=\"'UpdatePromotion'\">\r\n <button class=\"btn btn-outline\" vdrDropdownTrigger>\r\n <clr-icon shape=\"plus\"></clr-icon>\r\n {{ 'marketing.add-action' | translate }}\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-left\">\r\n <button\r\n *ngFor=\"let action of getAvailableActions()\"\r\n type=\"button\"\r\n vdrDropdownItem\r\n (click)=\"addAction(action)\"\r\n >\r\n {{ action.description }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </div>\r\n </div>\r\n </div>\r\n</form>\r\n","import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';\r\nimport { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';\r\nimport {\r\n BaseDetailComponent,\r\n ConfigurableOperation,\r\n ConfigurableOperationDefinition,\r\n ConfigurableOperationInput,\r\n CreatePromotionInput,\r\n CustomFieldConfig,\r\n DataService,\r\n encodeConfigArgValue,\r\n getConfigArgValue,\r\n getDefaultConfigArgValue,\r\n LanguageCode,\r\n NotificationService,\r\n PromotionFragment,\r\n ServerConfigService,\r\n UpdatePromotionInput,\r\n} from '@vendure/admin-ui/core';\r\nimport { Observable } from 'rxjs';\r\nimport { mergeMap, take } from 'rxjs/operators';\r\n\r\n@Component({\r\n selector: 'vdr-promotion-detail',\r\n templateUrl: './promotion-detail.component.html',\r\n styleUrls: ['./promotion-detail.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class PromotionDetailComponent\r\n extends BaseDetailComponent<PromotionFragment>\r\n implements OnInit, OnDestroy\r\n{\r\n promotion$: Observable<PromotionFragment>;\r\n detailForm: FormGroup;\r\n customFields: CustomFieldConfig[];\r\n conditions: ConfigurableOperation[] = [];\r\n actions: ConfigurableOperation[] = [];\r\n\r\n private allConditions: ConfigurableOperationDefinition[] = [];\r\n private allActions: ConfigurableOperationDefinition[] = [];\r\n\r\n constructor(\r\n router: Router,\r\n route: ActivatedRoute,\r\n serverConfigService: ServerConfigService,\r\n private changeDetector: ChangeDetectorRef,\r\n protected dataService: DataService,\r\n private formBuilder: FormBuilder,\r\n private notificationService: NotificationService,\r\n ) {\r\n super(route, router, serverConfigService, dataService);\r\n this.customFields = this.getCustomFieldConfig('Promotion');\r\n this.detailForm = this.formBuilder.group({\r\n name: ['', Validators.required],\r\n enabled: true,\r\n couponCode: null,\r\n perCustomerUsageLimit: null,\r\n startsAt: null,\r\n endsAt: null,\r\n conditions: this.formBuilder.array([]),\r\n actions: this.formBuilder.array([]),\r\n customFields: this.formBuilder.group(\r\n this.customFields.reduce((hash, field) => ({ ...hash, [field.name]: '' }), {}),\r\n ),\r\n });\r\n }\r\n\r\n ngOnInit() {\r\n this.init();\r\n this.promotion$ = this.entity$;\r\n this.dataService.promotion.getPromotionActionsAndConditions().single$.subscribe(data => {\r\n this.allActions = data.promotionActions;\r\n this.allConditions = data.promotionConditions;\r\n this.changeDetector.markForCheck();\r\n });\r\n }\r\n\r\n ngOnDestroy() {\r\n this.destroy();\r\n }\r\n\r\n getAvailableConditions(): ConfigurableOperationDefinition[] {\r\n return this.allConditions.filter(o => !this.conditions.find(c => c.code === o.code));\r\n }\r\n\r\n getConditionDefinition(condition: ConfigurableOperation): ConfigurableOperationDefinition | undefined {\r\n return this.allConditions.find(c => c.code === condition.code);\r\n }\r\n\r\n getAvailableActions(): ConfigurableOperationDefinition[] {\r\n return this.allActions.filter(o => !this.actions.find(a => a.code === o.code));\r\n }\r\n\r\n getActionDefinition(action: ConfigurableOperation): ConfigurableOperationDefinition | undefined {\r\n return this.allActions.find(c => c.code === action.code);\r\n }\r\n\r\n saveButtonEnabled(): boolean {\r\n return (\r\n this.detailForm.dirty &&\r\n this.detailForm.valid &&\r\n (this.conditions.length !== 0 || this.detailForm.value.couponCode) &&\r\n this.actions.length !== 0\r\n );\r\n }\r\n\r\n addCondition(condition: ConfigurableOperation) {\r\n this.addOperation('conditions', condition);\r\n this.detailForm.markAsDirty();\r\n }\r\n\r\n addAction(action: ConfigurableOperation) {\r\n this.addOperation('actions', action);\r\n this.detailForm.markAsDirty();\r\n }\r\n\r\n removeCondition(condition: ConfigurableOperation) {\r\n this.removeOperation('conditions', condition);\r\n this.detailForm.markAsDirty();\r\n }\r\n\r\n removeAction(action: ConfigurableOperation) {\r\n this.removeOperation('actions', action);\r\n this.detailForm.markAsDirty();\r\n }\r\n\r\n formArrayOf(key: 'conditions' | 'actions'): FormArray {\r\n return this.detailForm.get(key) as FormArray;\r\n }\r\n\r\n create() {\r\n if (!this.detailForm.dirty) {\r\n return;\r\n }\r\n const formValue = this.detailForm.value;\r\n const input: CreatePromotionInput = {\r\n name: formValue.name,\r\n enabled: true,\r\n couponCode: formValue.couponCode,\r\n perCustomerUsageLimit: formValue.perCustomerUsageLimit,\r\n startsAt: formValue.startsAt,\r\n endsAt: formValue.endsAt,\r\n conditions: this.mapOperationsToInputs(this.conditions, formValue.conditions),\r\n actions: this.mapOperationsToInputs(this.actions, formValue.actions),\r\n customFields: formValue.customFields,\r\n };\r\n this.dataService.promotion.createPromotion(input).subscribe(\r\n ({ createPromotion }) => {\r\n switch (createPromotion.__typename) {\r\n case 'Promotion':\r\n this.notificationService.success(_('common.notify-create-success'), {\r\n entity: 'Promotion',\r\n });\r\n this.detailForm.markAsPristine();\r\n this.changeDetector.markForCheck();\r\n this.router.navigate(['../', createPromotion.id], { relativeTo: this.route });\r\n break;\r\n case 'MissingConditionsError':\r\n this.notificationService.error(createPromotion.message);\r\n break;\r\n }\r\n },\r\n err => {\r\n this.notificationService.error(_('common.notify-create-error'), {\r\n entity: 'Promotion',\r\n });\r\n },\r\n );\r\n }\r\n\r\n save() {\r\n if (!this.detailForm.dirty) {\r\n return;\r\n }\r\n const formValue = this.detailForm.value;\r\n this.promotion$\r\n .pipe(\r\n take(1),\r\n mergeMap(promotion => {\r\n const input: UpdatePromotionInput = {\r\n id: promotion.id,\r\n name: formValue.name,\r\n enabled: formValue.enabled,\r\n couponCode: formValue.couponCode,\r\n perCustomerUsageLimit: formValue.perCustomerUsageLimit,\r\n startsAt: formValue.startsAt,\r\n endsAt: formValue.endsAt,\r\n conditions: this.mapOperationsToInputs(this.conditions, formValue.conditions),\r\n actions: this.mapOperationsToInputs(this.actions, formValue.actions),\r\n customFields: formValue.customFields,\r\n };\r\n return this.dataService.promotion.updatePromotion(input);\r\n }),\r\n )\r\n .subscribe(\r\n data => {\r\n this.notificationService.success(_('common.notify-update-success'), {\r\n entity: 'Promotion',\r\n });\r\n this.detailForm.markAsPristine();\r\n this.changeDetector.markForCheck();\r\n },\r\n err => {\r\n this.notificationService.error(_('common.notify-update-error'), {\r\n entity: 'Promotion',\r\n });\r\n },\r\n );\r\n }\r\n\r\n /**\r\n * Update the form values when the entity changes.\r\n */\r\n protected setFormValues(entity: PromotionFragment, languageCode: LanguageCode): void {\r\n this.detailForm.patchValue({\r\n name: entity.name,\r\n enabled: entity.enabled,\r\n couponCode: entity.couponCode,\r\n perCustomerUsageLimit: entity.perCustomerUsageLimit,\r\n startsAt: entity.startsAt,\r\n endsAt: entity.endsAt,\r\n });\r\n entity.conditions.forEach(o => {\r\n this.addOperation('conditions', o);\r\n });\r\n entity.actions.forEach(o => this.addOperation('actions', o));\r\n if (this.customFields.length) {\r\n this.setCustomFieldFormValues(this.customFields, this.detailForm.get('customFields'), entity);\r\n }\r\n }\r\n\r\n /**\r\n * Maps an array of conditions or actions to the input format expected by the GraphQL API.\r\n */\r\n private mapOperationsToInputs(\r\n operations: ConfigurableOperation[],\r\n formValueOperations: any,\r\n ): ConfigurableOperationInput[] {\r\n return operations.map((o, i) => {\r\n return {\r\n code: o.code,\r\n arguments: Object.values<any>(formValueOperations[i].args).map((value, j) => ({\r\n name: o.args[j].name,\r\n value: encodeConfigArgValue(value),\r\n })),\r\n };\r\n });\r\n }\r\n\r\n /**\r\n * Adds a new condition or action to the promotion.\r\n */\r\n private addOperation(key: 'conditions' | 'actions', operation: ConfigurableOperation) {\r\n const operationsArray = this.formArrayOf(key);\r\n const collection = key === 'conditions' ? this.conditions : this.actions;\r\n const index = operationsArray.value.findIndex(o => o.code === operation.code);\r\n if (index === -1) {\r\n const argsHash = operation.args.reduce(\r\n (output, arg) => ({\r\n ...output,\r\n [arg.name]:\r\n getConfigArgValue(arg.value) ?? this.getDefaultArgValue(key, operation, arg.name),\r\n }),\r\n {},\r\n );\r\n operationsArray.push(\r\n this.formBuilder.control({\r\n code: operation.code,\r\n args: argsHash,\r\n }),\r\n );\r\n collection.push({\r\n code: operation.code,\r\n args: operation.args.map(a => ({ name: a.name, value: getConfigArgValue(a.value) })),\r\n });\r\n }\r\n }\r\n\r\n private getDefaultArgValue(\r\n key: 'conditions' | 'actions',\r\n operation: ConfigurableOperation,\r\n argName: string,\r\n ) {\r\n const def =\r\n key === 'conditions'\r\n ? this.allConditions.find(c => c.code === operation.code)\r\n : this.allActions.find(a => a.code === operation.code);\r\n if (def) {\r\n const argDef = def.args.find(a => a.name === argName);\r\n if (argDef) {\r\n return getDefaultConfigArgValue(argDef);\r\n }\r\n }\r\n throw new Error(`Could not determine default value for \"argName\"`);\r\n }\r\n\r\n /**\r\n * Removes a condition or action from the promotion.\r\n */\r\n private removeOperation(key: 'conditions' | 'actions', operation: ConfigurableOperation) {\r\n const operationsArray = this.formArrayOf(key);\r\n const collection = key === 'conditions' ? this.conditions : this.actions;\r\n const index = operationsArray.value.findIndex(o => o.code === operation.code);\r\n if (index !== -1) {\r\n operationsArray.removeAt(index);\r\n collection.splice(index, 1);\r\n }\r\n }\r\n}\r\n","<vdr-action-bar>\r\n <vdr-ab-left>\r\n <form class=\"search-form\" [formGroup]=\"searchForm\">\r\n <input\r\n type=\"text\"\r\n formControlName=\"name\"\r\n [placeholder]=\"'marketing.search-by-name' | translate\"\r\n class=\"search-input\"\r\n />\r\n <input\r\n type=\"text\"\r\n formControlName=\"couponCode\"\r\n [placeholder]=\"'marketing.search-by-coupon-code' | translate\"\r\n class=\"search-input\"\r\n />\r\n </form>\r\n </vdr-ab-left>\r\n <vdr-ab-right>\r\n <vdr-action-bar-items locationId=\"promotion-list\"></vdr-action-bar-items>\r\n <a class=\"btn btn-primary\"\r\n *vdrIfPermissions=\"'CreatePromotion'\"\r\n [routerLink]=\"['./create']\">\r\n <clr-icon shape=\"plus\"></clr-icon>\r\n {{ 'marketing.create-new-promotion' | translate }}\r\n </a>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<vdr-data-table\r\n [items]=\"items$ | async\"\r\n [itemsPerPage]=\"itemsPerPage$ | async\"\r\n [totalItems]=\"totalItems$ | async\"\r\n [currentPage]=\"currentPage$ | async\"\r\n (pageChange)=\"setPageNumber($event)\"\r\n (itemsPerPageChange)=\"setItemsPerPage($event)\"\r\n>\r\n <vdr-dt-column>{{ 'common.name' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'marketing.coupon-code' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'marketing.starts-at' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'marketing.ends-at' | translate }}</vdr-dt-column>\r\n <vdr-dt-column></vdr-dt-column>\r\n <vdr-dt-column></vdr-dt-column>\r\n <vdr-dt-column></vdr-dt-column>\r\n <ng-template let-promotion=\"item\">\r\n <td class=\"left align-middle\">{{ promotion.name }}</td>\r\n <td class=\"left align-middle\">\r\n <vdr-chip *ngIf=\"promotion.couponCode\">\r\n {{ promotion.couponCode }}\r\n </vdr-chip>\r\n </td>\r\n <td class=\"left align-middle\">{{ promotion.startsAt | localeDate: 'longDate' }}</td>\r\n <td class=\"left align-middle\">{{ promotion.endsAt | localeDate: 'longDate' }}</td>\r\n <td class=\"align-middle\">\r\n <vdr-chip *ngIf=\"!promotion.enabled\">{{ 'common.disabled' | translate }}</vdr-chip>\r\n </td>\r\n <td class=\"right align-middle\">\r\n <vdr-table-row-action\r\n iconShape=\"edit\"\r\n [label]=\"'common.edit' | translate\"\r\n [linkTo]=\"['./', promotion.id]\"\r\n ></vdr-table-row-action>\r\n </td>\r\n <td class=\"right align-middle\">\r\n <vdr-dropdown>\r\n <button type=\"button\" class=\"btn btn-link btn-sm\" vdrDropdownTrigger>\r\n {{ 'common.actions' | translate }}\r\n <clr-icon shape=\"caret down\"></clr-icon>\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\r\n <button\r\n type=\"button\"\r\n class=\"delete-button\"\r\n (click)=\"deletePromotion(promotion.id)\"\r\n [disabled]=\"!('DeletePromotion' | hasPermission)\"\r\n vdrDropdownItem\r\n >\r\n <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\r\n {{ 'common.delete' | translate }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </td>\r\n </ng-template>\r\n</vdr-data-table>\r\n","import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';\r\nimport { FormControl, FormGroup } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';\r\nimport {\r\n BaseListComponent,\r\n DataService,\r\n GetPromotionListQuery,\r\n ItemOf,\r\n ModalService,\r\n NotificationService,\r\n PromotionFilterParameter,\r\n PromotionListOptions,\r\n} from '@vendure/admin-ui/core';\r\nimport { EMPTY, merge } from 'rxjs';\r\nimport { debounceTime, switchMap, takeUntil } from 'rxjs/operators';\r\n\r\nexport type PromotionSearchForm = {\r\n name: string;\r\n couponCode: string;\r\n};\r\n\r\n@Component({\r\n selector: 'vdr-promotion-list',\r\n templateUrl: './promotion-list.component.html',\r\n styleUrls: ['./promotion-list.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class PromotionListComponent\r\n extends BaseListComponent<GetPromotionListQuery, ItemOf<GetPromotionListQuery, 'promotions'>>\r\n implements OnInit\r\n{\r\n searchForm = new FormGroup({\r\n name: new FormControl(''),\r\n couponCode: new FormControl(''),\r\n });\r\n\r\n constructor(\r\n private dataService: DataService,\r\n router: Router,\r\n route: ActivatedRoute,\r\n private notificationService: NotificationService,\r\n private modalService: ModalService,\r\n ) {\r\n super(router, route);\r\n super.setQueryFn(\r\n (...args: any[]) => this.dataService.promotion.getPromotions(...args).refetchOnChannelChange(),\r\n data => data.promotions,\r\n (skip, take) => this.createQueryOptions(skip, take, this.searchForm.value),\r\n );\r\n }\r\n\r\n ngOnInit(): void {\r\n super.ngOnInit();\r\n\r\n merge(this.searchForm.valueChanges.pipe(debounceTime(250)), this.route.queryParamMap)\r\n .pipe(takeUntil(this.destroy$))\r\n .subscribe(val => {\r\n if (!val.params) {\r\n this.setPageNumber(1);\r\n }\r\n this.refresh();\r\n });\r\n }\r\n\r\n deletePromotion(promotionId: string) {\r\n this.modalService\r\n .dialog({\r\n title: _('catalog.confirm-delete-promotion'),\r\n buttons: [\r\n { type: 'secondary', label: _('common.cancel') },\r\n { type: 'danger', label: _('common.delete'), returnValue: true },\r\n ],\r\n })\r\n .pipe(\r\n switchMap(response =>\r\n response ? this.dataService.promotion.deletePromotion(promotionId) : EMPTY,\r\n ),\r\n )\r\n .subscribe(\r\n () => {\r\n this.notificationService.success(_('common.notify-delete-success'), {\r\n entity: 'Promotion',\r\n });\r\n this.refresh();\r\n },\r\n err => {\r\n this.notificationService.error(_('common.notify-delete-error'), {\r\n entity: 'Promotion',\r\n });\r\n },\r\n );\r\n }\r\n\r\n private createQueryOptions(\r\n skip: number,\r\n take: number,\r\n searchForm: PromotionSearchForm,\r\n ): { options: PromotionListOptions } {\r\n const filter: PromotionFilterParameter = {};\r\n\r\n if (searchForm.couponCode) {\r\n filter.couponCode = { contains: searchForm.couponCode };\r\n }\r\n\r\n if (searchForm.name) {\r\n filter.name = { contains: searchForm.name };\r\n }\r\n\r\n return {\r\n options: {\r\n skip,\r\n take,\r\n filter,\r\n },\r\n };\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { BaseEntityResolver, DataService, PromotionFragment } from '@vendure/admin-ui/core';\r\n\r\n/**\r\n * Resolves the id from the path into a Customer entity.\r\n */\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class PromotionResolver extends BaseEntityResolver<PromotionFragment> {\r\n constructor(router: Router, dataService: DataService) {\r\n super(\r\n router,\r\n {\r\n __typename: 'Promotion',\r\n id: '',\r\n createdAt: '',\r\n updatedAt: '',\r\n name: '',\r\n enabled: false,\r\n conditions: [],\r\n actions: [],\r\n },\r\n id => dataService.promotion.getPromotion(id).mapStream(data => data.promotion),\r\n );\r\n }\r\n}\r\n","import { Route } from '@angular/router';\r\nimport { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';\r\nimport {\r\n CanDeactivateDetailGuard,\r\n createResolveData,\r\n detailBreadcrumb,\r\n PromotionFragment,\r\n} from '@vendure/admin-ui/core';\r\n\r\nimport { PromotionDetailComponent } from './components/promotion-detail/promotion-detail.component';\r\nimport { PromotionListComponent } from './components/promotion-list/promotion-list.component';\r\nimport { PromotionResolver } from './providers/routing/promotion-resolver';\r\n\r\nexport const marketingRoutes: Route[] = [\r\n {\r\n path: 'promotions',\r\n component: PromotionListComponent,\r\n data: {\r\n breadcrumb: _('breadcrumb.promotions'),\r\n },\r\n },\r\n {\r\n path: 'promotions/:id',\r\n component: PromotionDetailComponent,\r\n resolve: createResolveData(PromotionResolver),\r\n canDeactivate: [CanDeactivateDetailGuard],\r\n data: {\r\n breadcrumb: promotionBreadcrumb,\r\n },\r\n },\r\n];\r\n\r\nexport function promotionBreadcrumb(data: any, params: any) {\r\n return detailBreadcrumb<PromotionFragment>({\r\n entity: data.entity,\r\n id: params.id,\r\n breadcrumbKey: 'breadcrumb.promotions',\r\n getName: promotion => promotion.name,\r\n route: 'promotions',\r\n });\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { RouterModule } from '@angular/router';\r\nimport { SharedModule } from '@vendure/admin-ui/core';\r\n\r\nimport { PromotionDetailComponent } from './components/promotion-detail/promotion-detail.component';\r\nimport { PromotionListComponent } from './components/promotion-list/promotion-list.component';\r\nimport { marketingRoutes } from './marketing.routes';\r\n\r\n@NgModule({\r\n imports: [SharedModule, RouterModule.forChild(marketingRoutes)],\r\n declarations: [PromotionListComponent, PromotionDetailComponent],\r\n})\r\nexport class MarketingModule {}\r\n"],"sourceRoot":"webpack:///","file":"239.a5ff17f86dbb8ca2.js"}
|
|
1
|
+
{"version":3,"mappings":"ilBAIYA,8BACIA,oBACAA,iBAAOA,8BAAkCA,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AS,EACTK,WAAY,GACZE,QAAS,IAEbrB,GAAMD,EAAYgC,UAAU6F,aAAa5H,GAAI6H,UAAU5H,GAAQA,EAAK8B,mDAdnE+F,GAAiB1I,qDAAjB0I,EAAiBC,QAAjBD,EAAiB,qBAFd,SCKT,MAAME,EAA2B,CACpC,CACIC,KAAM,aACNC,UAAWT,EACXU,KAAM,CACFC,cAAYrB,KAAE,2BAGtB,CACIkB,KAAM,iBACNC,UAAWtC,EACXyC,WAASzI,OAAkBkI,GAC3BQ,cAAe,CAAC1I,OAChBuI,KAAM,CACFC,WAAYG,KAKjB,WAA6BC,EAAW1I,GAC3C,SAAOF,OAAoC,CACvCqE,OAAQuE,EAAKvE,OACbI,GAAIvE,EAAOuE,GACXoE,cAAe,wBACfC,QAAS3I,GAAaA,EAAUa,KAChC2D,MAAO,eC1BR,+CAAMoE,4DAHA,CAAC/I,MAAcgJ,cAAsBZ","names":["o","create","save","removeCondition","oxw","addCondition","removeAction","addAction","d","constructor","t","n","i","a","s","m","p","super","this","customFields","getCustomFieldConfig","detailForm","formBuilder","group","name","c","enabled","couponCode","perCustomerUsageLimit","startsAt","endsAt","conditions","array","actions","reduce","_","b","Object","ngOnInit","init","promotion$","entity$","dataService","promotion","getPromotionActionsAndConditions","single$","subscribe","allActions","promotionActions","allConditions","promotionConditions","changeDetector","markForCheck","ngOnDestroy","destroy","getAvailableConditions","filter","find","code","getConditionDefinition","getAvailableActions","getActionDefinition","saveButtonEnabled","dirty","valid","length","value","addOperation","markAsDirty","removeOperation","formArrayOf","get","mapOperationsToInputs","createPromotion","__typename","notificationService","success","entity","markAsPristine","router","navigate","id","relativeTo","route","error","message","pipe","I","updatePromotion","setFormValues","patchValue","forEach","setCustomFieldFormValues","map","arguments","values","args","findIndex","getDefaultArgValue","push","control","Error","removeAt","splice","h","selectors","deletePromotion","setQueryFn","getPromotions","refetchOnChannelChange","promotions","createQueryOptions","searchForm","to","valueChanges","queryParamMap","destroy$","params","setPageNumber","refresh","modalService","dialog","title","l","buttons","type","label","returnValue","no","contains","options","skip","take","v","createdAt","updatedAt","getPromotion","mapStream","g","factory","N","path","component","data","breadcrumb","resolve","canDeactivate","Q","e","breadcrumbKey","getName","Z","u"],"sources":["./src/lib/marketing/src/components/promotion-detail/promotion-detail.component.html","./src/lib/marketing/src/components/promotion-detail/promotion-detail.component.ts","./src/lib/marketing/src/components/promotion-list/promotion-list.component.html","./src/lib/marketing/src/components/promotion-list/promotion-list.component.ts","./src/lib/marketing/src/providers/routing/promotion-resolver.ts","./src/lib/marketing/src/marketing.routes.ts","./src/lib/marketing/src/marketing.module.ts"],"sourcesContent":["<vdr-action-bar>\r\n <vdr-ab-left>\r\n <div class=\"flex clr-align-items-center\">\r\n <vdr-entity-info [entity]=\"entity$ | async\"></vdr-entity-info>\r\n <clr-toggle-wrapper *vdrIfPermissions=\"'UpdatePromotion'\">\r\n <input type=\"checkbox\" clrToggle name=\"enabled\" [formControl]=\"detailForm.get(['enabled'])\" />\r\n <label>{{ 'common.enabled' | translate }}</label>\r\n </clr-toggle-wrapper>\r\n </div>\r\n </vdr-ab-left>\r\n\r\n <vdr-ab-right>\r\n <vdr-action-bar-items locationId=\"promotion-detail\"></vdr-action-bar-items>\r\n <button\r\n class=\"btn btn-primary\"\r\n *ngIf=\"isNew$ | async; else updateButton\"\r\n (click)=\"create()\"\r\n [disabled]=\"!saveButtonEnabled()\"\r\n >\r\n {{ 'common.create' | translate }}\r\n </button>\r\n <ng-template #updateButton>\r\n <button\r\n class=\"btn btn-primary\"\r\n (click)=\"save()\"\r\n *vdrIfPermissions=\"'UpdatePromotion'\"\r\n [disabled]=\"!saveButtonEnabled()\"\r\n >\r\n {{ 'common.update' | translate }}\r\n </button>\r\n </ng-template>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<form class=\"form\" [formGroup]=\"detailForm\">\r\n <vdr-form-field [label]=\"'common.name' | translate\" for=\"name\">\r\n <input\r\n id=\"name\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n type=\"text\"\r\n formControlName=\"name\"\r\n />\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'marketing.starts-at' | translate\" for=\"startsAt\">\r\n <vdr-datetime-picker formControlName=\"startsAt\"></vdr-datetime-picker>\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'marketing.ends-at' | translate\" for=\"endsAt\">\r\n <vdr-datetime-picker formControlName=\"endsAt\"></vdr-datetime-picker>\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'marketing.coupon-code' | translate\" for=\"couponCode\">\r\n <input\r\n id=\"couponCode\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n type=\"text\"\r\n formControlName=\"couponCode\"\r\n />\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'marketing.per-customer-limit' | translate\" for=\"perCustomerUsageLimit\">\r\n <input\r\n id=\"perCustomerUsageLimit\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n type=\"number\"\r\n min=\"1\"\r\n max=\"999\"\r\n formControlName=\"perCustomerUsageLimit\"\r\n />\r\n </vdr-form-field>\r\n <section formGroupName=\"customFields\" *ngIf=\"customFields.length\">\r\n <label>{{ 'common.custom-fields' | translate }}</label>\r\n <vdr-tabbed-custom-fields\r\n entityName=\"Promotion\"\r\n [customFields]=\"customFields\"\r\n [customFieldsFormGroup]=\"detailForm.get('customFields')\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n ></vdr-tabbed-custom-fields>\r\n </section>\r\n\r\n <vdr-custom-detail-component-host\r\n locationId=\"promotion-detail\"\r\n [entity$]=\"entity$\"\r\n [detailForm]=\"detailForm\"\r\n ></vdr-custom-detail-component-host>\r\n\r\n <div class=\"clr-row\">\r\n <div class=\"clr-col\" formArrayName=\"conditions\">\r\n <label class=\"clr-control-label\">{{ 'marketing.conditions' | translate }}</label>\r\n <ng-container *ngFor=\"let condition of conditions; index as i\">\r\n <vdr-configurable-input\r\n (remove)=\"removeCondition($event)\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n [operation]=\"condition\"\r\n [operationDefinition]=\"getConditionDefinition(condition)\"\r\n [formControlName]=\"i\"\r\n ></vdr-configurable-input>\r\n </ng-container>\r\n\r\n <div>\r\n <vdr-dropdown *vdrIfPermissions=\"'UpdatePromotion'\">\r\n <button class=\"btn btn-outline\" vdrDropdownTrigger>\r\n <clr-icon shape=\"plus\"></clr-icon>\r\n {{ 'marketing.add-condition' | translate }}\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-left\">\r\n <button\r\n *ngFor=\"let condition of getAvailableConditions()\"\r\n type=\"button\"\r\n vdrDropdownItem\r\n (click)=\"addCondition(condition)\"\r\n >\r\n {{ condition.description }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </div>\r\n </div>\r\n <div class=\"clr-col\" formArrayName=\"actions\">\r\n <label class=\"clr-control-label\">{{ 'marketing.actions' | translate }}</label>\r\n <vdr-configurable-input\r\n *ngFor=\"let action of actions; index as i\"\r\n (remove)=\"removeAction($event)\"\r\n [operation]=\"action\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n [operationDefinition]=\"getActionDefinition(action)\"\r\n [formControlName]=\"i\"\r\n ></vdr-configurable-input>\r\n <div>\r\n <vdr-dropdown *vdrIfPermissions=\"'UpdatePromotion'\">\r\n <button class=\"btn btn-outline\" vdrDropdownTrigger>\r\n <clr-icon shape=\"plus\"></clr-icon>\r\n {{ 'marketing.add-action' | translate }}\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-left\">\r\n <button\r\n *ngFor=\"let action of getAvailableActions()\"\r\n type=\"button\"\r\n vdrDropdownItem\r\n (click)=\"addAction(action)\"\r\n >\r\n {{ action.description }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </div>\r\n </div>\r\n </div>\r\n</form>\r\n","import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';\r\nimport { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';\r\nimport {\r\n BaseDetailComponent,\r\n ConfigurableOperation,\r\n ConfigurableOperationDefinition,\r\n ConfigurableOperationInput,\r\n CreatePromotionInput,\r\n CustomFieldConfig,\r\n DataService,\r\n encodeConfigArgValue,\r\n getConfigArgValue,\r\n getDefaultConfigArgValue,\r\n LanguageCode,\r\n NotificationService,\r\n PromotionFragment,\r\n ServerConfigService,\r\n UpdatePromotionInput,\r\n} from '@vendure/admin-ui/core';\r\nimport { Observable } from 'rxjs';\r\nimport { mergeMap, take } from 'rxjs/operators';\r\n\r\n@Component({\r\n selector: 'vdr-promotion-detail',\r\n templateUrl: './promotion-detail.component.html',\r\n styleUrls: ['./promotion-detail.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class PromotionDetailComponent\r\n extends BaseDetailComponent<PromotionFragment>\r\n implements OnInit, OnDestroy\r\n{\r\n promotion$: Observable<PromotionFragment>;\r\n detailForm: FormGroup;\r\n customFields: CustomFieldConfig[];\r\n conditions: ConfigurableOperation[] = [];\r\n actions: ConfigurableOperation[] = [];\r\n\r\n private allConditions: ConfigurableOperationDefinition[] = [];\r\n private allActions: ConfigurableOperationDefinition[] = [];\r\n\r\n constructor(\r\n router: Router,\r\n route: ActivatedRoute,\r\n serverConfigService: ServerConfigService,\r\n private changeDetector: ChangeDetectorRef,\r\n protected dataService: DataService,\r\n private formBuilder: FormBuilder,\r\n private notificationService: NotificationService,\r\n ) {\r\n super(route, router, serverConfigService, dataService);\r\n this.customFields = this.getCustomFieldConfig('Promotion');\r\n this.detailForm = this.formBuilder.group({\r\n name: ['', Validators.required],\r\n enabled: true,\r\n couponCode: null,\r\n perCustomerUsageLimit: null,\r\n startsAt: null,\r\n endsAt: null,\r\n conditions: this.formBuilder.array([]),\r\n actions: this.formBuilder.array([]),\r\n customFields: this.formBuilder.group(\r\n this.customFields.reduce((hash, field) => ({ ...hash, [field.name]: '' }), {}),\r\n ),\r\n });\r\n }\r\n\r\n ngOnInit() {\r\n this.init();\r\n this.promotion$ = this.entity$;\r\n this.dataService.promotion.getPromotionActionsAndConditions().single$.subscribe(data => {\r\n this.allActions = data.promotionActions;\r\n this.allConditions = data.promotionConditions;\r\n this.changeDetector.markForCheck();\r\n });\r\n }\r\n\r\n ngOnDestroy() {\r\n this.destroy();\r\n }\r\n\r\n getAvailableConditions(): ConfigurableOperationDefinition[] {\r\n return this.allConditions.filter(o => !this.conditions.find(c => c.code === o.code));\r\n }\r\n\r\n getConditionDefinition(condition: ConfigurableOperation): ConfigurableOperationDefinition | undefined {\r\n return this.allConditions.find(c => c.code === condition.code);\r\n }\r\n\r\n getAvailableActions(): ConfigurableOperationDefinition[] {\r\n return this.allActions.filter(o => !this.actions.find(a => a.code === o.code));\r\n }\r\n\r\n getActionDefinition(action: ConfigurableOperation): ConfigurableOperationDefinition | undefined {\r\n return this.allActions.find(c => c.code === action.code);\r\n }\r\n\r\n saveButtonEnabled(): boolean {\r\n return (\r\n this.detailForm.dirty &&\r\n this.detailForm.valid &&\r\n (this.conditions.length !== 0 || this.detailForm.value.couponCode) &&\r\n this.actions.length !== 0\r\n );\r\n }\r\n\r\n addCondition(condition: ConfigurableOperation) {\r\n this.addOperation('conditions', condition);\r\n this.detailForm.markAsDirty();\r\n }\r\n\r\n addAction(action: ConfigurableOperation) {\r\n this.addOperation('actions', action);\r\n this.detailForm.markAsDirty();\r\n }\r\n\r\n removeCondition(condition: ConfigurableOperation) {\r\n this.removeOperation('conditions', condition);\r\n this.detailForm.markAsDirty();\r\n }\r\n\r\n removeAction(action: ConfigurableOperation) {\r\n this.removeOperation('actions', action);\r\n this.detailForm.markAsDirty();\r\n }\r\n\r\n formArrayOf(key: 'conditions' | 'actions'): FormArray {\r\n return this.detailForm.get(key) as FormArray;\r\n }\r\n\r\n create() {\r\n if (!this.detailForm.dirty) {\r\n return;\r\n }\r\n const formValue = this.detailForm.value;\r\n const input: CreatePromotionInput = {\r\n name: formValue.name,\r\n enabled: true,\r\n couponCode: formValue.couponCode,\r\n perCustomerUsageLimit: formValue.perCustomerUsageLimit,\r\n startsAt: formValue.startsAt,\r\n endsAt: formValue.endsAt,\r\n conditions: this.mapOperationsToInputs(this.conditions, formValue.conditions),\r\n actions: this.mapOperationsToInputs(this.actions, formValue.actions),\r\n customFields: formValue.customFields,\r\n };\r\n this.dataService.promotion.createPromotion(input).subscribe(\r\n ({ createPromotion }) => {\r\n switch (createPromotion.__typename) {\r\n case 'Promotion':\r\n this.notificationService.success(_('common.notify-create-success'), {\r\n entity: 'Promotion',\r\n });\r\n this.detailForm.markAsPristine();\r\n this.changeDetector.markForCheck();\r\n this.router.navigate(['../', createPromotion.id], { relativeTo: this.route });\r\n break;\r\n case 'MissingConditionsError':\r\n this.notificationService.error(createPromotion.message);\r\n break;\r\n }\r\n },\r\n err => {\r\n this.notificationService.error(_('common.notify-create-error'), {\r\n entity: 'Promotion',\r\n });\r\n },\r\n );\r\n }\r\n\r\n save() {\r\n if (!this.detailForm.dirty) {\r\n return;\r\n }\r\n const formValue = this.detailForm.value;\r\n this.promotion$\r\n .pipe(\r\n take(1),\r\n mergeMap(promotion => {\r\n const input: UpdatePromotionInput = {\r\n id: promotion.id,\r\n name: formValue.name,\r\n enabled: formValue.enabled,\r\n couponCode: formValue.couponCode,\r\n perCustomerUsageLimit: formValue.perCustomerUsageLimit,\r\n startsAt: formValue.startsAt,\r\n endsAt: formValue.endsAt,\r\n conditions: this.mapOperationsToInputs(this.conditions, formValue.conditions),\r\n actions: this.mapOperationsToInputs(this.actions, formValue.actions),\r\n customFields: formValue.customFields,\r\n };\r\n return this.dataService.promotion.updatePromotion(input);\r\n }),\r\n )\r\n .subscribe(\r\n data => {\r\n this.notificationService.success(_('common.notify-update-success'), {\r\n entity: 'Promotion',\r\n });\r\n this.detailForm.markAsPristine();\r\n this.changeDetector.markForCheck();\r\n },\r\n err => {\r\n this.notificationService.error(_('common.notify-update-error'), {\r\n entity: 'Promotion',\r\n });\r\n },\r\n );\r\n }\r\n\r\n /**\r\n * Update the form values when the entity changes.\r\n */\r\n protected setFormValues(entity: PromotionFragment, languageCode: LanguageCode): void {\r\n this.detailForm.patchValue({\r\n name: entity.name,\r\n enabled: entity.enabled,\r\n couponCode: entity.couponCode,\r\n perCustomerUsageLimit: entity.perCustomerUsageLimit,\r\n startsAt: entity.startsAt,\r\n endsAt: entity.endsAt,\r\n });\r\n entity.conditions.forEach(o => {\r\n this.addOperation('conditions', o);\r\n });\r\n entity.actions.forEach(o => this.addOperation('actions', o));\r\n if (this.customFields.length) {\r\n this.setCustomFieldFormValues(this.customFields, this.detailForm.get('customFields'), entity);\r\n }\r\n }\r\n\r\n /**\r\n * Maps an array of conditions or actions to the input format expected by the GraphQL API.\r\n */\r\n private mapOperationsToInputs(\r\n operations: ConfigurableOperation[],\r\n formValueOperations: any,\r\n ): ConfigurableOperationInput[] {\r\n return operations.map((o, i) => {\r\n return {\r\n code: o.code,\r\n arguments: Object.values<any>(formValueOperations[i].args).map((value, j) => ({\r\n name: o.args[j].name,\r\n value: encodeConfigArgValue(value),\r\n })),\r\n };\r\n });\r\n }\r\n\r\n /**\r\n * Adds a new condition or action to the promotion.\r\n */\r\n private addOperation(key: 'conditions' | 'actions', operation: ConfigurableOperation) {\r\n const operationsArray = this.formArrayOf(key);\r\n const collection = key === 'conditions' ? this.conditions : this.actions;\r\n const index = operationsArray.value.findIndex(o => o.code === operation.code);\r\n if (index === -1) {\r\n const argsHash = operation.args.reduce(\r\n (output, arg) => ({\r\n ...output,\r\n [arg.name]:\r\n getConfigArgValue(arg.value) ?? this.getDefaultArgValue(key, operation, arg.name),\r\n }),\r\n {},\r\n );\r\n operationsArray.push(\r\n this.formBuilder.control({\r\n code: operation.code,\r\n args: argsHash,\r\n }),\r\n );\r\n collection.push({\r\n code: operation.code,\r\n args: operation.args.map(a => ({ name: a.name, value: getConfigArgValue(a.value) })),\r\n });\r\n }\r\n }\r\n\r\n private getDefaultArgValue(\r\n key: 'conditions' | 'actions',\r\n operation: ConfigurableOperation,\r\n argName: string,\r\n ) {\r\n const def =\r\n key === 'conditions'\r\n ? this.allConditions.find(c => c.code === operation.code)\r\n : this.allActions.find(a => a.code === operation.code);\r\n if (def) {\r\n const argDef = def.args.find(a => a.name === argName);\r\n if (argDef) {\r\n return getDefaultConfigArgValue(argDef);\r\n }\r\n }\r\n throw new Error(`Could not determine default value for \"argName\"`);\r\n }\r\n\r\n /**\r\n * Removes a condition or action from the promotion.\r\n */\r\n private removeOperation(key: 'conditions' | 'actions', operation: ConfigurableOperation) {\r\n const operationsArray = this.formArrayOf(key);\r\n const collection = key === 'conditions' ? this.conditions : this.actions;\r\n const index = operationsArray.value.findIndex(o => o.code === operation.code);\r\n if (index !== -1) {\r\n operationsArray.removeAt(index);\r\n collection.splice(index, 1);\r\n }\r\n }\r\n}\r\n","<vdr-action-bar>\r\n <vdr-ab-left>\r\n <form class=\"search-form\" [formGroup]=\"searchForm\">\r\n <input\r\n type=\"text\"\r\n formControlName=\"name\"\r\n [placeholder]=\"'marketing.search-by-name' | translate\"\r\n class=\"search-input\"\r\n />\r\n <input\r\n type=\"text\"\r\n formControlName=\"couponCode\"\r\n [placeholder]=\"'marketing.search-by-coupon-code' | translate\"\r\n class=\"search-input\"\r\n />\r\n </form>\r\n </vdr-ab-left>\r\n <vdr-ab-right>\r\n <vdr-action-bar-items locationId=\"promotion-list\"></vdr-action-bar-items>\r\n <a class=\"btn btn-primary\"\r\n *vdrIfPermissions=\"'CreatePromotion'\"\r\n [routerLink]=\"['./create']\">\r\n <clr-icon shape=\"plus\"></clr-icon>\r\n {{ 'marketing.create-new-promotion' | translate }}\r\n </a>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<vdr-data-table\r\n [items]=\"items$ | async\"\r\n [itemsPerPage]=\"itemsPerPage$ | async\"\r\n [totalItems]=\"totalItems$ | async\"\r\n [currentPage]=\"currentPage$ | async\"\r\n (pageChange)=\"setPageNumber($event)\"\r\n (itemsPerPageChange)=\"setItemsPerPage($event)\"\r\n>\r\n <vdr-dt-column>{{ 'common.name' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'marketing.coupon-code' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'marketing.starts-at' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'marketing.ends-at' | translate }}</vdr-dt-column>\r\n <vdr-dt-column></vdr-dt-column>\r\n <vdr-dt-column></vdr-dt-column>\r\n <vdr-dt-column></vdr-dt-column>\r\n <ng-template let-promotion=\"item\">\r\n <td class=\"left align-middle\">{{ promotion.name }}</td>\r\n <td class=\"left align-middle\">\r\n <vdr-chip *ngIf=\"promotion.couponCode\">\r\n {{ promotion.couponCode }}\r\n </vdr-chip>\r\n </td>\r\n <td class=\"left align-middle\">{{ promotion.startsAt | localeDate: 'longDate' }}</td>\r\n <td class=\"left align-middle\">{{ promotion.endsAt | localeDate: 'longDate' }}</td>\r\n <td class=\"align-middle\">\r\n <vdr-chip *ngIf=\"!promotion.enabled\">{{ 'common.disabled' | translate }}</vdr-chip>\r\n </td>\r\n <td class=\"right align-middle\">\r\n <vdr-table-row-action\r\n iconShape=\"edit\"\r\n [label]=\"'common.edit' | translate\"\r\n [linkTo]=\"['./', promotion.id]\"\r\n ></vdr-table-row-action>\r\n </td>\r\n <td class=\"right align-middle\">\r\n <vdr-dropdown>\r\n <button type=\"button\" class=\"btn btn-link btn-sm\" vdrDropdownTrigger>\r\n {{ 'common.actions' | translate }}\r\n <clr-icon shape=\"caret down\"></clr-icon>\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\r\n <button\r\n type=\"button\"\r\n class=\"delete-button\"\r\n (click)=\"deletePromotion(promotion.id)\"\r\n [disabled]=\"!('DeletePromotion' | hasPermission)\"\r\n vdrDropdownItem\r\n >\r\n <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\r\n {{ 'common.delete' | translate }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </td>\r\n </ng-template>\r\n</vdr-data-table>\r\n","import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';\r\nimport { FormControl, FormGroup } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';\r\nimport {\r\n BaseListComponent,\r\n DataService,\r\n GetPromotionListQuery,\r\n ItemOf,\r\n ModalService,\r\n NotificationService,\r\n PromotionFilterParameter,\r\n PromotionListOptions,\r\n} from '@vendure/admin-ui/core';\r\nimport { EMPTY, merge } from 'rxjs';\r\nimport { debounceTime, switchMap, takeUntil } from 'rxjs/operators';\r\n\r\nexport type PromotionSearchForm = {\r\n name: string;\r\n couponCode: string;\r\n};\r\n\r\n@Component({\r\n selector: 'vdr-promotion-list',\r\n templateUrl: './promotion-list.component.html',\r\n styleUrls: ['./promotion-list.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class PromotionListComponent\r\n extends BaseListComponent<GetPromotionListQuery, ItemOf<GetPromotionListQuery, 'promotions'>>\r\n implements OnInit\r\n{\r\n searchForm = new FormGroup({\r\n name: new FormControl(''),\r\n couponCode: new FormControl(''),\r\n });\r\n\r\n constructor(\r\n private dataService: DataService,\r\n router: Router,\r\n route: ActivatedRoute,\r\n private notificationService: NotificationService,\r\n private modalService: ModalService,\r\n ) {\r\n super(router, route);\r\n super.setQueryFn(\r\n (...args: any[]) => this.dataService.promotion.getPromotions(...args).refetchOnChannelChange(),\r\n data => data.promotions,\r\n (skip, take) => this.createQueryOptions(skip, take, this.searchForm.value),\r\n );\r\n }\r\n\r\n ngOnInit(): void {\r\n super.ngOnInit();\r\n\r\n merge(this.searchForm.valueChanges.pipe(debounceTime(250)), this.route.queryParamMap)\r\n .pipe(takeUntil(this.destroy$))\r\n .subscribe(val => {\r\n if (!val.params) {\r\n this.setPageNumber(1);\r\n }\r\n this.refresh();\r\n });\r\n }\r\n\r\n deletePromotion(promotionId: string) {\r\n this.modalService\r\n .dialog({\r\n title: _('catalog.confirm-delete-promotion'),\r\n buttons: [\r\n { type: 'secondary', label: _('common.cancel') },\r\n { type: 'danger', label: _('common.delete'), returnValue: true },\r\n ],\r\n })\r\n .pipe(\r\n switchMap(response =>\r\n response ? this.dataService.promotion.deletePromotion(promotionId) : EMPTY,\r\n ),\r\n )\r\n .subscribe(\r\n () => {\r\n this.notificationService.success(_('common.notify-delete-success'), {\r\n entity: 'Promotion',\r\n });\r\n this.refresh();\r\n },\r\n err => {\r\n this.notificationService.error(_('common.notify-delete-error'), {\r\n entity: 'Promotion',\r\n });\r\n },\r\n );\r\n }\r\n\r\n private createQueryOptions(\r\n skip: number,\r\n take: number,\r\n searchForm: PromotionSearchForm,\r\n ): { options: PromotionListOptions } {\r\n const filter: PromotionFilterParameter = {};\r\n\r\n if (searchForm.couponCode) {\r\n filter.couponCode = { contains: searchForm.couponCode };\r\n }\r\n\r\n if (searchForm.name) {\r\n filter.name = { contains: searchForm.name };\r\n }\r\n\r\n return {\r\n options: {\r\n skip,\r\n take,\r\n filter,\r\n },\r\n };\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { BaseEntityResolver, DataService, PromotionFragment } from '@vendure/admin-ui/core';\r\n\r\n/**\r\n * Resolves the id from the path into a Customer entity.\r\n */\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class PromotionResolver extends BaseEntityResolver<PromotionFragment> {\r\n constructor(router: Router, dataService: DataService) {\r\n super(\r\n router,\r\n {\r\n __typename: 'Promotion',\r\n id: '',\r\n createdAt: '',\r\n updatedAt: '',\r\n name: '',\r\n enabled: false,\r\n conditions: [],\r\n actions: [],\r\n },\r\n id => dataService.promotion.getPromotion(id).mapStream(data => data.promotion),\r\n );\r\n }\r\n}\r\n","import { Route } from '@angular/router';\r\nimport { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';\r\nimport {\r\n CanDeactivateDetailGuard,\r\n createResolveData,\r\n detailBreadcrumb,\r\n PromotionFragment,\r\n} from '@vendure/admin-ui/core';\r\n\r\nimport { PromotionDetailComponent } from './components/promotion-detail/promotion-detail.component';\r\nimport { PromotionListComponent } from './components/promotion-list/promotion-list.component';\r\nimport { PromotionResolver } from './providers/routing/promotion-resolver';\r\n\r\nexport const marketingRoutes: Route[] = [\r\n {\r\n path: 'promotions',\r\n component: PromotionListComponent,\r\n data: {\r\n breadcrumb: _('breadcrumb.promotions'),\r\n },\r\n },\r\n {\r\n path: 'promotions/:id',\r\n component: PromotionDetailComponent,\r\n resolve: createResolveData(PromotionResolver),\r\n canDeactivate: [CanDeactivateDetailGuard],\r\n data: {\r\n breadcrumb: promotionBreadcrumb,\r\n },\r\n },\r\n];\r\n\r\nexport function promotionBreadcrumb(data: any, params: any) {\r\n return detailBreadcrumb<PromotionFragment>({\r\n entity: data.entity,\r\n id: params.id,\r\n breadcrumbKey: 'breadcrumb.promotions',\r\n getName: promotion => promotion.name,\r\n route: 'promotions',\r\n });\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { RouterModule } from '@angular/router';\r\nimport { SharedModule } from '@vendure/admin-ui/core';\r\n\r\nimport { PromotionDetailComponent } from './components/promotion-detail/promotion-detail.component';\r\nimport { PromotionListComponent } from './components/promotion-list/promotion-list.component';\r\nimport { marketingRoutes } from './marketing.routes';\r\n\r\n@NgModule({\r\n imports: [SharedModule, RouterModule.forChild(marketingRoutes)],\r\n declarations: [PromotionListComponent, PromotionDetailComponent],\r\n})\r\nexport class MarketingModule {}\r\n"],"sourceRoot":"webpack:///","file":"239.a68e402e10b798f1.js"}
|