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 0.16.2 to 0.16.3

babel.config.js

5

lib/components/shopify-section.component.d.ts

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

import { Debug, RibaComponent } from '@ribajs/core';
import { RibaComponent, JQuery } from '@ribajs/core';
export declare abstract class ShopifySectionComponent extends RibaComponent {
static tagName: string;
protected debug: Debug.IDebugger;
protected debug: any;
protected $el: JQuery<HTMLElement>;

@@ -9,3 +9,2 @@ protected abstract scope: any;

protected abstract template(): string | null;
/**

@@ -12,0 +11,0 @@ * A section has been added or re-rendered.

86

lib/components/shopify-section.component.js

@@ -1,44 +0,44 @@

import { Debug, RibaComponent, JQuery } from '@ribajs/core';
export class ShopifySectionComponent {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@ribajs/core");
class ShopifySectionComponent extends core_1.RibaComponent {
constructor(element) {
super(element);
this.debug = core_1.Debug('component:' + ShopifySectionComponent.tagName);
this.$el = core_1.JQuery(this.el);
this.$el.on('shopify:section:load', this.onSectionLoad);
this.$el.on('shopify:section:unload', this.onSectionUnload);
this.$el.on('shopify:section:select', this.onSectionSelect);
this.$el.on('shopify:section:deselect', this.onSectionDeselect);
this.$el.on('shopify:section:reorder', this.onSectionReorder);
this.$el.on('shopify:block:select', this.onBlockSelect);
this.$el.on('shopify:block:deselect', this.onBlockDeselect);
}
/**
* A section has been added or re-rendered.
* Re-execute any JavaScript needed for the section to work and display properly (as if the page had just been loaded).
*/
onSectionLoad(event, data) {
this.debug('onSectionLoad', data);
}
onSectionUnload(event, data) {
this.debug('onSectionUnload', data);
}
onSectionSelect(event, data) {
this.debug('onSectionSelect', data);
}
onSectionDeselect(event, data) {
this.debug('onSectionDeselect', data);
}
onSectionReorder(event, data) {
this.debug('onSectionReorder', data);
}
onBlockSelect(event, data) {
this.debug('onBlockSelect', data);
}
onBlockDeselect(event, data) {
this.debug('onBlockDeselect', data);
}
}
// export class ShopifySectionComponent extends RibaComponent {
// constructor(element) {
// super(element);
// this.debug = Debug('component:' + ShopifySectionComponent.tagName);
// this.$el = JQuery(this.el);
// this.$el.on('shopify:section:load', this.onSectionLoad);
// this.$el.on('shopify:section:unload', this.onSectionUnload);
// this.$el.on('shopify:section:select', this.onSectionSelect);
// this.$el.on('shopify:section:deselect', this.onSectionDeselect);
// this.$el.on('shopify:section:reorder', this.onSectionReorder);
// this.$el.on('shopify:block:select', this.onBlockSelect);
// this.$el.on('shopify:block:deselect', this.onBlockDeselect);
// }
// /**
// * A section has been added or re-rendered.
// * Re-execute any JavaScript needed for the section to work and display properly (as if the page had just been loaded).
// */
// onSectionLoad(event, data) {
// this.debug('onSectionLoad', data);
// }
// onSectionUnload(event, data) {
// this.debug('onSectionUnload', data);
// }
// onSectionSelect(event, data) {
// this.debug('onSectionSelect', data);
// }
// onSectionDeselect(event, data) {
// this.debug('onSectionDeselect', data);
// }
// onSectionReorder(event, data) {
// this.debug('onSectionReorder', data);
// }
// onBlockSelect(event, data) {
// this.debug('onBlockSelect', data);
// }
// onBlockDeselect(event, data) {
// this.debug('onBlockDeselect', data);
// }
// }
// ShopifySectionComponent.tagName = 'rv-shopify-section';
ShopifySectionComponent.tagName = 'rv-shopify-section';
exports.ShopifySectionComponent = ShopifySectionComponent;

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

export * from './shopify-section.component';
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./shopify-section.component"));

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

"use strict";
/* tslint:disable:variable-name */
import { ShopifyService } from '../services/shopify.service';
Object.defineProperty(exports, "__esModule", { value: true });
const shopify_service_1 = require("../services/shopify.service");
/**

@@ -13,2 +15,2 @@ * Return a resized shopify image URL

*/
export const img_url = ShopifyService.resizeImage;
exports.img_url = shopify_service_1.ShopifyService.resizeImage;

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

"use strict";
/* tslint:disable:variable-name */
import { ShopifyService } from '../services/shopify.service';
const shopifyService = new ShopifyService();
Object.defineProperty(exports, "__esModule", { value: true });
const shopify_service_1 = require("../services/shopify.service");
const shopifyService = new shopify_service_1.ShopifyService();
/**

@@ -8,2 +10,2 @@ * Formats the price based on the shop's HTML with currency setting (if the format is not overwritten by passing a format parameter).

*/
export const money_with_currency = shopifyService.formatMoneyWithCurrency;
exports.money_with_currency = shopifyService.formatMoneyWithCurrency;

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

import { ShopifyService } from '../services/shopify.service';
const shopifyService = new ShopifyService();
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const shopify_service_1 = require("../services/shopify.service");
const shopifyService = new shopify_service_1.ShopifyService();
/**

@@ -7,2 +9,2 @@ * Formats the price based on the shop's HTML without currency setting (if the format is not overwritten by passing a format parameter).

*/
export const money = shopifyService.formatMoney;
exports.money = shopifyService.formatMoney;

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

export * from './img-url.formatter';
export * from './money.formatter';
export * from './money-with-currency.formatter';
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./img-url.formatter"));
__export(require("./money.formatter"));
__export(require("./money-with-currency.formatter"));

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

export * from './interfaces/interfaces';
import * as components from './components/shopify.components';
import * as formatters from './formatters/shopify.formatters';
import * as services from './services/shopify.services';
export const shopifyExtension = {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./interfaces/interfaces"));
const components = __importStar(require("./components/shopify.components"));
const formatters = __importStar(require("./formatters/shopify.formatters"));
const services = __importStar(require("./services/shopify.services"));
exports.shopifyExtension = {
formatters,

@@ -7,0 +19,0 @@ services,

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

export * from './product';
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./product"));

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

"use strict";
// https://github.com/sindresorhus/p-queue
import { PriorityQueue } from './priority-queue.service';
export class PQueue {
Object.defineProperty(exports, "__esModule", { value: true });
const priority_queue_service_1 = require("./priority-queue.service");
class PQueue {
constructor(options) {
this.queue = new PriorityQueue(); // eslint-disable-line new-cap
this.queue = new priority_queue_service_1.PriorityQueue(); // eslint-disable-line new-cap
this._intervalCount = 0;

@@ -15,3 +17,3 @@ this._intervalEnd = 0;

autoStart: true,
queueClass: PriorityQueue,
queueClass: priority_queue_service_1.PriorityQueue,
}, options);

@@ -80,3 +82,3 @@ if (!(typeof options.concurrency === 'number' && options.concurrency >= 1)) {

clear() {
this.queue = new PriorityQueue();
this.queue = new priority_queue_service_1.PriorityQueue();
}

@@ -200,1 +202,2 @@ onEmpty() {

}
exports.PQueue = PQueue;

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Port of lower_bound from http://en.cppreference.com/w/cpp/algorithm/lower_bound
// Used to compute insertion index to keep queue sorted after insertion
export function lowerBound(array, value, comp) {
function lowerBound(array, value, comp) {
let first = 0;

@@ -19,3 +21,4 @@ let count = array.length;

}
export class PriorityQueue {
exports.lowerBound = lowerBound;
class PriorityQueue {
constructor() {

@@ -43,1 +46,2 @@ this._queue = [];

}
exports.PriorityQueue = PriorityQueue;

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

import { Debug, EventDispatcher } from '@ribajs/core';
import { PQueue } from './p-queue.service';

@@ -12,3 +11,3 @@ import { IShopifyCartLineItem, IShopifyCartUpdateProperty, IShopifyCartAddError, IShopifyCartObject, IShopifyCustomerAddress, IShopifyShippingRates, IShopifyShippingRatesNormalized } from '../interfaces/interfaces';

static cart: IShopifyCartObject | null;
static shopifyCartEventDispatcher: EventDispatcher;
static shopifyCartEventDispatcher: any;
/**

@@ -92,3 +91,3 @@ * Use this to add a variant to the cart.

static getShippingRates(shippingAddress: IShopifyCustomerAddress, normalize?: boolean, options?: IShopifyCartRequestOptions): Promise<IShopifyShippingRates | IShopifyShippingRatesNormalized>;
protected static debug: Debug.IDebugger;
protected static debug: any;
protected static CART_POST_ADD_URL: string;

@@ -95,0 +94,0 @@ protected static CART_GET_URL: string;

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

import { Debug, Utils, EventDispatcher } from '@ribajs/core';
import { PQueue } from './p-queue.service'; // https://github.com/sindresorhus/p-queue
export class ShopifyCartService {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@ribajs/core");
const p_queue_service_1 = require("./p-queue.service"); // https://github.com/sindresorhus/p-queue
class ShopifyCartService {
/**

@@ -17,3 +19,3 @@ * Use this to add a variant to the cart.

const promise = this.queue.add(() => {
return Utils.post(this.CART_POST_ADD_URL, {
return core_1.Utils.post(this.CART_POST_ADD_URL, {
id,

@@ -25,3 +27,3 @@ quantity,

// Force update cart object
return Utils.get(this.CART_GET_URL, {}, 'json')
return core_1.Utils.get(this.CART_GET_URL, {}, 'json')
.then((cart) => {

@@ -56,3 +58,3 @@ if (options.triggerOnChange) {

}
return Utils.get(this.CART_GET_URL, {}, 'json')
return core_1.Utils.get(this.CART_GET_URL, {}, 'json')
.then((cart) => {

@@ -94,3 +96,3 @@ ShopifyCartService.cart = cart;

const promise = this.queue.add(() => {
return Utils.post(this.CART_POST_UPDATE_URL, {
return core_1.Utils.post(this.CART_POST_UPDATE_URL, {
id,

@@ -125,3 +127,3 @@ quantity,

const promise = this.queue.add(() => {
return Utils.post(this.CART_POST_UPDATE_URL, {
return core_1.Utils.post(this.CART_POST_UPDATE_URL, {
updates,

@@ -166,3 +168,3 @@ }, 'json');

const promise = this.queue.add(() => {
return Utils.post(this.CART_POST_CHANGE_URL, {
return core_1.Utils.post(this.CART_POST_CHANGE_URL, {
id,

@@ -196,3 +198,3 @@ quantity,

const promise = this.queue.add(() => {
return Utils.post(this.CART_POST_CHANGE_URL, {
return core_1.Utils.post(this.CART_POST_CHANGE_URL, {
line,

@@ -225,3 +227,3 @@ quantity,

const promise = this.queue.add(() => {
return Utils.post(this.CART_POST_CLEAR_URL, {}, 'json')
return core_1.Utils.post(this.CART_POST_CLEAR_URL, {}, 'json')
.then((cart) => {

@@ -240,5 +242,5 @@ if (options.triggerOnChange) {

static _getShippingRates(shippingAddress, normalize = true) {
return Utils.get(this.CART_GET_SHIPPING_RATES_URL, { shipping_address: shippingAddress }, 'json')
return core_1.Utils.get(this.CART_GET_SHIPPING_RATES_URL, { shipping_address: shippingAddress }, 'json')
.then((shippingRates) => {
if (Utils.isObject(shippingRates) && Utils.isObject(shippingRates.shipping_rates)) {
if (core_1.Utils.isObject(shippingRates) && core_1.Utils.isObject(shippingRates.shipping_rates)) {
this.debug('getShippingRates result', shippingRates.shipping_rates);

@@ -308,5 +310,5 @@ if (normalize) {

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

@@ -327,6 +329,6 @@ normalized[i].price *= 100;

}
ShopifyCartService.queue = new PQueue({ concurrency: 1 });
ShopifyCartService.queue = new p_queue_service_1.PQueue({ concurrency: 1 });
ShopifyCartService.cart = null;
ShopifyCartService.shopifyCartEventDispatcher = new EventDispatcher('ShopifyCart');
ShopifyCartService.debug = Debug('ShopifyExtension:ShopifyCartService');
ShopifyCartService.shopifyCartEventDispatcher = new core_1.EventDispatcher('ShopifyCart');
ShopifyCartService.debug = core_1.Debug('ShopifyExtension:ShopifyCartService');
ShopifyCartService.CART_POST_ADD_URL = '/cart/add.js';

@@ -344,1 +346,2 @@ ShopifyCartService.CART_GET_URL = '/cart.js';

ShopifyCartService.waitForComplete = false;
exports.ShopifyCartService = ShopifyCartService;

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

import { Debug } from '@ribajs/core';
import { IShopifyProduct, IShopifyProductVariant } from '../interfaces/interfaces';

@@ -33,4 +32,4 @@ export interface IProductsCache {

static prepair(product: IShopifyProduct): IShopifyProduct;
protected static debug: Debug.IDebugger;
protected static debug: any;
protected static cache: IProductsCache;
}

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

import { Debug, Utils } from '@ribajs/core';
export class ShopifyProductService {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@ribajs/core");
class ShopifyProductService {
/**

@@ -14,3 +16,3 @@ * Get product object by handle

else {
return Utils.getJSON(`/products/${handle}.js`)
return core_1.Utils.getJSON(`/products/${handle}.js`)
.then((product) => {

@@ -96,3 +98,4 @@ this.cache[handle] = product;

}
ShopifyProductService.debug = Debug('ShopifyExtension:ShopifyProductService');
ShopifyProductService.debug = core_1.Debug('ShopifyExtension:ShopifyProductService');
ShopifyProductService.cache = {};
exports.ShopifyProductService = ShopifyProductService;

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

import { Debug, Utils } from '@ribajs/core';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@ribajs/core");
// declare global {

@@ -10,5 +12,5 @@ // // tslint:disable: interface-name

*/
export class ShopifyService {
class ShopifyService {
constructor(shopSettings) {
this.debug = Debug('service:ShopifyService');
this.debug = core_1.Debug('service:ShopifyService');
if (window.model && window.model.system && window.model.system.shopSettings) {

@@ -79,3 +81,3 @@ this.moneyFormat = window.model.system.shopSettings.moneyFormat;

function formatWithDelimiters(num, precision = 2, thousands = ',', decimal = '.') {
if (!Utils.isNumber(num) || num === null) {
if (!core_1.Utils.isNumber(num) || num === null) {
return '0';

@@ -111,1 +113,2 @@ }

}
exports.ShopifyService = ShopifyService;

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

export * from './shopify.service';
export * from './shopify-cart.service';
export * from './shopify-product.service';
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./shopify.service"));
__export(require("./shopify-cart.service"));
__export(require("./shopify-product.service"));
{
"name": "@ribajs/shopify",
"description": "Shopify extension for Ribajs",
"version": "0.16.2",
"description": "Shopify extension for Riba.js",
"version": "0.16.3",
"author": "Pascal Garber <pascal@jumplink.eu>",

@@ -9,6 +9,3 @@ "contributors": [],

"main": "src/index.ts",
"_main": "src/index.js",
"jsnext:main": "lib/index.js",
"module": "src/index.js",
"types": "lib/index.d.ts",
"module": "src/index.ts",
"source": "src/index.ts",

@@ -15,0 +12,0 @@ "license": "MIT",

import { Debug, RibaComponent, JQuery } from '@ribajs/core';
export abstract class ShopifySectionComponent {
export abstract class ShopifySectionComponent extends RibaComponent {
}
public static tagName: string = 'rv-shopify-section';
// export abstract class ShopifySectionComponent extends RibaComponent {
protected debug = Debug('component:' + ShopifySectionComponent.tagName);
// public static tagName: string = 'rv-shopify-section';
protected $el: JQuery<HTMLElement>;
// protected debug = Debug('component:' + ShopifySectionComponent.tagName);
protected abstract scope: any;
// protected $el: JQuery<HTMLElement>;
constructor(element?: HTMLElement) {
super(element);
this.$el = JQuery(this.el);
// protected abstract scope: any;
this.$el.on('shopify:section:load', this.onSectionLoad);
this.$el.on('shopify:section:unload', this.onSectionUnload);
this.$el.on('shopify:section:select', this.onSectionSelect);
this.$el.on('shopify:section:deselect', this.onSectionDeselect);
this.$el.on('shopify:section:reorder', this.onSectionReorder);
this.$el.on('shopify:block:select', this.onBlockSelect);
this.$el.on('shopify:block:deselect', this.onBlockDeselect);
}
// constructor(element?: HTMLElement) {
// super(element);
// this.$el = JQuery(this.el);
protected abstract template(): string | null;
// this.$el.on('shopify:section:load', this.onSectionLoad);
// this.$el.on('shopify:section:unload', this.onSectionUnload);
// this.$el.on('shopify:section:select', this.onSectionSelect);
// this.$el.on('shopify:section:deselect', this.onSectionDeselect);
// this.$el.on('shopify:section:reorder', this.onSectionReorder);
// this.$el.on('shopify:block:select', this.onBlockSelect);
// this.$el.on('shopify:block:deselect', this.onBlockDeselect);
// }
/**
* A section has been added or re-rendered.
* Re-execute any JavaScript needed for the section to work and display properly (as if the page had just been loaded).
*/
protected onSectionLoad(event: JQuery.Event, data: any) {
this.debug('onSectionLoad', data);
}
// protected abstract template(): string | null;
protected onSectionUnload(event: JQuery.Event, data: any) {
this.debug('onSectionUnload', data);
}
// /**
// * A section has been added or re-rendered.
// * Re-execute any JavaScript needed for the section to work and display properly (as if the page had just been loaded).
// */
// protected onSectionLoad(event: JQuery.Event, data: any) {
// this.debug('onSectionLoad', data);
// }
protected onSectionSelect(event: JQuery.Event, data: any) {
this.debug('onSectionSelect', data);
}
// protected onSectionUnload(event: JQuery.Event, data: any) {
// this.debug('onSectionUnload', data);
// }
protected onSectionDeselect(event: JQuery.Event, data: any) {
this.debug('onSectionDeselect', data);
}
// protected onSectionSelect(event: JQuery.Event, data: any) {
// this.debug('onSectionSelect', data);
// }
protected onSectionReorder(event: JQuery.Event, data: any) {
this.debug('onSectionReorder', data);
}
// protected onSectionDeselect(event: JQuery.Event, data: any) {
// this.debug('onSectionDeselect', data);
// }
protected onBlockSelect(event: JQuery.Event, data: any) {
this.debug('onBlockSelect', data);
}
// protected onSectionReorder(event: JQuery.Event, data: any) {
// this.debug('onSectionReorder', data);
// }
protected onBlockDeselect(event: JQuery.Event, data: any) {
this.debug('onBlockDeselect', data);
}
// protected onBlockSelect(event: JQuery.Event, data: any) {
// this.debug('onBlockSelect', data);
// }
// protected onBlockDeselect(event: JQuery.Event, data: any) {
// this.debug('onBlockDeselect', data);
// }
// }
}
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