Socket
Socket
Sign inDemoInstall

@ribajs/shopify

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ribajs/shopify - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

25

package.json
{
"name": "@ribajs/shopify",
"description": "Shopify extension for Riba.js",
"version": "1.5.0",
"version": "1.6.0",
"author": "Pascal Garber <pascal@artandcode.studio>",

@@ -41,12 +41,11 @@ "contributors": [],

"devDependencies": {
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/cli": "^7.7.0",
"@babel/core": "^7.7.2",
"@babel/plugin-proposal-class-properties": "^7.7.0",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/plugin-transform-runtime": "^7.6.2",
"@babel/preset-env": "^7.6.3",
"@babel/preset-typescript": "^7.6.0",
"@types/jest": "^24.0.21",
"@types/jquery": "^3.3.31",
"@types/node": "^12.12.5",
"@babel/preset-env": "^7.7.1",
"@babel/preset-typescript": "^7.7.2",
"@types/jest": "^24.0.22",
"@types/node": "^12.12.7",
"babel-loader": "^8.0.6",

@@ -57,4 +56,4 @@ "babel-plugin-array-includes": "^2.0.3",

"ts-jest": "^24.1.0",
"tslint": "^5.20.0",
"typescript": "^3.6.4",
"tslint": "^5.20.1",
"typescript": "^3.7.2",
"webpack": "^4.41.2",

@@ -64,5 +63,5 @@ "webpack-cli": "^3.3.10"

"dependencies": {
"@ribajs/core": "^1.5.0",
"@ribajs/i18n": "^1.5.0"
"@ribajs/core": "^1.6.0",
"@ribajs/i18n": "^1.6.0"
}
}

@@ -6,3 +6,3 @@ # Shopify Module

```bash
npm install --save-dev @ribajs/shopify
npm install --save @ribajs/shopify
```

@@ -9,0 +9,0 @@

@@ -1,2 +0,2 @@

import { IBinder, Utils } from '@ribajs/core';
import { Binder, Utils } from '@ribajs/core';
import { imgUrlFormatter } from '../formatters/img-url.formatter';

@@ -13,3 +13,3 @@ import './ResizeObserver.d';

*/
export const shopifyImgBinder: IBinder<string> = {
export const shopifyImgBinder: Binder<string> = {
name: 'shopify-img',

@@ -16,0 +16,0 @@ bind(el) {

@@ -1,2 +0,2 @@

export * from './shopify-section.component';
// export * from './shopify-section.component';
export * from './shopify-linklist/shopify-linklist.component';

@@ -1,2 +0,2 @@

import { Component, Debug, EventDispatcher } from '@ribajs/core';
import { Component, EventDispatcher } from '@ribajs/core';
import template from './shopify-linklist.component.html';

@@ -53,3 +53,3 @@

export interface IState {
export interface State {
url: string;

@@ -66,4 +66,2 @@ namespace?: string;

protected debug = Debug('component:' + ShopifyLinklistComponent.tagName);
protected mainDispatcher = new EventDispatcher('main');

@@ -98,3 +96,2 @@

public toggle(link: LinklistLink) {
this.debug('toggle', link);
link.collapsed = !link.collapsed;

@@ -104,3 +101,2 @@ }

public collapse(link: LinklistLink) {
this.debug('collapse', link);
link.collapsed = true;

@@ -110,3 +106,2 @@ }

public show(link: LinklistLink) {
this.debug('show', link);
link.collapsed = false;

@@ -116,3 +111,2 @@ }

public showAll() {
this.debug('showAll');
if (this.scope.linklist) {

@@ -124,3 +118,2 @@ this.showAllByLinks(this.scope.linklist.links);

public collapseAll() {
this.debug('collapseAll');
if (this.scope.linklist && this.scope.linklist.links) {

@@ -205,5 +198,4 @@ this.collapseAllByLinks(this.scope.linklist.links);

protected onNewPageReady(viewId: string, currentStatus: IState, prevStatus: IState, container: HTMLElement, newPageRawHTML: string, dataset: any, isFirstPageLoad: boolean) {
protected onNewPageReady(viewId: string, currentStatus: State, prevStatus: State, container: HTMLElement, newPageRawHTML: string, dataset: any, isFirstPageLoad: boolean) {
const url = currentStatus.url;
this.debug('[ShopifyLinklistComponent] onNewPageReady', url);
if (this.scope.collapseOnNewPage) {

@@ -210,0 +202,0 @@ this.collapseAll();

@@ -1,2 +0,2 @@

import { Debug, Component } from '@ribajs/core';
import { Component } from '@ribajs/core';

@@ -7,4 +7,2 @@ export abstract class ShopifySectionComponent extends Component {

protected debug = Debug('component:' + ShopifySectionComponent.tagName);
protected abstract scope: any;

@@ -34,29 +32,29 @@

protected onSectionLoad(event: Event) {
this.debug('onSectionLoad', event);
console.debug('onSectionLoad', event);
}
protected onSectionUnload(event: Event) {
this.debug('onSectionUnload', event);
console.debug('onSectionUnload', event);
}
protected onSectionSelect(event: Event) {
this.debug('onSectionSelect', event);
console.debug('onSectionSelect', event);
}
protected onSectionDeselect(event: Event) {
this.debug('onSectionDeselect', event);
console.debug('onSectionDeselect', event);
}
protected onSectionReorder(event: Event) {
this.debug('onSectionReorder', event);
console.debug('onSectionReorder', event);
}
protected onBlockSelect(event: Event) {
this.debug('onBlockSelect', event);
console.debug('onBlockSelect', event);
}
protected onBlockDeselect(event: Event) {
this.debug('onBlockDeselect', event);
console.debug('onBlockDeselect', event);
}
}

@@ -1,2 +0,2 @@

import { IFormatter } from '@ribajs/core';
import { Formatter } from '@ribajs/core';

@@ -13,3 +13,3 @@ /**

*/
export const imgUrlFormatter: IFormatter = {
export const imgUrlFormatter: Formatter = {
name: 'img_url',

@@ -16,0 +16,0 @@ read(url: string, size: string, scale?: number, crop?: string, extension?: string, element?: HTMLImageElement) {

@@ -1,2 +0,2 @@

import { IFormatter } from '@ribajs/core';
import { Formatter } from '@ribajs/core';
import { moneyFormatter } from './money.formatter';

@@ -9,3 +9,3 @@ import { ShopifyService } from '../services/shopify.service';

*/
export const moneyWithCurrencyFormatter: IFormatter = {
export const moneyWithCurrencyFormatter: Formatter = {
name: 'money_with_currency',

@@ -12,0 +12,0 @@ read(cents: string | number, format?: string) {

@@ -1,2 +0,2 @@

import { IFormatter } from '@ribajs/core';
import { Formatter } from '@ribajs/core';
import { ShopifyService } from '../services/shopify.service';

@@ -14,3 +14,3 @@

*/
export const moneyFormatter: IFormatter = {
export const moneyFormatter: Formatter = {
name: 'money',

@@ -17,0 +17,0 @@ read(cents: string | number, format?: string) {

@@ -6,3 +6,3 @@ /**

*/
export interface IShopifyCustomerAddress {
export interface ShopifyCustomerAddress {
/** Returns the value of the Address1 field of the address. */

@@ -9,0 +9,0 @@ address1: string;

@@ -1,6 +0,6 @@

export interface IShopifyCartObject {
export interface ShopifyCartObject {
attributes: any;
currency: string;
item_count: number;
items: IShopifyCartLineItem[];
items: ShopifyCartLineItem[];
note: string | null;

@@ -15,7 +15,7 @@ original_total_price: number;

export interface IShopifyCartUpdateProperty {
export interface ShopifyCartUpdateProperty {
[variantId: number]: number;
}
export interface IShopifyCartAddError {
export interface ShopifyCartAddError {
status: number;

@@ -26,3 +26,3 @@ message: string;

export interface IShopifyCartLineItem {
export interface ShopifyCartLineItem {
id: number;

@@ -29,0 +29,0 @@ title: string;

@@ -1,2 +0,2 @@

export interface IClientTheme {
export interface ClientTheme {
handle: 'null';

@@ -3,0 +3,0 @@ id: number;

@@ -1,3 +0,3 @@

import { IShopifyCustomerAddress } from './address';
import { IShopifyOrder } from './order';
import { ShopifyCustomerAddress } from './address';
import { ShopifyOrder } from './order';

@@ -9,11 +9,11 @@ /**

*/
export interface IShopifyCustomer {
export interface ShopifyCustomer {
/** Returns `true` if the customer accepts marketing, returns `false` if the customer does not. */
accepts_marketing: boolean;
/** Returns an array of all addresses associated with a customer. See customer_address for a full list of available attributes. */
addresses: IShopifyCustomerAddress[];
addresses: ShopifyCustomerAddress[];
/** Returns the number of addresses associated with a customer. */
addresses_count: number;
/** Returns the default customer_address. */
default_address: IShopifyCustomerAddress | null;
default_address: ShopifyCustomerAddress | null;
/** Returns the email address of the customer. */

@@ -34,7 +34,7 @@ email: string;

/** Returns the last order placed by the customer, not including test orders. */
last_order: IShopifyOrder;
last_order: ShopifyOrder;
/** Returns the full name of the customer. */
name: string;
/** Returns an array of all orders placed by the customer. */
orders: IShopifyOrder[];
orders: ShopifyOrder[];
/** Returns the total number of orders a customer has placed. */

@@ -41,0 +41,0 @@ orders_count: number;

@@ -6,2 +6,2 @@ /**

*/
export type IShopifyDiscount = any; // TODO
export type ShopifyDiscount = any; // TODO

@@ -1,2 +0,2 @@

export declare interface IShopifyImage {
export declare interface ShopifyImage {
alt: string;

@@ -3,0 +3,0 @@ created_at: Date;

@@ -1,2 +0,2 @@

export declare interface IShopifyMetafield {
export declare interface ShopifyMetafield {
key: string;

@@ -3,0 +3,0 @@ value: string;

@@ -1,5 +0,5 @@

import { IShopifyCustomer } from './customer.';
import { IShopifyDiscount } from './discount';
import { ShopifyCustomer } from './customer.';
import { ShopifyDiscount } from './discount';
export interface IShopifyOrderCustomAttributes {
export interface ShopifyOrderCustomAttributes {
[key: string]: string;

@@ -13,4 +13,4 @@ }

*/
export interface IShopifyOrder {
attributes: IShopifyOrderCustomAttributes;
export interface ShopifyOrder {
attributes: ShopifyOrderCustomAttributes;
/** Returns `true` if an order is canceled, or `false` if it is not. */

@@ -33,7 +33,7 @@ cancelled: boolean;

/** Returns the customer associated with the order. */
customer: IShopifyCustomer;
customer: ShopifyCustomer;
/** Returns a unique URL that the customer can use to access the order. */
customer_url: string;
/** Returns an array of discounts for an order. */
discounts: IShopifyDiscount;
discounts: ShopifyDiscount;
/** Returns the email address associated with an order, if it exists. */

@@ -40,0 +40,0 @@ email: string;

@@ -1,4 +0,4 @@

import { IShopifyImage } from './image';
import { ShopifyImage } from './image';
export declare interface IShopifyProductImage extends IShopifyImage {
export declare interface ShopifyProductImage extends ShopifyImage {
position: number;

@@ -9,3 +9,3 @@ product_id: number;

export declare enum IShopifyProductWeightUnit {
export declare enum ShopifyProductWeightUnit {
GRAMS = 'g',

@@ -17,7 +17,7 @@ KILOGRAMS = 'kg',

export declare interface IShopifyProductVariant {
export declare interface ShopifyProductVariant {
available: boolean;
barcode: string;
compare_at_price: number | null;
featured_image: IShopifyProductImage | null;
featured_image: ShopifyProductImage | null;
created_at: Date;

@@ -42,6 +42,6 @@ fulfillment_service?: string;

weight: number;
weight_unit?: IShopifyProductWeightUnit; // TODO
weight_unit?: ShopifyProductWeightUnit; // TODO
}
export declare interface IShopifyProductVariantOption {
export declare interface ShopifyProductVariantOption {
name: string;

@@ -52,3 +52,3 @@ position: number;

export declare interface IShopifyProduct {
export declare interface ShopifyProduct {
available: boolean;

@@ -65,3 +65,3 @@ compare_at_price: number | null;

images: string[];
options: IShopifyProductVariantOption[];
options: ShopifyProductVariantOption[];
price: number;

@@ -77,4 +77,4 @@ price_max: number;

url: string;
variants: IShopifyProductVariant[];
variants: ShopifyProductVariant[];
vendor: string;
}

@@ -5,3 +5,3 @@ /**

*/
export interface IShopifyShippingRate {
export interface ShopifyShippingRate {
name: string;

@@ -17,3 +17,3 @@ price: string;

*/
export type IShopifyShippingRates = IShopifyShippingRate[];
export type ShopifyShippingRates = ShopifyShippingRate[];

@@ -23,3 +23,3 @@ /**

*/
export interface IShopifyShippingRateNormalized {
export interface ShopifyShippingRateNormalized {
name: string;

@@ -34,2 +34,2 @@ price: number;

*/
export type IShopifyShippingRatesNormalized = IShopifyShippingRateNormalized[];
export type ShopifyShippingRatesNormalized = ShopifyShippingRateNormalized[];

@@ -1,15 +0,15 @@

import { Debug, Utils, EventDispatcher } from '@ribajs/core';
import { Utils, EventDispatcher } from '@ribajs/core';
import { PQueue } from './p-queue.service'; // https://github.com/sindresorhus/p-queue
import {
IShopifyCartLineItem,
IShopifyCartUpdateProperty,
IShopifyCartAddError,
IShopifyCartObject,
IShopifyCustomerAddress,
IShopifyShippingRates,
IShopifyShippingRatesNormalized,
ShopifyCartLineItem,
ShopifyCartUpdateProperty,
ShopifyCartAddError,
ShopifyCartObject,
ShopifyCustomerAddress,
ShopifyShippingRates,
ShopifyShippingRatesNormalized,
} from '../interfaces';
export interface IShopifyCartRequestOptions {
export interface ShopifyCartRequestOptions {
triggerOnStart: boolean;

@@ -24,3 +24,3 @@ triggerOnComplete: boolean;

public static cart: IShopifyCartObject | null = null;
public static cart: ShopifyCartObject | null = null;

@@ -37,3 +37,3 @@ public static shopifyCartEventDispatcher = new EventDispatcher('ShopifyCart');

*/
public static add(id: number, quantity = 1, properties = {}, options: IShopifyCartRequestOptions = this.requestOptionDefaults): Promise<IShopifyCartLineItem | IShopifyCartAddError> {
public static add(id: number, quantity = 1, properties = {}, options: ShopifyCartRequestOptions = this.requestOptionDefaults): Promise<ShopifyCartLineItem | ShopifyCartAddError> {
if (options.triggerOnStart) {

@@ -48,6 +48,6 @@ this.triggerOnStart();

}, 'json')
.then((lineItem: IShopifyCartLineItem) => {
.then((lineItem: ShopifyCartLineItem) => {
// Force update cart object
return Utils.get(this.CART_GET_URL, {}, 'json')
.then((cart: IShopifyCartObject) => {
.then((cart: ShopifyCartObject) => {
if (options.triggerOnChange) {

@@ -61,3 +61,3 @@ this.triggerOnChange(cart);

.catch((jqxhr: any) => {
return jqxhr.responseJSON as IShopifyCartAddError;
return jqxhr.responseJSON as ShopifyCartAddError;
});

@@ -71,3 +71,3 @@ });

public static _get(): Promise<IShopifyCartObject> {
public static _get(): Promise<ShopifyCartObject> {
if (ShopifyCartService.cart !== null) {

@@ -85,3 +85,3 @@ return new Promise((resolve, reject) => {

return Utils.get(this.CART_GET_URL, {}, 'json')
.then((cart: IShopifyCartObject) => {
.then((cart: ShopifyCartObject) => {
ShopifyCartService.cart = cart;

@@ -98,3 +98,3 @@ return cart;

*/
public static get(options: IShopifyCartRequestOptions = this.requestOptionDefaults): Promise<IShopifyCartObject> {
public static get(options: ShopifyCartRequestOptions = this.requestOptionDefaults): Promise<ShopifyCartObject> {
if (options.triggerOnStart) {

@@ -120,3 +120,3 @@ this.triggerOnStart();

*/
public static update(id: number | number, quantity: number, properties = {}, options: IShopifyCartRequestOptions = this.requestOptionDefaults): Promise<IShopifyCartObject> {
public static update(id: number | number, quantity: number, properties = {}, options: ShopifyCartRequestOptions = this.requestOptionDefaults): Promise<ShopifyCartObject> {
if (options.triggerOnStart) {

@@ -132,3 +132,3 @@ this.triggerOnStart();

})
.then((cart: IShopifyCartObject) => {
.then((cart: ShopifyCartObject) => {
if (options.triggerOnChange) {

@@ -153,3 +153,3 @@ this.triggerOnChange(cart);

*/
public static updates(updates: IShopifyCartUpdateProperty | Array<number>, options: IShopifyCartRequestOptions = this.requestOptionDefaults): Promise<IShopifyCartObject> {
public static updates(updates: ShopifyCartUpdateProperty | Array<number>, options: ShopifyCartRequestOptions = this.requestOptionDefaults): Promise<ShopifyCartObject> {
if (options.triggerOnStart) {

@@ -163,3 +163,3 @@ this.triggerOnStart();

})
.then((cart: IShopifyCartObject) => {
.then((cart: ShopifyCartObject) => {
if (options.triggerOnChange) {

@@ -196,3 +196,3 @@ this.triggerOnChange(cart);

*/
public static change(id: number | number, quantity: number, properties = {}, options: IShopifyCartRequestOptions = this.requestOptionDefaults): Promise<IShopifyCartObject> {
public static change(id: number | number, quantity: number, properties = {}, options: ShopifyCartRequestOptions = this.requestOptionDefaults): Promise<ShopifyCartObject> {
if (options.triggerOnStart) {

@@ -207,3 +207,3 @@ this.triggerOnStart();

}, 'json')
.then((cart: IShopifyCartObject) => {
.then((cart: ShopifyCartObject) => {
if (options.triggerOnChange) {

@@ -228,3 +228,3 @@ this.triggerOnChange(cart);

*/
public static changeLine(line: string | number, quantity: number, properties = {}, options: IShopifyCartRequestOptions = this.requestOptionDefaults): Promise<IShopifyCartObject> {
public static changeLine(line: string | number, quantity: number, properties = {}, options: ShopifyCartRequestOptions = this.requestOptionDefaults): Promise<ShopifyCartObject> {
if (options.triggerOnStart) {

@@ -239,3 +239,3 @@ this.triggerOnStart();

}, 'json')
.then((cart: IShopifyCartObject) => {
.then((cart: ShopifyCartObject) => {
if (options.triggerOnChange) {

@@ -250,3 +250,3 @@ this.triggerOnChange(cart);

}
return promise as Promise<IShopifyCartObject>;
return promise as Promise<ShopifyCartObject>;
}

@@ -260,3 +260,3 @@

*/
public static clear(options: IShopifyCartRequestOptions = this.requestOptionDefaults): Promise<IShopifyCartObject> {
public static clear(options: ShopifyCartRequestOptions = this.requestOptionDefaults): Promise<ShopifyCartObject> {
if (options.triggerOnStart) {

@@ -267,3 +267,3 @@ this.triggerOnStart();

return Utils.post(this.CART_POST_CLEAR_URL, {}, 'json')
.then((cart: IShopifyCartObject) => {
.then((cart: ShopifyCartObject) => {
if (options.triggerOnChange) {

@@ -281,11 +281,10 @@ this.triggerOnChange(cart);

public static _getShippingRates(shippingAddress: IShopifyCustomerAddress, normalize: boolean = true): Promise<IShopifyShippingRates | IShopifyShippingRatesNormalized> {
public static _getShippingRates(shippingAddress: ShopifyCustomerAddress, normalize: boolean = true): Promise<ShopifyShippingRates | ShopifyShippingRatesNormalized> {
return Utils.get(this.CART_GET_SHIPPING_RATES_URL, { shipping_address: shippingAddress }, 'json')
.then((shippingRates: any) => {
if (Utils.isObject(shippingRates) && Utils.isObject(shippingRates.shipping_rates)) {
this.debug('getShippingRates result', shippingRates.shipping_rates);
if (normalize) {
return this.normalizeShippingRates(shippingRates.shipping_rates);
}
return shippingRates.shipping_rates as IShopifyShippingRates;
return shippingRates.shipping_rates as ShopifyShippingRates;
} else {

@@ -302,3 +301,3 @@ throw new Error('shipping_rates property not found: ' + JSON.stringify(shippingRates));

*/
public static getShippingRates(shippingAddress: IShopifyCustomerAddress, normalize: boolean = true, options: IShopifyCartRequestOptions = this.requestOptionDefaults): Promise<IShopifyShippingRates | IShopifyShippingRatesNormalized> {
public static getShippingRates(shippingAddress: ShopifyCustomerAddress, normalize: boolean = true, options: ShopifyCartRequestOptions = this.requestOptionDefaults): Promise<ShopifyShippingRates | ShopifyShippingRatesNormalized> {
if (options.triggerOnStart) {

@@ -316,4 +315,2 @@ this.triggerOnStart();

protected static debug = Debug('ShopifyExtension:ShopifyCartService');
protected static CART_POST_ADD_URL = '/cart/add.js';

@@ -358,3 +355,3 @@

*/
protected static triggerOnChange(cart: IShopifyCartObject) {
protected static triggerOnChange(cart: ShopifyCartObject) {
this.cart = cart;

@@ -381,3 +378,3 @@ ShopifyCartService.shopifyCartEventDispatcher.trigger('ShopifyCart:request:changed', this.cart);

protected static normalizeShippingRates(shippingRates: IShopifyShippingRates): IShopifyShippingRatesNormalized {
protected static normalizeShippingRates(shippingRates: ShopifyShippingRates): ShopifyShippingRatesNormalized {
const normalized = new Array<any>(shippingRates.length);

@@ -387,3 +384,3 @@ for (const i in shippingRates) {

const shippingRate = shippingRates[i];
normalized[i] = Utils.clone(false, shippingRate) as IShopifyShippingRates;
normalized[i] = Utils.clone(false, shippingRate) as ShopifyShippingRates;
if (normalized[i] && normalized[i].price) {

@@ -394,11 +391,11 @@ normalized[i].price = Utils.getNumber(normalized[i].price);

} else {
this.debug(`Can't parse "${normalized[i].price}" to number`);
console.warn(`Can't parse "${normalized[i].price}" to number`);
}
} else {
this.debug(`price property not defined`, normalized[i]);
console.warn(`price property not defined`, normalized[i]);
}
}
}
return normalized as IShopifyShippingRatesNormalized;
return normalized as ShopifyShippingRatesNormalized;
}
}

@@ -1,10 +0,10 @@

import { Debug, Utils } from '@ribajs/core';
import { Utils } from '@ribajs/core';
import {
IShopifyProduct,
IShopifyProductVariant,
ShopifyProduct,
ShopifyProductVariant,
} from '../interfaces';
export interface IProductsCache {
[handle: string]: IShopifyProduct;
export interface ProductsCache {
[handle: string]: ShopifyProduct;
}

@@ -18,3 +18,3 @@

*/
public static get(handle: string): Promise<IShopifyProduct> {
public static get(handle: string): Promise<ShopifyProduct> {
if (this.cache.hasOwnProperty(handle)) {

@@ -26,3 +26,3 @@ return new Promise((resolve) => {

return Utils.getJSON(`/products/${handle}.js`)
.then((product: IShopifyProduct) => {
.then((product: ShopifyProduct) => {
this.cache[handle] = product;

@@ -40,3 +40,3 @@ return this.cache[handle];

*/
public static fitsVariantOptions(variant: IShopifyProductVariant, optionValues: string[]) {
public static fitsVariantOptions(variant: ShopifyProductVariant, optionValues: string[]) {
let fit = true;

@@ -57,4 +57,4 @@ // position0 is the option index starting on 0

*/
public static getVariantOfOptions(product: IShopifyProduct, optionValues: string[]) {
let result: IShopifyProductVariant | null = null;
public static getVariantOfOptions(product: ShopifyProduct, optionValues: string[]) {
let result: ShopifyProductVariant | null = null;
if (product) {

@@ -73,3 +73,2 @@ for (const i in product.variants) {

}
this.debug('getVariantOfOptions optionValues', optionValues, 'variant', result);
return result;

@@ -82,6 +81,6 @@ }

*/
public static getVariant(product: IShopifyProduct, id: number) {
public static getVariant(product: ShopifyProduct, id: number) {
let result = null;
if (product) {
product.variants.forEach((variant: IShopifyProductVariant) => {
product.variants.forEach((variant: ShopifyProductVariant) => {
if (variant.id === id) {

@@ -92,3 +91,2 @@ result = variant;

}
this.debug('getVariant', result);
return result;

@@ -102,3 +100,3 @@ }

*/
public static getOption(product: IShopifyProduct, name: string) {
public static getOption(product: ShopifyProduct, name: string) {
let result = null;

@@ -117,3 +115,3 @@ product.options.forEach((option) => {

*/
public static prepair(product: IShopifyProduct) {
public static prepair(product: ShopifyProduct) {
// remove protocol

@@ -131,6 +129,4 @@ product.featured_image

protected static debug = Debug('ShopifyExtension:ShopifyProductService');
protected static cache: ProductsCache = {};
protected static cache: IProductsCache = {};
}

@@ -1,8 +0,3 @@

import { Debug, Utils } from '@ribajs/core';
import { Utils } from '@ribajs/core';
// declare global {
// // tslint:disable: interface-name
// interface Window { model: any; }
// }
/**

@@ -46,12 +41,6 @@ * Custom version of shopify tools like api.jquery.js / option-selection.js

private debug = Debug('service:ShopifyService');
constructor(shopSettings?: any) {
if (ShopifyService.instance) {
return ShopifyService.instance;
}
this.debug('shop settings', this.moneyFormat);
ShopifyService.instance = this;

@@ -58,0 +47,0 @@ }

@@ -1,2 +0,2 @@

import { IRibaModule } from '@ribajs/core';
import { RibaModule } from '@ribajs/core';
import * as binders from './binders';

@@ -7,3 +7,3 @@ import * as components from './components';

export const shopifyModule = <IRibaModule> {
export const shopifyModule: RibaModule = {
binders,

@@ -10,0 +10,0 @@ formatters,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc